1.新增變數
windowplacement m_oldwndplacement; //用來儲存原視窗位置
bool m_bfullscreen; //全屏顯示標誌
crect m_fullscreenrect; //表示全屏顯示時的視窗位置
2.全屏
getwindowplacement(&m_oldwndplacement);
crect windowrect;
getwindowrect(&windowrect);
crect clientrect;
repositionbars(0, 0xffff, afx_idw_pane_first, reposquery, &clientrect); clienttoscreen(&clientrect);
// 獲取螢幕的解析度
int nfullwidth=getsystemmetrics(sm_cxscreen);
int nfullheight=getsystemmetrics(sm_cyscreen);
// 將除控制條外的客戶區全屏顯示到從(0,0)到(nfullwidth, nfullheight)區域, 將(0,0)和(nfullwidth, nfullheight)兩個點外擴充原視窗和除控制條之外的 客戶區位置間的差值, 就得到全屏顯示的視窗位置
m_fullscreenrect.left=windowrect.left-clientrect.left;
m_fullscreenrect.top=windowrect.top-clientrect.top;
m_fullscreenrect.right=windowrect.right-clientrect.right+nfullwidth;
m_fullscreenrect.bottom=windowrect.bottom-clientrect.bottom+nfullheight;
m_bfullscreen=true; // 設定全屏顯示標誌為 true
// 進入全屏顯示狀態
windowplacement wndpl;
wndpl.length=sizeof(windowplacement);
wndpl.flags=0;
wndpl.showcmd=sw_shownormal;
wndpl.rcnormalposition=m_fullscreenrect;
setwindowplacement(&wndpl);
3.退出全屏
if(m_bfullscreen)
js實現全屏和退出全屏功能
主要是全屏和退出全屏事件,以及相應的操作 採用window.onresize監測 function 退出全屏 exitfullscreen on click function fullscreen 和exitscreen 有多種實現方式,此處只使用了其中一種 全屏 function fullscre...
JS 實現開啟全屏和退出全屏
有個非常奇怪的問題,在 macos 系統的瀏覽器,f11是顯示桌面而不是全屏。通過選單檢視 進入全螢幕或快捷鍵command ctrl f進入全螢幕時又要調整書籤欄和工具欄。requestfullscreen發出非同步請求使元素進入全屏模式。注意element,是任何 dom 元素都能進入全屏模式!...
全屏和退出全屏功能的實現
1.判斷狀態 瀏覽器字首 const prefixname,setprefixname usestate 瀏覽器是否支援全屏 預設支援 const isfullscreendata,setisfullscreendata usestate true 是否全屏 const isfullscreen,s...