BOOL CResizableGrip::CreateSizeGrip(BOOL bVisible /*= TRUE*/, BOOL bTriangular /*= TRUE*/, BOOL bTransparent /*= FALSE*/) { // create grip CRect rect(0 , 0, m_wndGrip.m_size.cx, m_wndGrip.m_size.cy); BOOL bRet = m_wndGrip.Create(WS_CHILD | WS_CLIPSIBLINGS | SBS_SIZEGRIP, rect, GetResizableWnd(), 0); if (bRet) { // set options m_wndGrip.SetTriangularShape(bTriangular); m_wndGrip.SetTransparency(bTransparent); SetSizeGripVisibility(bVisible); // update position UpdateSizeGrip(); } return bRet; }
// CDlgDebuger message handlers BOOL CDlgDebuger::OnInitDialog() { CResizableDialog::OnInitDialog(); // TODO: 在此添加额外的初始化代码 AddAnchor(IDC_TAB_MAIN, TOP_LEFT, BOTTOM_RIGHT); //屏蔽关闭按钮 GetSystemMenu(FALSE)->EnableMenuItem(SC_CLOSE, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED); // get desktop size CRect rc; SystemParametersInfo(SPI_GETWORKAREA, NULL, &rc, NULL); rc.right = 256; SetMaximizedRect(rc); CRect rect; GetClientRect(&rect); MoveWindow(10, 150, rect.Width(), rect.Height(), TRUE); SetSizeGripVisibility(FALSE); UpdateSizeGrip(); //创建字窗口 CreateSubWindow(); //Hook CCaptionButton::InitCapBtn(g_pGfxSystem->GetWindow()); m_pCaptionBtn->SetBmpID(1, IDB_BITMAP_LAMPON, IDB_BITMAP_LAMPOFF, TRUE); m_pCaptionBtn->ChangeButtonState(); ::SetActiveWindow(g_pGfxSystem->GetWindow()); m_pCaptionBtn->ChangeButtonState(); return TRUE; // 除非设置了控件的焦点,否则返回 TRUE }
CDebugShadersDlg::CDebugShadersDlg() : CModelessDialog(IDD) , m_timerOneTime(this, TIMER_ONETIME_START, TIMER_ONETIME_END - TIMER_ONETIME_START + 1) , m_Compiler(nullptr) { EventRouter::EventSelection receives; receives.insert(MpcEvent::SHADER_LIST_CHANGED); GetEventd().Connect(m_eventc, receives, std::bind(&CDebugShadersDlg::EventCallback, this, std::placeholders::_1)); // Set window icon VERIFY(SetIcon(AfxGetMainWnd()->GetIcon(true), true) == nullptr); // Setup window auto-resize and restore last position SetSizeGripVisibility(FALSE); SetMinTrackSize(CSize(360, 100)); AddAnchor(IDC_COMBO1, TOP_LEFT, TOP_RIGHT); AddAnchor((UINT)IDC_STATIC, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_EDIT1, TOP_LEFT, BOTTOM_RIGHT); AddAnchor(IDC_RADIO1, TOP_RIGHT); AddAnchor(IDC_RADIO2, TOP_RIGHT); AddAnchor(IDC_RADIO3, TOP_RIGHT); AddAnchor(IDC_RADIO4, TOP_RIGHT); EnableSaveRestore(IDS_R_DEBUG_SHADERS); CWinApp* pApp = AfxGetApp(); // Restore controls' old state m_iVersion = pApp->GetProfileInt(IDS_R_DEBUG_SHADERS, IDS_RS_DEBUG_SHADERS_LASTVERSION, ps_2_0); VERIFY(UpdateData(FALSE)); CString oldpath = pApp->GetProfileString(IDS_R_DEBUG_SHADERS, IDS_RS_DEBUG_SHADERS_LASTFILE); if (!oldpath.IsEmpty()) { ASSERT(m_Shaders.GetCount() == 0); int sel = m_Shaders.AddString(oldpath); if (sel >= 0) { VERIFY(m_Shaders.SetCurSel(sel) != CB_ERR); } else { ASSERT(FALSE); } } // Put WM_PAINT message before WM_APP_RECOMPILE_SHADER UpdateWindow(); // Load new shader list OnListRefresh(); // We need to trigger shader compilation manually when // old state's selected shader is present in current shader list. // Otherwise it's triggered by OnListRefresh() int sel = m_Shaders.GetCurSel(); if (sel != CB_ERR) { CString path; m_Shaders.GetLBText(sel, path); ASSERT(!path.IsEmpty()); if (oldpath == path) { UpdateNotifierState(); VERIFY(PostMessage(WM_APP_RECOMPILE_SHADER)); } } // Display first-run dialog if (pApp->GetProfileInt(IDS_R_DEBUG_SHADERS, IDS_RS_DEBUG_SHADERS_FIRSTRUN, 1)) { CString msg; if (msg.LoadString(IDS_DEBUGSHADERS_FIRSTRUN_MSG)) { AfxMessageBox(msg, MB_ICONINFORMATION); } else { ASSERT(FALSE); } VERIFY(pApp->WriteProfileInt(IDS_R_DEBUG_SHADERS, IDS_RS_DEBUG_SHADERS_FIRSTRUN, 0)); } }