void CWarnPopVideo::FullScreenPopVideo(void) { if (m_bFullScreen==false) //full screen { //Hide OK Button CButton *pBtnOK = (CButton *)GetDlgItem(IDOK); if (pBtnOK) pBtnOK->ShowWindow(SW_HIDE); CEdit *pEdit = (CEdit*)GetDlgItem(IDC_TIMEOUT); if (pEdit) pEdit->ShowWindow(SW_HIDE); CButton *pBtnPause = (CButton*)GetDlgItem(IDC_PAUSE_ALARM); if (pBtnPause) pBtnPause->ShowWindow(SW_HIDE); //Full Video Screen GetWindowPlacement(&m_struOldPlacement); //Remove WS_SIZEBOX windows style. or not the window can't be full-creen. ModifyStyle(WS_SIZEBOX,0,0); CRect WindowRect, ClientRect; RECT m_FullScreenRect; //ReDraw the window. Get the correct edge value. GetWindowRect(&WindowRect); WindowRect.left+=1; WindowRect.right+=1; MoveWindow(CRect(0,0,352,288),TRUE); GetWindowRect(&WindowRect); GetClientRect(&ClientRect); ClientToScreen(&ClientRect); //get the dest window rect. int x = GetSystemMetrics(SM_CXSCREEN); int y = GetSystemMetrics(SM_CYSCREEN); m_FullScreenRect.left = WindowRect.left - ClientRect.left; m_FullScreenRect.top = WindowRect.top - ClientRect.top; m_FullScreenRect.right = WindowRect.right - ClientRect.right + x; m_FullScreenRect.bottom = WindowRect.bottom - ClientRect.bottom + y; // m_FullScreenRect.left = 0; // m_FullScreenRect.top = 0; // m_FullScreenRect.right = GetSystemMetrics(SM_CXSCREEN); // m_FullScreenRect.bottom = GetSystemMetrics(SM_CYSCREEN); //Move the main window to the dest rect. WINDOWPLACEMENT wndpl; wndpl.length = sizeof(WINDOWPLACEMENT); wndpl.flags = 0; wndpl.showCmd = SW_SHOWNORMAL; wndpl.rcNormalPosition = m_FullScreenRect; SetWindowPlacement(&wndpl); //Move the view winow to full-screen. RECT rc; GetClientRect(&rc); m_pPopView->MoveWindow(&rc,TRUE); // m_bFullScreen = true; } else //Restore normal screen { //Show OK Button CRect btnRect; CButton *pBtnOK = (CButton *)GetDlgItem(IDOK); if (pBtnOK) { pBtnOK->ShowWindow(SW_SHOW); pBtnOK->GetClientRect(&btnRect); } CEdit *pEdit = (CEdit*)GetDlgItem(IDC_TIMEOUT); if (pEdit) pEdit->ShowWindow(SW_SHOW); CButton *pBtnPause = (CButton*)GetDlgItem(IDC_PAUSE_ALARM); if (pBtnPause) pBtnPause->ShowWindow(SW_SHOW); //Restore old position ModifyStyle(0,WS_SIZEBOX,0); SetWindowPlacement(&m_struOldPlacement); RECT rc; GetClientRect(&rc); rc.bottom -= (btnRect.Height()+3); m_pPopView->MoveWindow(&rc,TRUE); //SetWindowSize(); // m_bFullScreen = false; } }
/** * @param hwndEdit - window handle. */ void CNumEdit::SubclassWindow(HWND hwndEdit) { CWindowImpl::SubclassWindow(hwndEdit); ModifyStyle(0, ES_UPPERCASE); UpdateRadixTitle(); }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) return -1; BOOL bNameValid; // 基于持久值设置视觉管理器和样式 OnApplicationLook(theApp.m_nAppLook); CMDITabInfo mdiTabParams; mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // 其他可用样式... mdiTabParams.m_bActiveTabCloseButton = TRUE; // 设置为 FALSE 会将关闭按钮放置在选项卡区域的右侧 mdiTabParams.m_bTabIcons = FALSE; // 设置为 TRUE 将在 MDI 选项卡上启用文档图标 mdiTabParams.m_bAutoColor = TRUE; // 设置为 FALSE 将禁用 MDI 选项卡的自动着色 mdiTabParams.m_bDocumentMenu = TRUE; // 在选项卡区域的右边缘启用文档菜单 EnableMDITabbedGroups(TRUE, mdiTabParams); if (!m_wndMenuBar.Create(this)) { TRACE0("未能创建菜单栏\n"); return -1; // 未能创建 } m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY); // 防止菜单栏在激活时获得焦点 CMFCPopupMenu::SetForceMenuFocus(FALSE); if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME)) { TRACE0("未能创建工具栏\n"); return -1; // 未能创建 } CString strToolBarName; bNameValid = strToolBarName.LoadString(IDS_TOOLBAR_STANDARD); ASSERT(bNameValid); m_wndToolBar.SetWindowText(strToolBarName); CString strCustomize; bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE); ASSERT(bNameValid); m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize); // 允许用户定义的工具栏操作: InitUserToolbars(NULL, uiFirstUserToolBarId, uiLastUserToolBarId); if (!m_wndStatusBar.Create(this)) { TRACE0("未能创建状态栏\n"); return -1; // 未能创建 } m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)); // TODO: 如果您不希望工具栏和菜单栏可停靠,请删除这五行 m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndMenuBar); DockPane(&m_wndToolBar); // 启用 Visual Studio 2005 样式停靠窗口行为 CDockingManager::SetDockingMode(DT_SMART); // 启用 Visual Studio 2005 样式停靠窗口自动隐藏行为 EnableAutoHidePanes(CBRS_ALIGN_ANY); // 加载菜单项图像(不在任何标准工具栏上): CMFCToolBar::AddToolBarForImageCollection(IDR_MENU_IMAGES, theApp.m_bHiColorIcons ? IDB_MENU_IMAGES_24 : 0); // 创建停靠窗口 if (!CreateDockingWindows()) { TRACE0("未能创建停靠窗口\n"); return -1; } m_wndFileView.EnableDocking(CBRS_ALIGN_ANY); m_wndClassView.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndFileView); CDockablePane* pTabbedBar = NULL; m_wndClassView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar); m_wndOutput.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndOutput); m_wndProperties.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndProperties); // 启用增强的窗口管理对话框 EnableWindowsDialog(ID_WINDOW_MANAGER, ID_WINDOW_MANAGER, TRUE); // 启用工具栏和停靠窗口菜单替换 EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, strCustomize, ID_VIEW_TOOLBAR); // 启用快速(按住 Alt 拖动)工具栏自定义 CMFCToolBar::EnableQuickCustomization(); if (CMFCToolBar::GetUserImages() == NULL) { // 加载用户定义的工具栏图像 if (m_UserImages.Load(_T(".\\UserImages.bmp"))) { CMFCToolBar::SetUserImages(&m_UserImages); } } // 启用菜单个性化(最近使用的命令) // TODO: 定义您自己的基本命令,确保每个下拉菜单至少有一个基本命令。 CList<UINT, UINT> lstBasicCommands; lstBasicCommands.AddTail(ID_FILE_NEW); lstBasicCommands.AddTail(ID_FILE_OPEN); lstBasicCommands.AddTail(ID_FILE_SAVE); lstBasicCommands.AddTail(ID_FILE_PRINT); lstBasicCommands.AddTail(ID_APP_EXIT); lstBasicCommands.AddTail(ID_EDIT_CUT); lstBasicCommands.AddTail(ID_EDIT_PASTE); lstBasicCommands.AddTail(ID_EDIT_UNDO); lstBasicCommands.AddTail(ID_APP_ABOUT); lstBasicCommands.AddTail(ID_VIEW_STATUS_BAR); lstBasicCommands.AddTail(ID_VIEW_TOOLBAR); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2003); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_VS_2005); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLUE); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_SILVER); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLACK); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_AQUA); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_WINDOWS_7); lstBasicCommands.AddTail(ID_SORTING_SORTALPHABETIC); lstBasicCommands.AddTail(ID_SORTING_SORTBYTYPE); lstBasicCommands.AddTail(ID_SORTING_SORTBYACCESS); lstBasicCommands.AddTail(ID_SORTING_GROUPBYTYPE); CMFCToolBar::SetBasicCommands(lstBasicCommands); // 将文档名和应用程序名称在窗口标题栏上的顺序进行交换。这 // 将改进任务栏的可用性,因为显示的文档名带有缩略图。 ModifyStyle(0, FWS_PREFIXTITLE); return 0; }
void CXTPReportInplaceList::Create(XTP_REPORTRECORDITEM_ARGS* pItemArgs, CXTPReportRecordItemConstraints* pConstaints) { SetItemArgs(pItemArgs); CRect rect(pItemArgs->rcItem); if (!m_hWnd) { CListBox::CreateEx(WS_EX_TOOLWINDOW | (pControl->GetExStyle() & WS_EX_LAYOUTRTL), _T("LISTBOX"), _T(""), LBS_NOTIFY | WS_CHILD | WS_BORDER | WS_VSCROLL, CRect(0, 0, 0, 0), pControl, 0); SetOwner(pControl); } SetFont(pControl->GetPaintManager()->GetTextFont()); ResetContent(); int dx = rect.right - rect.left + 1; CWindowDC dc(pControl); CXTPFontDC font(&dc, GetFont()); int nThumbLength = GetSystemMetrics(SM_CXHTHUMB); CString strCaption = pItem->GetCaption(pColumn); DWORD dwData = pItem->GetSelectedConstraintData(pItemArgs); for (int i = 0; i < pConstaints->GetCount(); i++) { CXTPReportRecordItemConstraint* pConstaint = pConstaints->GetAt(i); CString str = pConstaint->m_strConstraint; int nIndex = AddString(str); SetItemDataPtr(nIndex, pConstaint); dx = max(dx, dc.GetTextExtent(str).cx + nThumbLength); if ((dwData == (DWORD)-1 && strCaption == str) || (dwData == pConstaint->m_dwData)) SetCurSel(nIndex); } int nHeight = GetItemHeight(0); rect.top = rect.bottom; //rect.bottom += nHeight * min(10, GetCount()) + 2; rect.bottom += nHeight * min(m_Items2Show, GetCount()) + 2; rect.left = rect.right - dx; pControl->ClientToScreen(&rect); CRect rcWork = XTPMultiMonitor()->GetWorkArea(rect); if (rect.bottom > rcWork.bottom && rect.top > rcWork.CenterPoint().y) rect.OffsetRect(0, - rect.Height() - pItemArgs->rcItem.Height()); if (rect.left < rcWork.left) rect.OffsetRect(rcWork.left - rect.left, 0); if (rect.right > rcWork.right) rect.OffsetRect(rcWork.right - rect.right, 0); SetFocus(); if (!m_hWnd) // Can be destroyed after focus set return; SetWindowLongPtr(m_hWnd, GWLP_HWNDPARENT, 0); ModifyStyle(WS_CHILD, WS_POPUP); SetWindowLongPtr(m_hWnd, GWLP_HWNDPARENT, (LONG_PTR)pControl->m_hWnd); SetWindowPos(&CWnd::wndTopMost, rect.left, rect.top, rect.Width(), rect.Height(), SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOOWNERZORDER); CXTPMouseMonitor::SetupHook(this); }
void CxStatic::SetMoveable(BOOL moveAble) { ModifyStyle(0, SS_NOTIFY); m_bAllowMove = moveAble; }
void CExtMiniDockFrameWnd::_ResizingStart( UINT nHitTest, const CPoint & point ) { ASSERT( m_nResizingMode == HTNOWHERE ); ASSERT( IsWindowVisible() ); CExtPopupMenuWnd::CancelMenuTracking(); CWnd::CancelToolTips(); CExtControlBar * pExtBar = GetControlBarExt(); ASSERT_VALID( pExtBar ); if( !pExtBar->_IsShowContentWhenDragging() && pExtBar->IsFixedMode() ) { m_nResizingMode = HTNOWHERE; pExtBar->m_pDockContext->StartResize(nHitTest, point); return; } switch( nHitTest ) { case HTLEFT: case HTRIGHT: case HTTOP: case HTTOPLEFT: case HTTOPRIGHT: case HTBOTTOM: case HTBOTTOMLEFT: case HTBOTTOMRIGHT: m_nResizingMode = nHitTest; break; default: return; } // switch( nHitTest ) #ifdef _DEBUG int nPos = 1; CControlBar * pDebugDummyBar = NULL; while( pDebugDummyBar == NULL && nPos < m_wndDockBar.m_arrBars.GetSize() ) pDebugDummyBar = reinterpret_cast<CExtDockBar&> (m_wndDockBar). GetDockedControlBar(nPos++); ASSERT(pDebugDummyBar != NULL); ASSERT_KINDOF(CExtControlBar, pDebugDummyBar); ASSERT(pDebugDummyBar->m_pDockContext != NULL); // CBRS_SIZE_DYNAMIC toolbars cannot have the CBRS_FLOAT_MULTI style ASSERT((m_wndDockBar.m_dwStyle & CBRS_FLOAT_MULTI) == 0); #endif // _DEBUG ASSERT( pExtBar == pDebugDummyBar ); ASSERT(pExtBar->m_pDockContext != NULL); if( !pExtBar->IsFixedMode() ) ModifyStyle( __REMOVED_NONFIXMODE_STYLES, 0 ); BringWindowToTop(); CExtMouseCaptureSink::SetCapture( GetSafeHwnd() ); GetWindowRect( &m_rcWndResizingStart ); while( m_nResizingMode != HTNOWHERE ) { ::WaitMessage(); MSG msg; // Process all the messages in the message queue while( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) ) { bool bStop = false; switch( msg.message ) { case WM_ACTIVATEAPP: case WM_COMMAND: bStop = true; break; default: if( WM_KEYFIRST <= msg.message && msg.message <= WM_KEYLAST ) bStop = true; break; } // switch( msg.message ) if( (!bStop) && CExtMouseCaptureSink::GetCapture() != GetSafeHwnd() ) bStop = true; if( bStop ) { _ResizingEnd(); return; } if( !AfxGetThread()->PumpMessage() ) { PostQuitMessage(0); return; // Signal WM_QUIT received } // if( !AfxGetThread()->PumpMessage() ) } // while( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) ) if( CExtControlBar::g_bEnableOnIdleCalls ) { for( LONG nIdleCounter = 0L; ::AfxGetThread()->OnIdle(nIdleCounter); nIdleCounter ++ ); } } // while( m_nResizingMode != HTNOWHERE ) }
//初始化函数 BOOL CGameFrameDlg::OnInitDialog() { __super::OnInitDialog(); //设置属性 ModifyStyle(WS_CAPTION|WS_BORDER,0,0); //读取配置 m_bAllowSound=AfxGetApp()->GetProfileInt(TEXT("GameOption"),TEXT("EnableSound"),TRUE)?true:false; //创建控制 m_pGameFrameControl=new CGameFrameControl(this); if (m_pGameFrameControl==NULL) throw TEXT("游戏框架创建失败"); //创建组件 if (m_MessageProxyHelper.CreateInstance()==false) throw TEXT("信息组件创建失败"); m_MessageProxyHelper->SetRichEditHwnd(&m_pGameFrameControl->m_ChatMessage); //设置界面 m_VorSplitter.SetSplitterSink(this); //创建组件 if (m_UserFaceResHelper.CreateInstance()==false) throw TEXT("头像组件加载失败"); if (m_ClientKernelHelper.CreateInstance()==false) throw TEXT("游戏框架内核模块加载失败"); //创建游戏视图 CRect rcGameView(0,0,0,0); m_pGameFrameControl->Create(IDD_FRAME_CONTROL,this); if (m_pGameFrameControl->SetUserFaceRes(m_UserFaceResHelper.GetInterface())==false) throw TEXT("头像资源接口设置失败"); m_pGameFrameView->Create(NULL,NULL,WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|WS_CLIPCHILDREN,rcGameView,this,10); if (m_pGameFrameView->SetUserFaceRes(m_UserFaceResHelper.GetInterface())==false) throw TEXT("头像资源接口设置失败"); CVideoServiceManager * pVideoServiceManager=CVideoServiceManager::GetInstance(); if (pVideoServiceManager!=NULL && pVideoServiceManager->SetUserFaceRes(m_UserFaceResHelper.GetInterface())==false) throw TEXT("头像资源接口设置失败"); //初始化内核 LPCTSTR lpszCmdLine=AfxGetApp()->m_lpCmdLine; bool bSuccess=m_ClientKernelHelper->InitClientKernel(lpszCmdLine,m_pKernelSink); if (bSuccess==false) throw TEXT("游戏框架逻辑模块初始化失败"); bSuccess=m_ClientKernelHelper->SetMessageProxy(m_MessageProxyHelper.GetInterface()); if (bSuccess==false) throw TEXT("获取消息输出模块失败"); //初始化游戏 m_pGameFrameControl->SetClientKernel(m_ClientKernelHelper.GetInterface()); if (InitGameFrame()==false) throw TEXT("游戏框架初始化失败"); //加载资源 UpdateSkinResource(); //移动窗口 INT nXScreen=GetSystemMetrics(SM_CXSCREEN); INT nYScreen=GetSystemMetrics(SM_CYSCREEN); SetWindowPos(NULL,0,0,__min(nXScreen,1024),__min(nYScreen,730),SWP_NOZORDER|SWP_NOMOVE); //显示窗口 m_bInitDialog=true; m_pGameFrameView->ShowWindow(SW_SHOW); m_pGameFrameControl->ShowWindow(SW_SHOW); //显示窗口 CenterWindow(); MaxSizeWindow(); ShowWindow(SW_SHOW); return TRUE; }
//建立消息 int CGameFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (__super::OnCreate(lpCreateStruct)==-1) return -1; //设置属性 ModifyStyle(WS_CAPTION|WS_BORDER,0,0); //设置图标 HICON hIcon=LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME)); SetIcon(hIcon,TRUE); SetIcon(hIcon,FALSE); //设置标题 CString strTitle; strTitle.LoadString(AfxGetInstanceHandle(),IDS_MAIN_TITLE); SetWindowText(strTitle); //广告控件 m_BrowerAD.Create(NULL,NULL,WS_VISIBLE|WS_CHILD,CRect(0,0,0,0),this,IDC_BROWER_AD,NULL); m_BrowerAD.Navigate(TEXT("http://127.0.0.1:8086/AD/GamePlazaAD.asp"),NULL,NULL,NULL,NULL); //拆分条控件 m_Splitter.Create(NULL,NULL,WS_VISIBLE|WS_CHILD,CRect(0,0,0,0),this,IDC_SPLITTER,NULL); m_Splitter.SetSplitterSink(this); //用户视图 m_UserInfoView.Create(IDD_USER_INFO,this); m_UserInfoView.ShowWindow(SW_SHOW); //服务器视图 m_ServerItemView.Create(WS_VISIBLE|WS_CHILD,CRect(0,0,0,0),this,IDC_SERVER_ITEM_VIEW); m_ServerItemView.InitServerItemView(this); g_GlobalUnits.m_ServerListManager.InitServerListManager(&m_ServerItemView); //好友列表 m_wShowListType = IDC_BT_LIST_CONTROL_1; m_UserCompanionList.Create(WS_CHILD,CRect(0,0,0,0),this,IDC_COMPANION_LIST); //创建按钮 m_btMin.Create(NULL,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_MIN); m_btMax.Create(NULL,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_MAX); m_btClose.Create(NULL,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_CLOSE); m_btExChangeSkin.Create(NULL,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_EXCHANGE_SINK); m_btExChangeSkin.ShowWindow(SW_HIDE); m_btButton1.Create(TEXT(""),WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_BUTTON_1); m_btButton2.Create(TEXT(""),WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_BUTTON_2); m_btButton3.Create(TEXT(""),WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_BUTTON_3); m_btButton4.Create(TEXT(""),WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_BUTTON_4); m_btButton5.Create(TEXT(""),WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_BUTTON_5); m_btGamePlaza.Create(TEXT("游戏大厅"),WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_PLAZA); m_btSelfOption.Create(TEXT(""),WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_SELF_OPTION); m_btSwitchUser.Create(TEXT(""),WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_SWITCH_ACCOUNTS); m_btGlobalOption.Create(TEXT(""),WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_SYSTEM_OPTION); m_btListControl1.Create(NULL,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_LIST_CONTROL_1); m_btListControl2.Create(NULL,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,IDC_BT_LIST_CONTROL_2); for (WORD i=0;i<CountArray(m_btViewItem);i++) { CRect rcCreate(0,0,0,0); m_btViewItem[i].Create(NULL,WS_CHILD,rcCreate,this,IDC_BT_VIEW_ITEM+i); } //皮肤资源 UpdateSkinResource(); //建立提示控件 m_ToolTipCtrl.Create(this); m_ToolTipCtrl.Activate(TRUE); m_ToolTipCtrl.AddTool(GetDlgItem(IDC_BT_MIN),TEXT("最小化游戏广场")); m_ToolTipCtrl.AddTool(GetDlgItem(IDC_BT_CLOSE),TEXT("退出游戏广场")); //创建控件 m_DlgGamePlaza.Create(IDD_GAME_PLAZA,this); ActivePlazaViewItem(); //注册热键 g_GlobalUnits.RegisterHotKey(m_hWnd,IDI_HOT_KEY_BOSS,g_GlobalOption.m_wBossHotKey); //窗口位置 CRect rcArce; SystemParametersInfo(SPI_GETWORKAREA,0,&rcArce,SPIF_SENDCHANGE); //显示窗口 MaxSizeWindow(); ShowWindow(SW_SHOW); //默认位置 m_rcNormalSize.left=(rcArce.Width()-LESS_SCREEN_X)/2; m_rcNormalSize.top=(rcArce.Height()-LESS_SCREEN_Y)/2; m_rcNormalSize.right=(rcArce.Width()+LESS_SCREEN_X)/2; m_rcNormalSize.bottom=(rcArce.Height()+LESS_SCREEN_Y)/2; return 0; }
void CMyColorList::PreSubclassWindow() { ModifyStyle(0,LVS_OWNERDRAWFIXED); }
void CBmpTab::PreSubclassWindow() { // TODO: Add your specialized code here and/or call the base class ModifyStyle(0,SS_NOTIFY); CStatic::PreSubclassWindow(); }
void CNewHeaderCtrl::Init() { ModifyStyle(0, HDS_FLAT); }
bool CSkinDialog::LoadSkin(const char * szSkinPath /* = NULL */, const char * szControlName) { if(szSkinPath==NULL) { CImgSkin::Unload(); return true; } if(!CImgSkin::Load(szSkinPath, szControlName)) return false; m_dwStyle = GetStyle(); // 去掉标题栏,边框,只留客户区 // ModifyStyle(WS_CAPTION|WS_THICKFRAME, 0); ModifyStyle(WS_CAPTION, 0); CRect rcWindow; CRect rcClient; CRect rc; GetWindowRect(&rcWindow); GetClientRect(&m_rcClient); // 圆角 SetWindowRgn(CreateRoundRectRgn(0, 0, rcWindow.Width(), rcWindow.Height(), m_mapRect["RoundCorner"].Width, m_mapRect["RoundCorner"].Height), TRUE); if(!HasStyle(WS_CHILD)) { // 调整窗口自己 rcWindow.left -= m_mapRect["BorderLeft"].Width; rcWindow.right += m_mapRect["BorderRight"].Width; rcWindow.top -= m_mapRect["TitleLeft"].Height; rcWindow.bottom += m_mapRect["BorderBot"].Height; CWnd * pParent = GetParent(); if(pParent==NULL) pParent = GetDesktopWindow(); //pParent->ScreenToClient(&rcWindow); //MoveWindow(rcWindow, FALSE); GetClientRect(&rcClient); POINT ptOffset = {0}; CRect rcChild; CWnd* pWndChild; // 菜单 CMenu * pMenu = GetMenu(); if(pMenu) { m_wndMenuBar.CreateToolBar(WS_VISIBLE|WS_CHILD|CBRS_TOOLTIPS, this, ID_MENU_BAR); m_wndMenuBar.LoadMenu(pMenu); m_wndMenuBar.SetFlags(xtpFlagStretched); SetMenu(NULL); CXTPPaintManager::SetTheme(xtpThemeOffice2003); m_wndMenuBar.LoadSkin(szSkinPath); RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, reposDefault, NULL, &rcClient); AddAnchor(m_wndMenuBar, ANCHOR_TOPLEFT|ANCHOR_TOPRIGHT); m_wndMenuBar.GetWindowRect(&rc); ptOffset.y += rc.Height(); pWndChild = GetWindow(GW_CHILD); while (pWndChild) { if(pWndChild!=&m_wndMenuBar) { pWndChild->GetWindowRect(rcChild); rcChild.OffsetRect(ptOffset); ScreenToClient(&rcChild); pWndChild->MoveWindow(rcChild, FALSE); } pWndChild = pWndChild->GetNextWindow(); } } // 调整子窗口 /* ptOffset.x = m_mapRect["BorderLeft"].Width; ptOffset.y = m_mapRect["TitleLeft"].Height; pWndChild = GetWindow(GW_CHILD); while (pWndChild) { pWndChild->GetWindowRect(rcChild); rcChild.OffsetRect(ptOffset); ScreenToClient(&rcChild); pWndChild->MoveWindow(rcChild, FALSE); pWndChild = pWndChild->GetNextWindow(); } m_rcClient.left = ptOffset.x; m_rcClient.right = m_rcClient.left+rcClient.Width(); m_rcClient.top += ptOffset.y; m_rcClient.bottom = m_rcClient.top+rcClient.Height(); */ } return true; }
void CImgButton::PreSubclassWindow() { ModifyStyle(0, BS_OWNERDRAW, 0); CButton::PreSubclassWindow(); }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) return -1; BOOL bNameValid; // set the visual manager and style based on persisted value OnApplicationLook(theApp.m_nAppLook); CMDITabInfo mdiTabParams; mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // other styles available... mdiTabParams.m_bActiveTabCloseButton = TRUE; // set to FALSE to place close button at right of tab area mdiTabParams.m_bTabIcons = FALSE; // set to TRUE to enable document icons on MDI taba mdiTabParams.m_bAutoColor = TRUE; // set to FALSE to disable auto-coloring of MDI tabs mdiTabParams.m_bDocumentMenu = TRUE; // enable the document menu at the right edge of the tab area EnableMDITabbedGroups(TRUE, mdiTabParams); m_wndRibbonBar.Create(this); m_wndRibbonBar.LoadFromResource(IDR_RIBBON); if (!m_wndStatusBar.Create(this)) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } CString strTitlePane1; CString strTitlePane2; bNameValid = strTitlePane1.LoadString(IDS_STATUS_PANE1); ASSERT(bNameValid); bNameValid = strTitlePane2.LoadString(IDS_STATUS_PANE2); ASSERT(bNameValid); m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE1, strTitlePane1, TRUE), strTitlePane1); m_wndStatusBar.AddExtendedElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE2, strTitlePane2, TRUE), strTitlePane2); // enable Visual Studio 2005 style docking window behavior CDockingManager::SetDockingMode(DT_SMART); // enable Visual Studio 2005 style docking window auto-hide behavior EnableAutoHidePanes(CBRS_ALIGN_ANY); // Load menu item image (not placed on any standard toolbars): CMFCToolBar::AddToolBarForImageCollection(IDR_MENU_IMAGES, theApp.m_bHiColorIcons ? IDB_MENU_IMAGES_24 : 0); // create docking windows if (!CreateDockingWindows()) { TRACE0("Failed to create docking windows\n"); return -1; } m_wndFileView.EnableDocking(CBRS_ALIGN_ANY); m_wndClassView.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndFileView); CDockablePane* pTabbedBar = NULL; m_wndClassView.AttachToTabWnd(&m_wndFileView, DM_SHOW, TRUE, &pTabbedBar); m_wndOutput.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndOutput); m_wndProperties.EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndProperties); // Enable enhanced windows management dialog EnableWindowsDialog(ID_WINDOW_MANAGER, ID_WINDOW_MANAGER, TRUE); // Switch the order of document name and application name on the window title bar. This // improves the usability of the taskbar because the document name is visible with the thumbnail. ModifyStyle(0, FWS_PREFIXTITLE); return 0; }
HRESULT BKMainFrame::initDirectDraw() { if ( display ) { delete display; display = NULL; } display = new CDisplay(); if ( isFullScreenMode() ) { CDC* dc = CWnd::GetDesktopWindow()->GetDC(); int bpp = dc->GetDeviceCaps( BITSPIXEL ); CWnd::GetDesktopWindow()->ReleaseDC( dc ); if ( display->CreateFullScreenDisplay( this, 512, 256, bpp ) != S_OK ) { AfxMessageBox( "Failed initializing DirectDraw." ); return -1; } ModifyStyle( WS_OVERLAPPEDWINDOW, 0 ); SetMenu( NULL ); fullWindowWidth = display->getSurfaceDesc()->dwWidth; fullWindowHeight = display->getSurfaceDesc()->dwHeight; } else { if ( display->CreateWindowedDisplay( this, bk_width, bk_height ) != S_OK ) { AfxMessageBox( "Failed initializing DirectDraw." ); return -1; } ModifyStyle( 0, WS_OVERLAPPEDWINDOW ); SetMenu( CMenu::FromHandle( ::LoadMenu( NULL, MAKEINTRESOURCE( IDR_MAINFRAME ) ) ) ); } ::SystemParametersInfo( SPI_GETWORKAREA, 0, &screenRect, 0 ); updateBounds(); ShowCursor( !fullScreenMode ); bytePerPixel = display->getSurfaceDesc()->ddpfPixelFormat.dwRGBBitCount >> 3; if ( bytePerPixel > 1 ) { DWORD rMask = display->getSurfaceDesc()->ddpfPixelFormat.dwRBitMask; DWORD gMask = display->getSurfaceDesc()->ddpfPixelFormat.dwGBitMask; DWORD bMask = display->getSurfaceDesc()->ddpfPixelFormat.dwBBitMask; DWORD mask; rBits = 0; gBits = 0; bBits = 0; rZero = 0; gZero = 0; bZero = 0; mask = rMask; while ( (mask & 0x1) == 0 ) { mask = mask >> 1; rZero++; } while ( mask & 0x1 ) { mask = mask >> 1; rBits++; } mask = gMask; while ( (mask & 0x1) == 0 ) { mask = mask >> 1; gZero++; } while ( mask & 0x1 ) { mask = mask >> 1; gBits++; } mask = bMask; while ( (mask & 0x1) == 0 ) { mask = mask >> 1; bZero++; } while ( mask & 0x1 ) { mask = mask >> 1; bBits++; } rBits = 8 - rBits; gBits = 8 - gBits; bBits = 8 - bBits; }
// virtual override of CWnd::Create BOOL CFormView::Create(LPCTSTR /*lpszClassName*/, LPCTSTR /*lpszWindowName*/, DWORD dwRequestedStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) { ASSERT(pParentWnd != NULL); ASSERT(m_lpszTemplateName != NULL); m_pCreateContext = pContext; // save state for later OnCreate #ifdef _DEBUG // dialog template must exist and be invisible with WS_CHILD set if (!_AfxCheckDialogTemplate(m_lpszTemplateName, TRUE)) { ASSERT(FALSE); // invalid dialog template name PostNcDestroy(); // cleanup if Create fails too soon return FALSE; } #endif //_DEBUG #ifdef _MAC HINSTANCE hInst = AfxFindResourceHandle(m_lpszTemplateName, RT_DIALOG); _AfxStripDialogCaption(hInst, m_lpszTemplateName); #endif // initialize common controls VERIFY(AfxDeferRegisterClass(AFX_WNDCOMMCTLS_REG)); // call PreCreateWindow to get prefered extended style CREATESTRUCT cs; memset(&cs, 0, sizeof(CREATESTRUCT)); if (dwRequestedStyle == 0) dwRequestedStyle = AFX_WS_DEFAULT_VIEW; cs.style = dwRequestedStyle; if (!PreCreateWindow(cs)) return FALSE; // create a modeless dialog if (!CreateDlg(m_lpszTemplateName, pParentWnd)) return FALSE; m_pCreateContext = NULL; // we use the style from the template - but make sure that // the WS_BORDER bit is correct // the WS_BORDER bit will be whatever is in dwRequestedStyle ModifyStyle(WS_BORDER|WS_CAPTION, dwRequestedStyle & (WS_BORDER|WS_CAPTION)); ModifyStyleEx(WS_EX_CLIENTEDGE, cs.dwExStyle & WS_EX_CLIENTEDGE); SetDlgCtrlID(nID); CRect rectTemplate; GetWindowRect(rectTemplate); SetScrollSizes(MM_TEXT, rectTemplate.Size()); // initialize controls etc if (!ExecuteDlgInit(m_lpszTemplateName)) return FALSE; // force the size requested SetWindowPos(NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER|SWP_NOACTIVATE); // make visible if requested if (dwRequestedStyle & WS_VISIBLE) ShowWindow(SW_NORMAL); return TRUE; }
UINT CExtMiniDockFrameWnd::OnNcHitTest(CPoint point) { if( GetStyle() & MFS_MOVEFRAME ) ModifyStyle( MFS_MOVEFRAME, 0 ); //UINT nHit = CMiniDockFrameWnd::OnNcHitTest(point); CRect rcBar; GetWindowRect( &rcBar ); if( !rcBar.PtInRect( point ) ) return HTNOWHERE; UINT nHit = HTCLIENT; int nWinResizingFrameDX = ::GetSystemMetrics( SM_CXSIZEFRAME ); int nWinResizingFrameDY = ::GetSystemMetrics( SM_CYSIZEFRAME ); int nSmallCaptionDY = ::GetSystemMetrics( SM_CYSMCAPTION ); CRect rcTest( rcBar.left, rcBar.top, rcBar.right, rcBar.top + nWinResizingFrameDY ); if( rcTest.PtInRect( point ) ) nHit = HTTOP; else { rcTest.SetRect( rcBar.left, rcBar.bottom - nWinResizingFrameDY, rcBar.right, rcBar.bottom ); if( rcTest.PtInRect( point ) ) nHit = HTBOTTOM; else { rcTest.SetRect( rcBar.left, rcBar.top, rcBar.left + nWinResizingFrameDX, rcBar.bottom ); if( rcTest.PtInRect( point ) ) nHit = HTLEFT; else { rcTest.SetRect( rcBar.right - nWinResizingFrameDX, rcBar.top, rcBar.right, rcBar.bottom ); if( rcTest.PtInRect( point ) ) nHit = HTRIGHT; else { rcTest.SetRect( rcBar.left, rcBar.top + nWinResizingFrameDY, rcBar.right, rcBar.top + nWinResizingFrameDY + nSmallCaptionDY ); if( rcTest.PtInRect( point ) ) nHit = HTCAPTION; } } } } switch( nHit ) { case HTTOP: { rcTest.SetRect( rcBar.left, rcBar.top, rcBar.left + nSmallCaptionDY, rcBar.top + nWinResizingFrameDY ); if( rcTest.PtInRect(point) ) nHit = HTTOPLEFT; else { rcTest.SetRect( rcBar.right - nWinResizingFrameDY, rcBar.top, rcBar.right, rcBar.top + nWinResizingFrameDY ); if( rcTest.PtInRect(point) ) nHit = HTTOPRIGHT; } } break; case HTBOTTOM: { rcTest.SetRect( rcBar.left, rcBar.bottom - nWinResizingFrameDY, rcBar.left + nSmallCaptionDY, rcBar.bottom ); if( rcTest.PtInRect(point) ) nHit = HTBOTTOMLEFT; else { rcTest.SetRect( rcBar.right - nWinResizingFrameDY, rcBar.bottom - nWinResizingFrameDY, rcBar.right, rcBar.bottom ); if( rcTest.PtInRect(point) ) nHit = HTBOTTOMRIGHT; } } break; case HTLEFT: { rcTest.SetRect( rcBar.left, rcBar.top, rcBar.left + nWinResizingFrameDX, rcBar.top + nSmallCaptionDY ); if( rcTest.PtInRect(point) ) nHit = HTTOPLEFT; else { rcTest.SetRect( rcBar.left, rcBar.bottom - nSmallCaptionDY, rcBar.left + nWinResizingFrameDX, rcBar.bottom ); if( rcTest.PtInRect(point) ) nHit = HTBOTTOMLEFT; } } break; case HTRIGHT: { rcTest.SetRect( rcBar.right - nWinResizingFrameDX, rcBar.top, rcBar.right, rcBar.top + nSmallCaptionDY ); if( rcTest.PtInRect(point) ) nHit = HTTOPRIGHT; else { rcTest.SetRect( rcBar.right - nWinResizingFrameDX, rcBar.bottom - nSmallCaptionDY, rcBar.right, rcBar.bottom ); if( rcTest.PtInRect(point) ) nHit = HTBOTTOMRIGHT; } } break; } // switch( nHit ) bool bNcRepaint = false; CExtControlBar * pExtBar = GetControlBarExt(); if( pExtBar != NULL ) { ASSERT_VALID( pExtBar ); UINT nHT = pExtBar->NcButtons_HitTest( point ); if( nHT != HTCLIENT ) { pExtBar->m_bNcAreaBtnTracking = true; if( pExtBar->_IsDockSiteCustomizeMode() ) SetTimer( 4, 20, NULL ); return nHT; } else { bNcRepaint = true; pExtBar->m_bNcAreaBtnTracking = false; } if( pExtBar->IsFixedMode() ) { bool bPaletteMode = false; CExtToolControlBar * pToolBar = DYNAMIC_DOWNCAST( CExtToolControlBar, pExtBar ); if( pToolBar != NULL ) { ASSERT_VALID( pToolBar ); bPaletteMode = pToolBar->m_bPaletteMode; } // if( pToolBar != NULL ) switch( nHit ) { case HTTOP: case HTBOTTOM: case HTLEFT: case HTRIGHT: if( bPaletteMode ) nHit = HTCAPTION; break; case HTTOPLEFT: case HTTOPRIGHT: nHit = bPaletteMode ? HTCAPTION : HTTOP; break; case HTBOTTOMLEFT: case HTBOTTOMRIGHT: nHit = bPaletteMode ? HTCAPTION : HTBOTTOM; break; } // switch( nHit ) } // if( pExtBar->IsFixedMode() ) } // if( pExtBar != NULL ) if( bNcRepaint ) SendMessage( WM_NCPAINT ); return nHit; }
int COptionsPropSheet::OnCreate( LPCREATESTRUCT lpcs ) { ModifyStyle( 0, WS_MINIMIZEBOX ); ModifyStyleEx( 0, WS_EX_APPWINDOW ); return CPropertySheet::OnCreate( lpcs ); }
void CGuiCheckBox::PreSubclassWindow() { ModifyStyle(0, BS_OWNERDRAW); CButton::PreSubclassWindow(); }
//************************************************************************************* void CBCGPFrameWnd::RecalcLayout (BOOL bNotify) { if (m_bInRecalcLayout) return; m_bInRecalcLayout = TRUE; BOOL bWasOleInPlaceActive = m_Impl.m_bIsOleInPlaceActive; m_Impl.m_bIsOleInPlaceActive = FALSE; COleClientItem* pActiveItem = GetInPlaceActiveItem (); if (pActiveItem != NULL && pActiveItem->m_pInPlaceFrame != NULL && pActiveItem->GetItemState () == COleClientItem::activeUIState) { m_Impl.m_bIsOleInPlaceActive = TRUE; m_Impl.m_bHadCaption = (GetStyle () & WS_CAPTION) != 0; } if (!m_bIsMinimized) { CView* pView = GetActiveView (); if (m_dockManager.IsPrintPreviewValid () || m_pNotifyHook != NULL) { if (pView != NULL && pView->IsKindOf (RUNTIME_CLASS (CBCGPPrintPreviewView))) { m_dockManager.RecalcLayout (bNotify); CRect rectClient = m_dockManager.GetClientAreaBounds (); pView->SetWindowPos (NULL, rectClient.left, rectClient.top, rectClient.Width (), rectClient.Height (), SWP_NOZORDER | SWP_NOACTIVATE); } else { if (bNotify && m_pNotifyHook != NULL) { ActiveItemRecalcLayout (); } else { m_bInRecalcLayout = FALSE; CFrameWnd::RecalcLayout (bNotify); AdjustClientArea (); } } } else { m_dockManager.RecalcLayout (bNotify); AdjustClientArea (); } } m_bInRecalcLayout = FALSE; if (bWasOleInPlaceActive != m_Impl.m_bIsOleInPlaceActive) { if (!m_Impl.m_bHadCaption) { if (m_Impl.m_bIsOleInPlaceActive) { ModifyStyle (0, WS_CAPTION); } else { ModifyStyle (WS_CAPTION, 0); } } m_Impl.OnChangeVisualManager (); SetWindowPos (NULL, -1, -1, -1, -1, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_FRAMECHANGED); } }
/////////////////////////////////////////////////// // full screen void CBSWndContainer::SetFullScreen(BOOL bFlag) { if(bFlag==m_bFullScreen) return; if( bFlag ) {//全屏 // //得到显示器分辨率 // int cx=GetSystemMetrics(SM_CXSCREEN); // int cy=GetSystemMetrics(SM_CYSCREEN); // // //保存位置信息 // GetWindowPlacement(&_temppl); // //修改风格 // ModifyStyle(WS_CHILD,WS_POPUP); // //修改父窗口 // _tempparent=SetParent(NULL); // _tempparent->ShowWindow(SW_HIDE); //移动窗口 /* MoveWindow(0,0,cx,cy);*/ ModifyStyle(WS_CHILD,WS_POPUP); //修改父窗口 // _tempparent=SetParent(NULL); // _tempparent->ShowWindow(SW_HIDE); GetWindowPlacement(&m_OldWndPlacement); CRect WindowRect; GetWindowRect(&WindowRect); CRect ClientRect; RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, reposQuery, &ClientRect); ClientToScreen(&ClientRect); // 获取屏幕的分辨率 CRect screenRect; GetCurrentScreenMonitorRect(m_hWnd, screenRect); int nFullWidth = screenRect.Width(); //GetSystemMetrics(SM_CXSCREEN); int nFullHeight = screenRect.Height(); //GetSystemMetrics(SM_CYSCREEN); //将除控制条外的客户区全屏显示到从(0,0)到(nFullWidth, nFullHeight)区域, 将(0,0)和(nFullWidth, nFullHeight)两个点外扩充原窗口和除控制条之外的 客户区位置间的差值, 就得到全屏显示的窗口位置 m_FullScreenRect.left= WindowRect.left - ClientRect.left + screenRect.left; m_FullScreenRect.top = WindowRect.top - ClientRect.top + screenRect.top; m_FullScreenRect.right = m_FullScreenRect.left + WindowRect.right - ClientRect.right + nFullWidth;//::GetSystemMetrics(SM_CXSCREEN); m_FullScreenRect.bottom = m_FullScreenRect.top + WindowRect.bottom - ClientRect.bottom + nFullHeight;//::GetSystemMetrics(SM_CYSCREEN); m_bFullScreen=TRUE; // 设置全屏显示标志为 TRUE // 进入全屏显示状态 WINDOWPLACEMENT wndpl; wndpl.length=sizeof(WINDOWPLACEMENT); wndpl.flags=0; wndpl.showCmd=SW_SHOWNORMAL; wndpl.rcNormalPosition= m_FullScreenRect; _tempparent=SetParent(NULL); _tempparent->ShowWindow(SW_HIDE); SetWindowPlacement(&wndpl); // SetWindowPos(&wndTopMost,0,0,cx,cy,NULL); } else {//还原 //还原父窗口 // _tempparent->ShowWindow(SW_SHOW); // SetParent(_tempparent); // //还原风格 // ModifyStyle(WS_POPUP,WS_CHILD); // //还原位置 // SetWindowPlacement(&_temppl); _tempparent->ShowWindow(SW_SHOW); SetParent(_tempparent); //还原风格 ModifyStyle(WS_POPUP,WS_CHILD); SetWindowPlacement(&m_OldWndPlacement); } m_bFullScreen=bFlag; Invalidate(); }
//*********************************************************************** //** CButton Overrides ** //*********************************************************************** void CColorButton::PreSubclassWindow() { ModifyStyle(0, BS_OWNERDRAW); _Inherited::PreSubclassWindow(); }
void CSwingCheckBox::PreSubclassWindow() { // TODO: Add your specialized code here and/or call the base class CButton::PreSubclassWindow(); ModifyStyle(0, BS_OWNERDRAW); }
void WndGuage::BeginPopUp(void) { ModifyStyle(FWS_VISIBLE,0); ui::Manager::GetInstance()->BeginPopupWnd(this); }
/** * @param hwndEdit - window handle. */ void CNumEdit::Attach(HWND hwndEdit) { CWindowImpl::Attach(hwndEdit); ModifyStyle(0, ES_UPPERCASE); UpdateRadixTitle(); }
void WndGuage::EndPopUp(void) { ModifyStyle(0,FWS_VISIBLE); ui::Manager::GetInstance()->EndPopupWnd(); }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) return -1; BOOL bNameValid; // set the visual manager and style based on persisted value OnApplicationLook(theApp.m_nAppLook); CMDITabInfo mdiTabParams; mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE; // other styles available... mdiTabParams.m_bActiveTabCloseButton = TRUE; // set to FALSE to place close button at right of tab area mdiTabParams.m_bTabIcons = FALSE; // set to TRUE to enable document icons on MDI taba mdiTabParams.m_bAutoColor = TRUE; // set to FALSE to disable auto-coloring of MDI tabs mdiTabParams.m_bDocumentMenu = TRUE; // enable the document menu at the right edge of the tab area EnableMDITabbedGroups(TRUE, mdiTabParams); if (!m_wndMenuBar.Create(this)) { TRACE0("Failed to create menubar\n"); return -1; // fail to create } m_wndMenuBar.SetPaneStyle(m_wndMenuBar.GetPaneStyle() | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY); // prevent the menu bar from taking the focus on activation CMFCPopupMenu::SetForceMenuFocus(FALSE); if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME)) { TRACE0("Failed to create toolbar\n"); return -1; // fail to create } CString strToolBarName; bNameValid = strToolBarName.LoadString(IDS_TOOLBAR_STANDARD); ASSERT(bNameValid); m_wndToolBar.SetWindowText(strToolBarName); CString strCustomize; bNameValid = strCustomize.LoadString(IDS_TOOLBAR_CUSTOMIZE); ASSERT(bNameValid); m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize); // Allow user-defined toolbars operations: InitUserToolbars(NULL, uiFirstUserToolBarId, uiLastUserToolBarId); if (!m_wndStatusBar.Create(this)) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)); // TODO: Delete these five lines if you don't want the toolbar and menubar to be dockable m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY); m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockPane(&m_wndMenuBar); DockPane(&m_wndToolBar); // enable Visual Studio 2005 style docking window behavior CDockingManager::SetDockingMode(DT_SMART); // enable Visual Studio 2005 style docking window auto-hide behavior EnableAutoHidePanes(CBRS_ALIGN_ANY); // Enable enhanced windows management dialog EnableWindowsDialog(ID_WINDOW_MANAGER, ID_WINDOW_MANAGER, TRUE); // Enable toolbar and docking window menu replacement EnablePaneMenu(TRUE, ID_VIEW_CUSTOMIZE, strCustomize, ID_VIEW_TOOLBAR); // enable quick (Alt+drag) toolbar customization CMFCToolBar::EnableQuickCustomization(); if (CMFCToolBar::GetUserImages() == NULL) { // load user-defined toolbar images if (m_UserImages.Load(_T(".\\UserImages.bmp"))) { CMFCToolBar::SetUserImages(&m_UserImages); } } // enable menu personalization (most-recently used commands) // TODO: define your own basic commands, ensuring that each pulldown menu has at least one basic command. CList<UINT, UINT> lstBasicCommands; lstBasicCommands.AddTail(ID_FILE_NEW); lstBasicCommands.AddTail(ID_FILE_OPEN); lstBasicCommands.AddTail(ID_FILE_SAVE); lstBasicCommands.AddTail(ID_FILE_PRINT); lstBasicCommands.AddTail(ID_APP_EXIT); lstBasicCommands.AddTail(ID_EDIT_CUT); lstBasicCommands.AddTail(ID_EDIT_PASTE); lstBasicCommands.AddTail(ID_EDIT_UNDO); lstBasicCommands.AddTail(ID_APP_ABOUT); lstBasicCommands.AddTail(ID_VIEW_STATUS_BAR); lstBasicCommands.AddTail(ID_VIEW_TOOLBAR); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2003); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_VS_2005); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLUE); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_SILVER); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_BLACK); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_OFF_2007_AQUA); lstBasicCommands.AddTail(ID_VIEW_APPLOOK_WINDOWS_7); CMFCToolBar::SetBasicCommands(lstBasicCommands); // Switch the order of document name and application name on the window title bar. This // improves the usability of the taskbar because the document name is visible with the thumbnail. ModifyStyle(0, FWS_PREFIXTITLE); return 0; }
/* void CULWnd::SetText(ULOther::CULStr* pstrText) { SetWindowText(*pstrText); } void CULWnd::GetText(ULOther::CULStr* pstrText) { GetWindowText(*pstrText,pstrText->GetSize()); } */ void CULWnd::SetStyle(DWORD* pdwStyle) { ModifyStyle(0xffffffff,*pdwStyle); }
void CIconButton::PreSubclassWindow() { ModifyStyle(0, BS_OWNERDRAW, SWP_FRAMECHANGED); CButton::PreSubclassWindow(); }
void CWeekTimePicker::PreSubclassWindow() { ModifyStyle(0, SS_NOTIFY); }