Realize full screen display in VC 6.0 development
Full-screen display is an essential function of some application software programs. For example, when using resources such as VC editing engineering or editing dialog, select menu "View / Full Screen", you can enter full screen display status, press "ESC" button to exit full screen display status. In VC 6.0 we use AppWizard to generate a single document interface by default. Here, you will first discuss the method of clicking on the menu item "View / Full Screen" to implement full screen display, and how to exit full screen display status after pressing the "ESC" button. 1) In the CMAINFRAME class, increase the following three member variables. class CMainFrame: public CFrameWnd {private: // three member variables WINDOWPLACEMENT m_OldWndPlacement add their own; // used to store the original window location BOOL m_bFullScreen; // full screen display signs CRect m_FullScreenRect; // window position represents a protected when full screen: CMAINFRAME (); Declare_DyncReate (CMAINFRAME)} 2) Edit menu IDR_MAINFRAME in the resource editor. Add menu items "full screen" under the "View" menu bar. In its properties box, the ID is set to ID_FULL_SCREEN, and CAPTION is "full screen". You can also add a new tool icon in the toolbar, and make it associated with the menu item "full screen", which is also set to ID_FULL_SCREEN. 3) Design full screen display processing function, add the response function of the above-described menu item ID_full_screen message at the CMAINFRAME class.
Response function as follows: void CMainFrame :: OnFullScreen () {GetWindowPlacement (& m_OldWndPlacement); CRect WindowRect; GetWindowRect (& WindowRect); CRect ClientRect; RepositionBars (0, 0xffff, AFX_IDW_PANE_FIRST, reposQuery, & ClientRect); ClientToScreen (& ClientRect); // Get the screen Resolution INT NFULLLLLLTH = GetSystemMetrics; int nfulHeight = getSystemMetrics (sm_cyscreen); // Show the client area except the control bar to the NFullWidth, NfullHeight area, will (0, 0) and (NFullWidth, NfullHeight) Two points Extended the difference between the original window and the client area outside the control bar, get the full screen displayed window position m_fullscreenrect.Left = WindowRect.LIENTRECT.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; // set the full-screen display flag is TRUE // enter full-screen display state WINDOWPLACEMENT wndpl; wndpl.length = sizeof (WINDOWPLACEMENT); wndpl.flags = 0; wndpl.showCmd = SW_SHOWNORMAL; wndpl.rcNormalPosition = m_FullScreenRect; SetWindowPlacement (& wndpl);} 4) overloaded OnGetM CMainFrame class The InmaxInfo function provides position information displayed in full screen when displayed in full screen.