// 停止 void CTabSample::OnStop(void) { CStatic* icon; icon =(CStatic*)this->GetDlgItem(IDC_STATIC_INSTRUMENT1); icon->SetIcon(m_iconDisconnected); icon =(CStatic*)this->GetDlgItem(IDC_STATIC_INSTRUMENT2); icon->SetIcon(m_iconDisconnected); icon =(CStatic*)this->GetDlgItem(IDC_STATIC_INSTRUMENT3); icon->SetIcon(m_iconDisconnected); icon =(CStatic*)this->GetDlgItem(IDC_STATIC_INSTRUMENT4); icon->SetIcon(m_iconDisconnected); GetDlgItem(IDC_EDIT_SENDPORT)->EnableWindow(TRUE); GetDlgItem(IDC_CHECK_HEARTBEAT)->EnableWindow(FALSE); m_oThreadManage.OnStop(); }
/****************************************************************************** Function Name : vResizeControls Description : Input(s) : - Output : - Functionality : Resize the control when dialog is resized. Member of : CMessageInterpretation Author(s) : Ratnadip Choudhury Date Created : 16.02.2004 Modifications : Raja N on 05/04/2004 : Modified width calculation as one more column is included in the list. ******************************************************************************/ void CMessageInterpretation::vResizeControls(void) { RECT WndClientRect, CtrlRect; CStatic* pomStatic = NULL; GetClientRect(&WndClientRect); /* Resize "Message" static control */ if ((pomStatic = (CStatic*) GetDlgItem(IDC_CAPTION)) != NULL) { pomStatic->GetWindowRect(&CtrlRect); ScreenToClient(&CtrlRect); pomStatic->MoveWindow(CtrlRect.left, CtrlRect.top, WndClientRect.right - WndClientRect.left, CtrlRect.bottom - CtrlRect.top); } /* Resize "Signal" static control */ if ((pomStatic = (CStatic*) GetDlgItem(IDC_CAPTION2)) != NULL) { pomStatic->GetWindowRect(&CtrlRect); ScreenToClient(&CtrlRect); pomStatic->MoveWindow(CtrlRect.left, CtrlRect.top, WndClientRect.right - WndClientRect.left, CtrlRect.bottom - CtrlRect.top); } /* Resize list control describing signal values */ if (IsWindow(m_ctrlSignal.m_hWnd)) { m_ctrlSignal.GetWindowRect(&CtrlRect); ScreenToClient(&CtrlRect); m_ctrlSignal.MoveWindow(5, CtrlRect.top, WndClientRect.right - WndClientRect.left - 10, WndClientRect.bottom - CtrlRect.top - 5); m_ctrlSignal.GetWindowRect(&CtrlRect); // Get the column width int nWidth = (CtrlRect.right - CtrlRect.left - 20) / 3; m_ctrlSignal.SetColumnWidth(0, nWidth); m_ctrlSignal.SetColumnWidth(1, nWidth); m_ctrlSignal.SetColumnWidth(2, nWidth); } }
void CMainFrame::UpdateCursorInfoStatus() { CStatic* pDrawingArea = (CStatic*)m_pView->GetDlgItem(IDC_IMAGEAREA); if (pDrawingArea == NULL) { return; } CString status; int x,y=0; m_pView->GetPixelPositionFromImage(&x,&y); CPoint dcPoint; CDC* pDC = pDrawingArea->GetDC(); // Fix for Bug 20448 if(pDC == NULL) { return; } HDC hdc = pDC->GetSafeHdc(); if(hdc == NULL) { return; } GetCursorPos(&dcPoint); pDrawingArea->ScreenToClient(&dcPoint); COLORREF cr = pDC->GetPixel( dcPoint ); m_pView->ReleaseDC( pDC ); if( this == GetActiveWindow() && x != -1 && y != -1 ) { status.Format( "Cursor: (%d,%d) | RGB: (%u,%u,%u)", x, y, cr & 0xFF, (cr & 0xFF00) >> 8, (cr & 0xFF0000) >> 16 ); }
// add bitmap at the specified column void CCustomListRowWnd::AddBitmap(INT32 col, HBITMAP hBitmap,HBITMAP, DWORD dwBackColour) { CStatic* pStat = new CStatic(); ASSERT(m_ColumnObjects[col] == NULL); m_ColumnObjects[col] = pStat ; CRect cr; GetClientRect(&cr); BITMAP bitmap; CBitmap::FromHandle(hBitmap)->GetBitmap(&bitmap); CRect srect; srect.left = m_Parent->m_Parent->m_ColumnOffsetsArray[col] ; srect.right = srect.left + bitmap.bmWidth; srect.top = cr.Height()/2 - bitmap.bmHeight/2; srect.bottom = cr.Height()/2 + bitmap.bmHeight/2; //// HDC hBitmapDC = CreateCompatibleDC(NULL); if (!hBitmapDC) { ERROR2RAW("Non-fatal GDI error"); } SelectObject(hBitmapDC, hBitmap); // Iff we haven't been told what the background colour is... // We make the assumption that the pixel in the lower right corner has the background colour if (dwBackColour == 0xFFFFFFFF) dwBackColour = (DWORD) GetPixel(hBitmapDC, bitmap.bmWidth - 1, bitmap.bmHeight -1); DWORD sysBkColour = GetSysColor(COLOR_3DFACE); for (INT32 i = 0; i < bitmap.bmWidth; i++) { for (INT32 j = 0; j < bitmap.bmHeight; j++) { if ((DWORD) GetPixel(hBitmapDC, i, j) == dwBackColour) SetPixelV(hBitmapDC, i, j, (COLORREF) sysBkColour); } } DeleteDC(hBitmapDC); //// pStat->Create(NULL, WS_VISIBLE | SS_BITMAP, srect, this); pStat->SetBitmap(hBitmap); }
BOOL CPPgWiz1Welcome::OnInitDialog() { CFont fontVerdanaBold; CreatePointFont(fontVerdanaBold, 12*10, _T("Verdana Bold")); LOGFONT lf; fontVerdanaBold.GetLogFont(&lf); lf.lfWeight = FW_BOLD; m_FontTitle.CreateFontIndirect(&lf); CStatic* pStatic = (CStatic*)GetDlgItem(IDC_WIZ1_TITLE); pStatic->SetFont(&m_FontTitle); CDlgPageWizard::OnInitDialog(); InitWindowStyles(this); GetDlgItem(IDC_WIZ1_TITLE)->SetWindowText(GetResString(IDS_WIZ1_WELCOME_TITLE)); GetDlgItem(IDC_WIZ1_ACTIONS)->SetWindowText(GetResString(IDS_WIZ1_WELCOME_ACTIONS)); GetDlgItem(IDC_WIZ1_BTN_HINT)->SetWindowText(GetResString(IDS_WIZ1_WELCOME_BTN_HINT)); return TRUE; }
BOOL FW_HtmlCtrl::CreateFromStatic(UINT nID, CWnd* pParent) { CStatic wndStatic; if (!wndStatic.SubclassDlgItem(nID, pParent)) return FALSE; CRect rc; wndStatic.GetWindowRect(&rc); pParent->ScreenToClient(&rc); wndStatic.ShowWindow(SW_HIDE); return Create(NULL, NULL, (WS_CHILD | WS_VISIBLE ), rc, pParent, nID, NULL); }
// CefJamCEFHtmlView message handlers BOOL CefJamCEFHtmlView::CreateFromResource(UINT nID, CWnd* pParent,LPCTSTR csControlClass) { CRect rc; CString csCompareClass=csControlClass; if (csCompareClass.CompareNoCase(HTMLVIEW_CONTROL_CLASS_CSTATIC)==0) { CStatic wndStatic; if (!wndStatic.SubclassDlgItem(nID, pParent)) return FALSE; // Get static control rect, convert to parent's client coords. wndStatic.GetWindowRect(&rc); pParent->ScreenToClient(&rc); wndStatic.DestroyWindow(); } else if (csCompareClass.CompareNoCase(HTMLVIEW_CONTROL_CLASS_CEDIT)==0) { CEdit wndEdit; if (!wndEdit.SubclassDlgItem(nID, pParent)) return FALSE; // Get static control rect, convert to parent's client coords. wndEdit.GetWindowRect(&rc); pParent->ScreenToClient(&rc); wndEdit.DestroyWindow(); } else { return FALSE; } // create HTML control (CHtmlView) return Create(NULL, // class name NULL, // title (WS_CHILD | WS_VISIBLE|WS_CLIPCHILDREN ), // style rc, // rectangle pParent, // parent nID, // control ID NULL); // frame/doc context not used }
// 現在の「設定」を取得 void CSettingHatenaHaiku::LoadSetting() { if ( !m_initialized ) { if ( m_chirrup ) { TIMELINE_INFO sFriendsTimeline; TIMELINE_INFO sPublicTimeline; TIMELINE_INFO sUserTimeline; m_chirrup->GetHatenaHaiku( m_username, m_password, m_checkMultiPost, sFriendsTimeline, sPublicTimeline, sUserTimeline ); getTimelineInfo( sFriendsTimeline, m_logFile_friendsTimeline, m_checkFriendsTimeline, m_checkLogFileFriendsTimeline ); getTimelineInfo( sPublicTimeline, m_logFile_publicTimeline, m_checkPublicTimeline, m_checkLogFilePublicTimeline ); getTimelineInfo( sUserTimeline, m_logFile_userTimeline, m_checkUserTimeline, m_checkLogFileUserTimeline ); } LOGFONT tLogFont; CFont *cWndFont; cWndFont = GetFont(); cWndFont->GetLogFont( &tLogFont ); tLogFont.lfUnderline = 1; m_cFont.CreateFontIndirect( &tLogFont ); CStatic *s = (CStatic *)GetDlgItem( IDC_URL_HATENAHAIKU_SETTING ); s->SetFont( &m_cFont, TRUE ); } }
void CZhfPalette::ResizeCtrl(int iX, int iY) { //int iCtrlNum = m_pArrayPreviewCtrl.GetCount() ; int iCol = iX/(m_iCtrlWidth+m_iMarginX) ; //int iRow = iCtrlNum/iCol + (iCtrlNum%iCol==0?0:1); for (int i=0; i<m_pArrayPreviewCtrl.GetCount(); i++) { int iColCur = i%iCol ; int iRowCur = (i+1)/iCol+((i+1)%iCol==0?0:1); int iXTmp = iColCur*(m_iCtrlWidth+m_iMarginX)+m_iMarginX ; int iYTmp = (iRowCur-1)*(m_iCtrlHeight+m_iMarginY) ; CGsPreviewCtrl* pCtrl = m_pArrayPreviewCtrl.GetAt(i) ; pCtrl->MoveWindow(iXTmp, iYTmp, m_iCtrlWidth, m_iCtrlHeight) ; pCtrl->Invalidate(TRUE) ; CStatic* pCtrlStatic = m_pArrayStatic.GetAt(i) ; pCtrlStatic->MoveWindow(iXTmp, iYTmp+m_iCtrlHeight, m_iCtrlWidth, m_iMarginY) ; pCtrlStatic->Invalidate(TRUE) ; } }
void CMyPage2::CurrentFillColor() { UINT nRed, nGreen, nBlue; nRed = GetDlgItemInt(IDC_RED); nGreen = GetDlgItemInt(IDC_GREEN); nBlue = GetDlgItemInt(IDC_BLUE); COLORREF color = RGB(nRed, nGreen, nBlue); // 현재 색상 CRect rc; CStatic* pFrame = (CStatic*)GetDlgItem(IDC_COLOR_SHOW); pFrame->GetClientRect(rc); CClientDC dc(pFrame); CBrush br(color); CBrush* pOld = dc.SelectObject(&br); dc.FillRect(rc, &br); // 현재 색상으로 사각형을 채운다. dc.SelectObject(pOld); }
void CDialog_subSTL::OnBnClickedButton3()// move STL { init_loc(); // set initial value for MFC slicer and edit vtkSmartPointer<vtkSTLReader> pickedDoneSTL=vtkSmartPointer<vtkSTLReader>::New(); pickedDoneSTL->SetFileName("test_picked.stl"); pickedDoneSTL->Update(); //vtkSmartPointer<vtkTransformPolyDataFilter> Femur_transformFilter = vtkSmartPointer<vtkTransformPolyDataFilter>::New(); Femur_transformFilter->SetInputConnection(pickedDoneSTL->GetOutputPort()); //vtkSmartPointer<vtkTransform> Femur_translation = vtkSmartPointer<vtkTransform>::New(); Femur_translation->Translate(0,0,0); Femur_transformFilter->SetTransform(Femur_translation); Femur_transformFilter->Update(); vtkSmartPointer<vtkPolyDataMapper> mapper =vtkSmartPointer<vtkPolyDataMapper>::New(); mapper->SetInputConnection(Femur_transformFilter->GetOutputPort()); vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New(); actor->SetMapper(mapper); vtkSmartPointer<vtkAxesActor> axes = vtkSmartPointer<vtkAxesActor>::New(); axes->SetTotalLength(100,100,100); vtkSmartPointer<vtkTransform> transform_axes = vtkSmartPointer<vtkTransform>::New(); axes->SetUserTransform(transform_axes); vtkSmartPointer<vtkRenderer> renderer =vtkSmartPointer<vtkRenderer>::New(); //vtkSmartPointer<vtkRenderWindow> Femur_renderWindow =vtkSmartPointer<vtkRenderWindow>::New(); Femur_renderWindow->AddRenderer(renderer); CStatic *pclStatic = new CStatic(); LPRECT rect = new CRect; pclStatic = (CStatic*)GetDlgItem(IDC_STATIC_V); Femur_renderWindow->SetParentId(pclStatic->m_hWnd);// pclStatic->GetWindowRect(rect); Femur_renderWindow->SetSize(rect->right-rect->left, rect->bottom-rect->top); Femur_renderWindow->SetPosition(0,0); //vtkSmartPointer<vtkRenderWindowInteractor> Femur_renderWindowInteractor =vtkSmartPointer<vtkRenderWindowInteractor>::New(); Femur_renderWindowInteractor->SetRenderWindow(Femur_renderWindow); renderer->AddActor(actor); renderer->AddActor(axes); Femur_renderWindow->Render(); Femur_renderWindowInteractor->Start(); }
void CModifyDlg::CreateCtrl() { CRect rcClient; GetClientRect(&rcClient); int top = rcClient.top + TOPINCREMENT; int Left = rcClient.left + LEFTINCREMENT; CRect CTRRECT; if (PUBLIC == m_tableType || INCODE == m_tableType){ for (int i = 0;i < m_vHead.size();i++){ CStatic *Static = new CStatic; CTRRECT = SetCtrlPos(Left,top,88,CTRLHEIGHT); Static->Create(m_vHead[i],WS_CHILD|WS_VISIBLE,CTRRECT,this); Static->SetFont(GetFont()); Left += 88 + HINCREMENT; CEdit *Edit = new CEdit; CTRRECT = SetCtrlPos(Left,top - 3,380,EDITHEIGHT); Edit->Create(WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BORDER|ES_MULTILINE|ES_AUTOVSCROLL,CTRRECT,this,IDC_MODIFY_EDIT); Edit->SetFont(GetFont()); Edit->SetWindowText(m_vData[i]); top += VINCREMENT + CTRLHEIGHT ; Left = rcClient.left + LEFTINCREMENT; if (i == 0){ Static->EnableWindow(FALSE); Edit->EnableWindow(FALSE); } if (i == m_vHead.size()-1 && INCODE == m_tableType) { CStatic *Static1 = new CStatic; CTRRECT = SetCtrlPos(Left,top,450,CTRLHEIGHT); Static1->Create("调度规则 1:最大空闲时间调度 2:最短会话时间调度 3:最高优先级调度",WS_CHILD|WS_VISIBLE,CTRRECT,this); Static1->SetFont(GetFont()); m_StaticObject.push_back(Static1); } m_StaticObject.push_back(Static); m_EidtObject.push_back(Edit); } } if (TP == m_tableType) SetTPRuleCtrl(); }
BOOL CuDlgIpmDetailLocation::OnInitDialog() { CDialog::OnInitDialog(); CStatic* s = (CStatic*)GetDlgItem (IDC_MFC_STATIC1); CRect r; VERIFY (m_cListLegend.SubclassDlgItem (IDC_MFC_LIST1, this)); s->GetWindowRect (r); ScreenToClient (r); m_pDlgFrame = new CuStatisticBarFrame(CuStatisticBarFrame::nTypePie); m_pDlgFrame->Create ( NULL, NULL, WS_CHILD, r, this); m_pDlgFrame->ShowWindow (SW_SHOW); m_pDlgFrame->InitialUpdateFrame (NULL, TRUE); m_pDlgFrame->DrawLegend (&m_cListLegend, TRUE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
////////////////// // Create control in same position as an existing static control with // the same ID (could be any kind of control, really) // BOOL CHtmlCtrl::CreateFromStatic(UINT nID, CWnd* pParent) { CStatic wndStatic; if (!wndStatic.SubclassDlgItem(nID, pParent)) return FALSE; // Get static control rect, convert to parent's client coords. CRect rc; wndStatic.GetWindowRect(&rc); pParent->ScreenToClient(&rc); wndStatic.DestroyWindow(); // create HTML control (CHtmlView) return Create(NULL, // class name NULL, // title (WS_CHILD | WS_VISIBLE ), // style rc, // rectangle pParent, // parent nID, // control ID NULL); // frame/doc context not used }
// add text to the specified column of this row void CCustomListRowWnd::AddText(INT32 col, CString text) { ASSERT(m_ColumnObjects[col] == NULL); CStatic* pStat = new CStatic(); m_ColumnObjects[col] = pStat ; CRect cr; GetClientRect(&cr); CRect srect; srect.left= m_Parent->m_Parent->m_ColumnOffsetsArray[col] ; if( col < CCustomList::MAXCOLUMNS && m_Parent->m_Parent->m_ColumnOffsetsArray[col + 1] > 0) srect.right= m_Parent->m_Parent->m_ColumnOffsetsArray[col + 1] ; else srect.right= cr.right; srect.top = (CCustomList::ROWHEIGHT - CCustomList::FONTHEIGHT)/2; srect.bottom = srect.top + CCustomList::FONTHEIGHT; pStat->Create(text, WS_CHILD|WS_VISIBLE|WS_EX_LEFT, srect, this); pStat->SetFont(&m_Parent->m_Font); }
// CCreateSeamlessMapDlg 消息处理程序 void CCreateSeamlessMapDlg::OnStnClickedStaticDefaultPng() { // TODO: 在此添加控件通知处理程序代码 CSelectSurfaceTextureDlg dlg; dlg.m_strInitSelectedFileName = m_strMaterial; if( dlg.DoModal() == IDOK ) { m_strMaterial = dlg.getCurrentSelectedTexFile(); CStatic* pStatic = (CStatic*)GetDlgItem( IDC_STATIC_DEFAULT_PNG ); if( pStatic != NULL ) { CString strTemp; strTemp.Format( "images/%s", m_strMaterial ); CImage image; image.Load( strTemp ); pStatic->SetBitmap( image.Detach() ); } } }
LRESULT CErrorReportDlg::OnEraseBkgnd(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& /*bHandled*/) { CDCHandle dc((HDC)wParam); RECT rcClient; GetClientRect(&rcClient); RECT rc; CStatic statUpperHorzLine = GetDlgItem(IDC_UPPERHORZ); statUpperHorzLine.GetWindowRect(&rc); ScreenToClient(&rc); COLORREF cr = GetSysColor(COLOR_3DFACE); CBrush brush; brush.CreateSolidBrush(cr); RECT rcHeading = {0, 0, rcClient.right, rc.bottom}; dc.FillRect(&rcHeading, (HBRUSH)GetStockObject(WHITE_BRUSH)); RECT rcBody = {0, rc.bottom, rcClient.right, rcClient.bottom}; dc.FillRect(&rcBody, brush); rcHeading.left = 60; rcHeading.right -= 10; CString sHeading; sHeading.Format(Utility::GetINIString(g_CrashInfo.m_sLangFileName, _T("MainDlg"), _T("HeaderText")), g_CrashInfo.m_sAppName); dc.SelectFont(m_HeadingFont); dc.DrawTextEx(sHeading.GetBuffer(0), sHeading.GetLength(), &rcHeading, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS); if(m_HeadingIcon) { ICONINFO ii; m_HeadingIcon.GetIconInfo(&ii); dc.DrawIcon(16, rcHeading.bottom/2 - ii.yHotspot, m_HeadingIcon); } return TRUE; }
LRESULT CNBSelectDeviceDlg::OnInitDialog(HWND /*hwndCtl*/, LPARAM /*lParam*/) { CenterWindow(); CString strText; strText.LoadString(m_nCaptionID); SetWindowText(strText); CStatic ctlMessage; ctlMessage.Attach(GetDlgItem(IDC_STATIC_MESSAGE)); strText.LoadString(m_nMessageID); ctlMessage.SetWindowText(strText); m_wndListSingle.SubclassWindow( GetDlgItem(IDC_LIST_DEVICE) ); if(0 == m_nSelectCount) { m_wndListSingle.ModifyStyle(NULL, WS_DISABLED); } else if(1 == m_nSelectCount) { m_wndListSingle.ModifyStyle(NULL, LVS_SINGLESEL); } else { m_wndListSingle.ModifyStyle(LVS_SINGLESEL, NULL); } DWORD dwExtStyle = LVS_EX_FULLROWSELECT; //| LVS_EX_GRIDLINES //| LVS_EX_INFOTIP m_wndListSingle.SetExtendedListViewStyle( dwExtStyle ); m_wndListSingle.InitColumn(); m_wndListSingle.AddDiskObjectList(m_listDevices); OnListSelChanged(NULL); DoDataExchange(FALSE); return TRUE; }
void DialogObjProp::OP_COMPCB() { CComboBox* complb = (CComboBox*)GetDlgItem(IDC_CBCOMPONENT); CListBox* objList = (CListBox*)parentWnd->GetObjList()->GetDlgItem(IDC_OBJLIST); int curSel = complb->GetCurSel() ; Gameobject* obj = parentWnd->theApp->GetProject()->GetScene()->GetSceneObject(objList->GetCurSel()); Component* compSel = obj->GetComponent(curSel); if (strcmp(compSel->GetIdentifier(),CTYPE_MESHRENDERER)) { ClearTempIDS(); RECT tr; tr.top = 275; tr.left = 40; tr.bottom = tr.top + 20; tr.right = tr.left + 120; CStatic* text = new CStatic(); text->Create("Linked Mesh: ",WS_VISIBLE,tr,this,TEMPID_0); text->ShowWindow(SW_SHOW); tr.top = 300; tr.bottom = tr.top + 30; CComboBoxEx* cb = new CComboBoxEx(); cb->Create(WS_VISIBLE,tr,this,TEMPID_1); cb->ShowWindow(SW_SHOW); for (int i = 0, ListItem = 1; i < obj->GetNumberOfComponent(); i++) { if (strcmp(obj->GetComponent(i)->GetIdentifier(), CTYPE_MESH) ) { char name[512]; obj->GetComponent(i)->GetName(name, 512);/* cb->AddString(name); cb->SetItemData(ListItem, i);*/ ListItem++; } } } }
BOOL CHotelDialog::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) { if ( nHitTest == HTCLIENT ) { // アフィリエイトリンク(MyLink) の URL部分にマウスポインタが // 来たら、指カーソルを表示する DWORD dwPos = GetMessagePos(); WORD wX = LOWORD( dwPos ); WORD wY = HIWORD( dwPos ); CPoint poCursor( wX, wY ); CRect rcClient; CStatic *s = (CStatic *)GetDlgItem( IDC_AFFILIATE_URL ); s->GetWindowRect( &rcClient ); if ( (wX >= rcClient.left) && (wX <= rcClient.right) && (wY >= rcClient.top) && (wY <= rcClient.bottom) ) { SetCursor( m_hCursor ); return TRUE; } } return CDialog::OnSetCursor(pWnd, nHitTest, message); }
HRESULT CPropertyEditWindow::CreateTitle(DWORD dwPropertyInfoIndex, RECT& labelRect) { HRESULT hr = S_OK; LPWSTR szName = NULL; TED_ATTRIBUTE_CATEGORY Category; IFC( m_arrPropertyInfo[dwPropertyInfoIndex]->GetPropertyInfoName(&szName, &Category) ); CStatic* pStatic = new CStatic(); CHECK_ALLOC( pStatic ); pStatic->Create(m_hWnd, &labelRect, szName, WS_CHILD | WS_VISIBLE); pStatic->SetFont(m_hLabelFont); m_arrTitles.Add(pStatic); labelRect.top += ms_LabelHeight; labelRect.bottom += ms_LabelHeight; Cleanup: CoTaskMemFree(szName); return hr; }
/** * @brief Read version info from resource to dialog. */ BOOL CAboutDlg::OnInitDialog() { theApp.TranslateDialog(m_hWnd); CDialog::OnInitDialog(); // Load application icon HICON icon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); if (icon != NULL) { CStatic * pIcon = (CStatic *) GetDlgItem(IDC_ABOUTBOX_ICON); pIcon->SetIcon(icon); } CVersionInfo version(AfxGetResourceHandle()); CString sVersion = version.GetFixedProductVersion(); LangFormatString1(m_strVersion, IDS_VERSION_FMT, sVersion); m_strVersion += _T(" "); m_strVersion += theApp.LoadString(IDS_UNICODE).c_str(); #ifdef WIN64 m_strVersion += _T(" "); m_strVersion += theApp.LoadString(IDS_WINX64).c_str(); #endif CString sPrivateBuild = version.GetPrivateBuild(); if (!sPrivateBuild.IsEmpty()) { LangFormatString1(m_strPrivateBuild, IDS_PRIVATEBUILD_FMT, sPrivateBuild); } CString copyright = version.GetLegalCopyright(); m_ctlCompany.SetWindowText(copyright); m_ctlWWW.m_link = WinMergeURL; UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
BOOL CSettingHatenaHaiku::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) { if ( nHitTest == HTCLIENT ) { // Web の URLかメールアドレスにマウスポインタが来たら、 // 指カーソルを表示する DWORD dwPos = GetMessagePos(); WORD wX = LOWORD( dwPos ); WORD wY = HIWORD( dwPos ); CPoint poCursor( wX, wY ); CRect rcClient; CStatic *s = (CStatic *)GetDlgItem( IDC_URL_HATENAHAIKU_SETTING ); s->GetWindowRect( &rcClient ); if ( (wX >= rcClient.left) && (wX <= rcClient.right) && (wY >= rcClient.top) && (wY <= rcClient.bottom) ) { SetCursor( m_hCursor ); return TRUE; } } return CTabDialog::OnSetCursor(pWnd, nHitTest, message); }
BOOL CCreateSeamlessMapDlg::OnInitDialog() { CDialogEx::OnInitDialog(); // TODO: 在此添加额外的初始化 GetPrivateProfileString( _T("init"), "surfaceTex1", _T(""), m_strMaterial.GetBuffer( MAX_PATH ), MAX_PATH, _T("./Editor/MapBlock.ini") ); CStatic* pStatic = (CStatic*)GetDlgItem( IDC_STATIC_DEFAULT_PNG ); if( pStatic != NULL ) { CString strTemp; strTemp.Format( "images/%s", m_strMaterial ); CImage image; image.Load( strTemp ); pStatic->SetBitmap( image.Detach() ); } return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE }
void CFilesHashDlg::DoMD5() { if(m_hWorkThread) { CloseHandle(m_hWorkThread); } m_bFind = FALSE; m_btnClr.SetWindowText(MAINDLG_CLEAR); PrepareAdvTaskbar(); m_prog.SetPos(0); //m_progWhole.SetPos(0); SetWholeProgPos(0); m_thrdData.uppercase = (m_chkUppercase.GetCheck() != FALSE); m_calculateTime = 0.0; m_timer = SetTimer(1, 100, NULL); CStatic* pWnd = (CStatic*)GetDlgItem(IDC_STATIC_TIME); CString cstrZero(_T("0 ")); cstrZero.Append(SECOND_STRING); pWnd->SetWindowText(cstrZero); pWnd = (CStatic*)GetDlgItem(IDC_STATIC_SPEED); pWnd->SetWindowText(_T("")); DWORD thredID; m_thrdData.stop = FALSE; m_hWorkThread = (HANDLE)_beginthreadex(NULL, 0, (unsigned int (WINAPI *)(void *))md5_file, &m_thrdData, 0, (unsigned int *)&thredID); }
void CDialog_subSTL::OnBnClickedButton1() //load STL { CString strFile = _T(""); CFileDialog dlgFile(TRUE, NULL, NULL, OFN_HIDEREADONLY, _T("Describe Files (*.stl)|*.stl|All Files (*.*)|*.*||"), NULL); //dlgFile.m_ofn.lpstrInitialDir=_T("D:W\code_LPX"); if (dlgFile.DoModal()) { strFile = dlgFile.GetPathName(); } //std::string stdstrFile(CT2CA(strFile));//std::string s((LPCTSTR)strFile); //std::string ss((CStringA(strFile))); //const char* cstr = (LPCTSTR)strFile; CStringA strFileA(strFile); //vtkSmartPointer<vtkSTLReader> STLReader= vtkSmartPointer<vtkSTLReader>::New(); p = strFileA.GetString(); STLReader->SetFileName(p); vtkSmartPointer<vtkPolyDataMapper> map=vtkSmartPointer<vtkPolyDataMapper>::New(); map->SetInput(STLReader->GetOutput());//decimated); vtkSmartPointer<vtkActor> act=vtkSmartPointer<vtkActor>::New(); act->SetMapper(map); vtkSmartPointer<vtkRenderer> ren_STL=vtkSmartPointer<vtkRenderer>::New(); vtkSmartPointer<vtkRenderWindow> renwin_STL=vtkSmartPointer<vtkRenderWindow>::New(); ren_STL->AddActor(act); renwin_STL->AddRenderer(ren_STL); CStatic *pclStatic = new CStatic(); //show VTK window on MFC LPRECT rect = new CRect; pclStatic = (CStatic*)GetDlgItem(IDC_STATIC_V); renwin_STL->SetParentId(pclStatic->m_hWnd);// pclStatic->GetWindowRect(rect); renwin_STL->SetSize(rect->right-rect->left, rect->bottom-rect->top); renwin_STL->SetPosition(0,0); //vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor_STL =vtkSmartPointer<vtkRenderWindowInteractor>::New(); renderWindowInteractor_STL->SetRenderWindow(renwin_STL); renwin_STL->Render(); renderWindowInteractor_STL->Start(); }
BOOL CPhotoProjectsTypeDlg::OnInitDialog() { CPmwDialogColor::OnInitDialog(); /* // Read the list. */ m_List.ReadList("PHOTOPRJ.DAT"); // Build the list box. BuildList(); CreateWizzardButtons (); EnableWizardButtons (m_WizFlags); CStatic* pDescription; if ((pDescription = (CStatic*)GetDlgItem(IDC_PREVIEW_DESCRIPTION)) != NULL) pDescription->SetWindowText(""); return TRUE; // return TRUE unless you set the focus to a control }
void CDLUpdateDlg::UpdateState(void) { CString str; int iIDS = -1; CStatic *pStatic; assert(m_pStation); CStationInfo & rInfo = m_pStation->GetStationInfo(); int iIDSArray[] = {-1,IDS_NOT_CONNECTED,IDS_DIFF_CLEARED,IDS_DIFF_PRJ,IDS_DIFF_UNSYNC,IDS_DIFF_SYNC}; int state = rInfo.State(); iIDS = iIDSArray[state]; if(iIDS != -1) { str.LoadString(iIDS); } pStatic = (CStatic*) GetDlgItem(IDC_UPDATE_STATE); assert(pStatic); pStatic->SetWindowText(str); }
void CFilesHashDlg::OnTimer(UINT_PTR nIDEvent) { if(nIDEvent == 1) { // 计算花费时间 m_calculateTime += 0.1f; CStatic* pWnd = (CStatic*)GetDlgItem(IDC_STATIC_TIME); CString cstrTime; int i_calculateTime = (int)m_calculateTime; CString cstrFormat("%d "); cstrFormat.Append(SECOND_STRING); cstrTime.Format(cstrFormat, i_calculateTime); pWnd->SetWindowText(cstrTime); } else if(nIDEvent == 4) { // 通过命令行启动的 DoMD5(); KillTimer(4); } CDialog::OnTimer(nIDEvent); }
//=========================================================================== void CFAVRMCDlg::OnBnClickedRmcDemoPair() //=========================================================================== { // TODO: Add your control notification handler code here UpdateData(TRUE); EnableGroupboxControls(::GetDlgItem(m_hWnd, IDC_RMC_MAPGROUP), FALSE); CStatic* pStatic = (CStatic*)GetDlgItem(IDC_RMC_MSG); pStatic->SetWindowText(_T("Please waiting...")); uRMCCnt = m_RMCListBox.AddLine((CFAVListBox::COLOR)m_nText, (CFAVListBox::COLOR)m_nBackground, _T(">>> M0,73,0,37")); char chCMD[] = COMMAND_SN; if(m_SerialComm.WriteCMD(CMD_RMC, chCMD, sizeof(chCMD), WRITE_DEFAULT_TIMEOUT)) { TRACE(_T(">>> Write Fail in SN Pairing Button.\n")); EnableGroupboxControls(::GetDlgItem(m_hWnd, IDC_RMC_MAPGROUP), TRUE); return; } m_nRecText = CFAVListBox::Red; SetTimer(SNPAIRING, 90, NULL); }