int MainWnd::DivWhole(const CRect &whole, int num, RECTARR &rectlst) { if(num == 3 || num == 4){ rectlst.clear(); ////ry > rx double rx = 0.33, ry = 0.45; int bwidth = whole.Width()*rx, bheight = whole.Height()*ry; CRect base; base.left = 0; base.top = 0; base.right = bwidth; base.bottom = bheight; CPoint mvto; mvto.x = whole.left; mvto.y = whole.top + ((whole.Height() - bheight)/2); base.MoveToXY(mvto); rectlst.push_back(base); mvto.x = whole.left + ((whole.Width() - bwidth)/2); mvto.y = whole.top; base.MoveToXY(mvto); rectlst.push_back(base); mvto.x = whole.right - bwidth; mvto.y = whole.top + ((whole.Height() - bheight)/2); base.MoveToXY(mvto); rectlst.push_back(base); mvto.x = whole.left + ((whole.Width() - bwidth)/2); mvto.y = whole.bottom - bheight; base.MoveToXY(mvto); rectlst.push_back(base); ////5th rect: go previous rectlst.push_back(_setRect(whole, 0.79, 0.01, 0.99, 0.1)); ////6th rect: go next rectlst.push_back(_setRect(whole, 0.79, 0.11, 0.99, 0.2)); ////7th rect: newgame rectlst.push_back(_setRect(whole, 0.01, 0.01, 0.31, 0.1)); ////8th rect: cha rectlst.push_back(_setRect(whole, 0.01, 0.11, 0.31, 0.2)); } return 0; }
void CEnvelopeWizard::SetImageSize(CAGSymImage* pImage, POINT* pCenterPoint) { if (!pImage) return; // The image symbol should be at (0,0) and have a unity matrix CRect DestRect = pImage->GetDestRect(); DestRect.MoveToXY(0,0); pImage->SetDestRect(DestRect); // Maintain a maximum image size using the symbol's matrix CAGMatrix NewMatrix; if (DestRect.Width() > m_nMaxImageSize || DestRect.Height() > m_nMaxImageSize) { int dx = m_nMaxImageSize; int dy = m_nMaxImageSize; double fScale = ScaleToFit(&dx, &dy, DestRect.Width(), DestRect.Height(), true/*bUseSmallerFactor*/); NewMatrix.Scale(fScale, fScale); NewMatrix.Transform(DestRect); } if (pCenterPoint) NewMatrix.Translate(pCenterPoint->x - DestRect.Width()/2, pCenterPoint->y - DestRect.Height()/2); pImage->SetMatrix(NewMatrix); }
BOOL CBaseRecordsDlg::Create(CWnd* pParentWnd, CPoint ptWnd) { if (!CDialog::Create(IDD, pParentWnd)) return FALSE; CRect rectTemp; INT nFirstColumn; // Move window GetWindowRect(&rectTemp); rectTemp.MoveToXY(ptWnd); MoveWindow(&rectTemp); // Init m_gridRecord m_gridRecord.GetClientRect(rectTemp); nFirstColumn = (rectTemp.Width() - ::GetSystemMetrics(SM_CXVSCROLL)) - (COLUMN_COUNT - 1) * COLUMN_WHIDTH; for (INT i = 0; i < COLUMN_COUNT; i++) { m_gridRecord.InsertColumn(i, m_strColumns[i], LVCFMT_CENTER, i ? COLUMN_WHIDTH : nFirstColumn); } m_gridRecord.SetGridLines(TRUE, RGB(0, 0, 128)); m_gridRecord.SetResizing(FALSE); m_gridRecord.SetSortable(TRUE); m_gridRecord.SetShowSel(TRUE); // Init Filters SetFilters(FALSE); m_nFilterID = NO_FILTER_ID; // Show records ShowRecords(); // Show window ShowWindow(SW_SHOW); return TRUE; }
void CMenuWndHook::OnPrint(HDC dc) { if(m_strSkinName.IsEmpty()) return; ISkinObj *pSkin=GETSKIN(m_strSkinName); if(!pSkin) return; SSkinImgFrame *pBorderSkin=static_cast<SSkinImgFrame*>(pSkin); if(!pBorderSkin) return; CRect rcClient; GetClientRect(m_hWnd,&rcClient); ClientToScreen(m_hWnd,(LPPOINT)&rcClient); ClientToScreen(m_hWnd,((LPPOINT)&rcClient)+1); CRect rcWnd; GetWindowRect(m_hWnd, &rcWnd); rcClient.OffsetRect(-rcWnd.TopLeft()); int nSave = ::SaveDC(dc); ::ExcludeClipRect(dc,rcClient.left,rcClient.top,rcClient.right,rcClient.bottom); rcWnd.MoveToXY(0,0); CAutoRefPtr<IRenderTarget> pRT; GETRENDERFACTORY->CreateRenderTarget(&pRT,rcWnd.Width(),rcWnd.Height()); pBorderSkin->Draw(pRT,rcWnd,0); HDC hmemdc=pRT->GetDC(0); ::BitBlt(dc,0,0,rcWnd.Width(),rcWnd.Height(),hmemdc,0,0,SRCCOPY); pRT->ReleaseDC(hmemdc); ::RestoreDC(dc,nSave); }
bool CSurveyWnd::CreateExamType1(int nQstSeq, int nSubSeq, int nStartX, int nWidth, CString strExample, Example& pstExample) { CRect rect; this->GetClientRect(&rect); CRect rc; CString strCurrentPath; strCurrentPath = CMyUtil::GetCurrentPath(); if (!m_ExampleButton[nQstSeq][nSubSeq].Create(NULL, WS_VISIBLE | WS_CHILD | BS_OWNERDRAW/* | WS_BORDER*/, CRect(0, 0, rect.Width(), 0), this, IDC_LAYOUT_PNG_EXAMPLE_BUTTON_START + (nQstSeq * MAX_EXAMPLE_CNT) + nSubSeq)) { TRACE("\n [&rino-error&] Can't Create.... [m_ExampleButton]"); return false; } m_ExampleButton[nQstSeq][nSubSeq].LoadStdImage(strCurrentPath + IMAGES_FOLDER + L"\\2_btn_exLeft.png", strCurrentPath + IMAGES_FOLDER + L"\\2_btn_exBody.png", strCurrentPath + IMAGES_FOLDER + L"\\2_btn_exRight.png", nWidth, 54, strExample); m_ExampleButton[nQstSeq][nSubSeq].LoadAltImage(strCurrentPath + IMAGES_FOLDER + L"\\2_btn_exLeftOn.png", strCurrentPath + IMAGES_FOLDER + L"\\2_btn_exBodyOn.png", strCurrentPath + IMAGES_FOLDER + L"\\2_btn_exRightOn.png"); rc = m_ExampleButton[nQstSeq][nSubSeq].GetStdImageRect(); rc.right += 1; rc.MoveToXY(nStartX, m_nUsedHeight); m_ExampleButton[nQstSeq][nSubSeq].MoveWindow(rc); m_stExample[nQstSeq] = pstExample; return true; }
void CPeraProcessDesignerView::OnDraw(CDC* pDC) { CPeraProcessDesignerDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here CRect rc; GetWindowRect(&rc); rc.MoveToXY(0,0); CBCGPDrawManager dm (*pDC); dm.DrawRect( rc, g_crBarBorderIn, g_crBarBorderOut ); if ( m_pViewData != NULL ) { if ( m_pViewData->m_strFlag.CollateNoCase( viewflagModel ) == 0 ) { //有时候结构树标题栏下边有条边线不绘制问题 if ( theApp.m_pBarJianmoTree != NULL && IsWindow( theApp.m_pBarJianmoTree->GetSafeHwnd() ) ) { ::PostMessage( theApp.m_pBarJianmoTree->GetSafeHwnd(), WM_NCPAINT, 0, 0 ); } } } }
void CInfoPanel::Show(const CPoint& position, DirectionMode posMode, bool volatileMode) { ASSERT(text.GetLength() > 0 && title.GetLength() > 0); this->volatileMode = volatileMode; button.SetForceHighlight(false); CRect rect; GetClientRect(rect); if(posMode==DirectionMode::Bottom) rect.MoveToXY(CPoint(position.x, position.y-rect.Height())); else rect.MoveToXY(CPoint(position.x, position.y)); MoveWindow(rect); ShowWindow(SW_SHOW); if(volatileMode) SetCapture(); }
bool CSurveyWnd::CreatePrevNextButton(int nQstSeq) { CString strCurrentPath; strCurrentPath = CMyUtil::GetCurrentPath(); CRect rc; CRect rect; this->GetClientRect(&rect); m_nUsedHeight += 40; // Prev if (!m_PngPrevButton.Create(NULL, WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | BS_OWNERDRAW | SS_NOTIFY, CRect(0,0,0,0), this, IDC_SVY_PREV_BUTTON)) { TRACE("\n [&rino-error&] Can't Create.... [m_PngPrevButton]"); return false; } m_PngPrevButton.LoadStdImage(strCurrentPath + IMAGES_FOLDER + L"\\2_btn_prev.png", strCurrentPath + IMAGES_FOLDER + L"\\2_btn_prevOn.png", NULL, NULL); m_PngPrevButton.SetToolTipText(_T("")); rc = m_PngPrevButton.GetStdImageRect(); rc.MoveToXY(rect.Width()/2-rc.Width()/2-100, m_nUsedHeight); m_PngPrevButton.MoveWindow(rc); // Next if (!m_PngNextButton.Create(NULL, WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | BS_OWNERDRAW | SS_NOTIFY, CRect(0,0,0,0), this, IDC_SVY_NEXT_BUTTON)) { TRACE("\n [&rino-error&] Can't Create.... [m_PngNextButton]"); return false; } m_PngNextButton.LoadStdImage(strCurrentPath + IMAGES_FOLDER + L"\\2_btn_next.png", strCurrentPath + IMAGES_FOLDER + L"\\2_btn_nextOn.png", NULL, NULL); m_PngNextButton.SetToolTipText(_T("")); rc = m_PngNextButton.GetStdImageRect(); rc.MoveToXY(rect.Width()/2-rc.Width()/2+100, m_nUsedHeight); m_PngNextButton.MoveWindow(rc); if (nQstSeq == 0) { // 최초 설문이라면.. 이전 버튼은 안보이고 다음 버튼이 중앙정렬.. m_PngPrevButton.ShowWindow(SW_HIDE); rc = m_PngNextButton.GetStdImageRect(); rc.MoveToXY(rect.Width()/2-rc.Width()/2, m_nUsedHeight); m_PngNextButton.MoveWindow(rc); } return true; }
void CEnvelopeWizard::InitGraphics(CAGDoc* pPrevDoc) { for (int nIndex = 0; nIndex < MAX_NUM_PICTURES; nIndex++) m_pGraphics[nIndex] = NULL; if (!pPrevDoc) return; int nGraphicItem = 0; for (int nIndex = 0; nIndex < MAX_PAGES_TO_CHECK; nIndex++) { CAGPage* pPage = pPrevDoc->GetPage(nIndex); if (!pPage) continue; int nLayers = pPage->GetNumLayers(); for (int l = 0; l < nLayers; l++) { CAGLayer* pLayer = pPage->GetLayer(l); if (!pLayer) continue; int nSymbols = pLayer->GetNumSymbols(); for (int i = 0; i < nSymbols; i++) { CAGSym* pSym = (CAGSym*)pLayer->GetSymbol(i); if (!pSym) continue; if (!pSym->IsImage()) continue; CAGSymImage* pImage = (CAGSymImage*)pSym; if (pImage->IsLocked() || pImage->IsDeleted()) continue; CAGSymImage* pNewImage = (CAGSymImage*)pImage->Duplicate(); if (!pNewImage) return; // Add a copy of the image symbol to the list // Be sure to set its location to (0,0) to make it easier to add to the envelope CRect DestRect = pNewImage->GetDestRectTransformed(); DestRect.MoveToXY(0,0); pNewImage->SetDestRect(DestRect); pNewImage->SetMatrix(CAGMatrix()); pNewImage->SetHidden(false); m_pGraphics[nGraphicItem] = pNewImage; nGraphicItem++; } } } }
void CMyButton::OnNcPaint() { CWindowDC dc(this); CRect rcWindowRect; GetWindowRect(&rcWindowRect); rcWindowRect.MoveToXY(0, 0); CPen cPen; cPen.CreatePen(PS_SOLID, m_nBorderSize, m_clrBorder); SelectObject(dc, cPen); dc.Rectangle(&rcWindowRect); }
// Ensure that rect_saved is on a single monitor or adjust until it is (last resort use default size at top left of nearest monitor) static void EnsureRectVisible(CRect& rect_saved, const CRect& rect_default) { if (IsRectOnSingleMonitor(rect_saved)) return; // Otherwise try saved size at default position CRect rect = rect_saved; rect.MoveToXY(rect_default.TopLeft()); if (IsRectOnSingleMonitor(rect)) { rect_saved = rect; return; } // Otherwise try default size at saved position rect = rect_saved; rect.right = rect.left + rect_default.Width(); rect.bottom = rect.top + rect_default.Height(); if (IsRectOnSingleMonitor(rect)) { rect_saved = rect; return; } // otherwise use default position and size rect_saved = rect_default; if (IsRectOnSingleMonitor(rect_default)) { return; } // As last resort put it near top left of nearest monitor with default size const HMONITOR monitor = MonitorFromRect(&rect_default, MONITOR_DEFAULTTOPRIMARY); MONITORINFO info; info.cbSize = sizeof(info); if (GetMonitorInfo(monitor, &info)) { rect_saved.MoveToXY(info.rcWork.left + 100, info.rcWork.top + 100); } }
BOOL CFlashInfoDlg::Create(CWnd* pParentWnd, CPoint ptWnd) { if (!CDialog::Create(IDD, pParentWnd)) return FALSE; CRect rectTemp; // Move window GetWindowRect(&rectTemp); rectTemp.MoveToXY(ptWnd); MoveWindow(&rectTemp); // Init controls ShowFlashInfo(NULL); // Show window ShowWindow(SW_SHOW); return TRUE; }
BOOL CNewTaskDlg::OnInitDialog() { CDialog::OnInitDialog(); CComboBox* pCombo; CBitmap bmp; CRect rectWnd; CRect rectTemp; m_nSignature = 0; m_bConnected = m_pOwner->IsConnected(); m_ilState.Create(16, 16, ILC_COLORDDB|ILC_MASK, 0, 1); bmp.LoadBitmap(IDB_STATES); int i = m_ilState.Add(&bmp, RGB(255, 0, 255)); bmp.DeleteObject(); rectWnd.SetRectEmpty(); ::ImageList_GetIconSize(m_ilState, (int*)&rectWnd.right, (int*)&rectWnd.bottom); for (BYTE nCS = 0; nCS < MAX_CS; nCS++) { GetDlgItem(IDC_LABLE_CE0 + nCS)->GetWindowRect(rectTemp); ScreenToClient(rectTemp); rectWnd.MoveToXY(rectTemp.right+1, rectTemp.top-1); m_pStateCS[nCS] = new CStatic; m_pStateCS[nCS]->Create(_T(""), WS_CHILD|WS_VISIBLE|SS_ICON, rectWnd, this); } pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_VCC); for (BYTE i = PowerIO_1_8; i < CountPowerIO; i++) { pCombo->SetItemData(pCombo->AddString(CFlashRecord::GetStringPowerIO(i)), i); } SetComboSelection(pCombo, PowerIO_1_8); GetDlgItem(IDC_LABEL_RECORDS)->GetWindowRect(rectWnd); ScreenToClient(rectWnd); m_FlashParametersDlg.Create(this, rectWnd.TopLeft(), FALSE); m_FlashRecordsDlg.Create(this, rectWnd.TopLeft()); GetDlgItem(IDC_COMBO_VCC)->EnableWindow(m_bConnected); GetDlgItem(IDC_BUTTON_CHECK)->EnableWindow(m_bConnected); GetDlgItem(IDC_BUTTON_RESET)->EnableWindow(m_bConnected); GetDlgItem(IDC_LABLE_ID)->EnableWindow(m_bConnected); GetDlgItem(IDC_LABLE_VENDOR)->EnableWindow(m_bConnected); GetDlgItem(IDC_LABLE_ONFI)->EnableWindow(m_bConnected); ((CButton*)GetDlgItem(IDC_SELECT_BASE))->SetCheck(BST_CHECKED); OnSelectChange(IDC_SELECT_BASE); OnClickedBtnReset(); SetButtonOK(); return TRUE; }
BOOL CPageStart::OnInitDialog() { CPropertyPage::OnInitDialog(); CComboBox* pCombo; CBitmap bmp; CRect rectWnd; CRect rectTemp; m_pSheet = (CNewTaskDlg*)GetParent(); m_ilState.Create(16, 16, ILC_COLORDDB|ILC_MASK, 0, 1); bmp.LoadBitmap(IDB_STATES); int i = m_ilState.Add(&bmp, RGB(255, 0, 255)); bmp.DeleteObject(); rectWnd.SetRectEmpty(); ::ImageList_GetIconSize(m_ilState, (int*)&rectWnd.right, (int*)&rectWnd.bottom); for (BYTE nCS = 0; nCS < MAX_CS; nCS++) { GetDlgItem(IDC_LABLE_CE0 + nCS)->GetWindowRect(rectTemp); ScreenToClient(rectTemp); rectWnd.MoveToXY(rectTemp.right+1, rectTemp.top-1); m_pStateCS[nCS] = new CStatic; m_pStateCS[nCS]->Create(_T(""), WS_CHILD|WS_VISIBLE|SS_ICON, rectWnd, this); } pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_VCC); for (BYTE i = 0; i < CountPower; i++) { pCombo->SetItemData(pCombo->AddString(CFlashRecord::GetStringPower(i)), i); } SetSelection(pCombo, Power_1_8); GetDlgItem(IDC_LABEL_RECORDS)->GetWindowRect(rectWnd); ScreenToClient(rectWnd); m_FlashParametersDlg.Create(this, rectWnd.TopLeft()); m_FlashRecordsDlg.Create(this, rectWnd.TopLeft()); m_bCheckSuccess = FALSE; m_bConnected = m_pSheet->m_pOwner->IsConnected(); m_nSelectID = m_bConnected ? IDC_SELECT_CHECK : IDC_SELECT_BASE; ((CButton*)GetDlgItem(IDC_SELECT_CHECK))->EnableWindow(m_bConnected); ((CButton*)GetDlgItem(m_nSelectID))->SetCheck(BST_CHECKED); m_bCheckSuccess = FALSE; m_nSignature = NO_FILTER_ID; SetCheckControls(); return TRUE; }
CRect CKResizing::grid(CWnd *wnd, int xpos, int ypos, int width, int height, CRect rect) { int x,y; CRect temRect; if(width==0) width=rect.Width() - leftSpace -rightSpace; if(height==0) height=rect.Height() - topSpace - botSpace; temRect.SetRect(0,0,width,height); switch(xpos) { case KR_LEFT: x=leftSpace; break; case KR_MID: x=(rect.Width() - width)/2; break; default: x=rect.Width() - width - rightSpace; } x += rect.left; switch(ypos) { case KR_TOP: y=topSpace; break; case KR_MID: y=(rect.Height() - height)/2; break; default: y=rect.Height() - height - botSpace; } y += rect.top; temRect.MoveToXY(x,y); if(wnd!=0) wnd->MoveWindow(&temRect); return temRect; }
LRESULT CxResLibImgList::OnMouseHover(WPARAM wp,LPARAM lp) { if ( m_nLastFocusItem == -1 ) return 0; CResLibData * pBase = reinterpret_cast< CResLibData * > ( GetItemData( m_nLastFocusItem ) ); if (pBase == NULL) return 0; if ( m_nLastFocusItem >= 0 ) { CRect rc; this->GetItemRect(m_nLastFocusItem, &rc, LVIR_BOUNDS); UINT nSelCx = m_pImgSelected->GetHeight(); UINT nSelCy = m_pImgSelected->GetWidth(); rc.bottom = rc.top + nSelCy; CPoint pt = rc.TopLeft(); ::ClientToScreen(this->GetSafeHwnd(), &pt); //pt.Offset(rc.Width(), rc.Height()); //rc.MoveToXY(pt); ::GetCursorPos(&pt); pt.x += g_ToolTipOffset.x; pt.y += g_ToolTipOffset.y; rc.MoveToXY(pt); CString strTip; strTip.Format( "名称:%s\r\n作者:%s\r\n时间:%s\r\n版本:%s\r\n描述:%s" , pBase->m_sName.c_str() , pBase->m_sAuthor.c_str() , pBase->m_sCreatTime.c_str() , pBase->m_sVersions.c_str() , pBase->m_sDsec.c_str() ); m_ToolTip.SetTextMargin (TEXT_MARGIN + 2); m_ToolTip.SetFont ( &theApp.m_font ); m_ToolTip.Track (rc, strTip); } return 0; }
BOOL CSearchEdit::OnEraseBkgnd(CDC* pDC) { // TODO: Add your message handler code here and/or call default CRect rect; GetWindowRect(rect); skin.searchBG.bmp.DrawStretched(pDC, 0, 0, rect.Width(), rect.Height(), 0, 0, 0, 0); skin.searchIcon.DrawUnscaled(pDC, 2, rect.Height()/2-8, 16, 16, 0, 0); if(!hasFocus) { rect.DeflateRect(20, 0); rect.MoveToXY(20, 0); pDC->SetTextColor(skin.searchPlaceholderColor); pDC->SetBkMode(TRANSPARENT); CFont* fnt=pDC->SelectObject(GetFont()); pDC->DrawText(CLang::Get(L"search"), -1, rect, DT_VCENTER|DT_SINGLELINE); pDC->SelectObject(fnt); } if(GetWindowTextLength()>0) { skin.searchClear.DrawUnscaled(pDC, rect.Width()-18, rect.Height()/2-8, 16, 16, 0, 0); } return true; }
// 计算客户区大小 void QnSkinDialog::OnThemeNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp) { TRACE(_T("QnSkinDialog::OnThemeNcCalcSize()")); if (bCalcValidRects) { int crcx = 3; int crcy = 3; int bordercx = GetSystemMetrics(SM_CXBORDER); int bordercy = GetSystemMetrics(SM_CYBORDER); int framecx = GetSystemMetrics(SM_CXFRAME); int framecy = GetSystemMetrics(SM_CYFRAME); if (GetWindowLong(m_hWnd, GWL_STYLE) & WS_SIZEBOX) { crcx = framecx-bordercx; crcy = framecy-bordercy; } else { if (m_bCancelReSizeStyle) { crcx = 0; crcy = 0; } TRACE(_T("%d,%d,%d,%d"),lpncsp->rgrc[0].left, lpncsp->rgrc[0].top, lpncsp->rgrc[0].right, lpncsp->rgrc[0].bottom); } if (m_bFullScreen) { TRACE(_T("full screen:%d,%d,%d,%d"),lpncsp->rgrc[0].left, lpncsp->rgrc[0].top, lpncsp->rgrc[0].right, lpncsp->rgrc[0].bottom); CRect rect = lpncsp->rgrc[0]; rect.MoveToXY(-crcx, -crcy); lpncsp->rgrc[0] = rect; } else { int bordercx = GetSystemMetrics(SM_CXBORDER); int bordercy = GetSystemMetrics(SM_CYBORDER); int framecx = GetSystemMetrics(SM_CXFRAME); int framecy = GetSystemMetrics(SM_CYFRAME); lpncsp->rgrc[0].left += m_pThemeDialog->m_nToLeft-crcx; lpncsp->rgrc[0].right -= m_pThemeDialog->m_nToRight-crcx; lpncsp->rgrc[0].top += m_pThemeDialog->m_nToTop-crcy; lpncsp->rgrc[0].bottom -= m_pThemeDialog->m_nToBottom-crcy; } } }
CRect CKResizing::grid(CWnd *wnd, int xpos, int ypos, CRect fixedRect, CRect rect) { int x,y; switch(xpos) { case KR_LEFT: x=leftSpace; break; case KR_MID: x=(rect.Width() - fixedRect.Width())/2; break; default: x=rect.Width() - fixedRect.Width() - rightSpace; } x += rect.left; switch(ypos) { case KR_TOP: y=topSpace; break; case KR_MID: y=(rect.Height() - fixedRect.Height())/2; break; default: y=rect.Height() - fixedRect.Height() - botSpace; } y += rect.top; fixedRect.MoveToXY(x,y); if(wnd!=0) wnd->MoveWindow(&fixedRect); return fixedRect; }
void CSvyListDlg::MakeSurveyListButton() { CString strCurrentPath; strCurrentPath = CMyUtil::GetCurrentPath(); CRect rc; for (register int i = 0; i < (int)m_vecSurvey.size(); i++) { if (!m_PngButton[i].Create(NULL, WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | BS_OWNERDRAW | SS_NOTIFY, CRect(0,0,0,0), this, IDC_LAYOUT_PNG_BUTTON_000+i)) { TRACE("\n [&rino-error&] Can't Create.... [m_PngButton] : [%d]", i); return; } m_PngButton[i].LoadStdImage(strCurrentPath + IMAGES_FOLDER + L"\\1_btn_bg.png", strCurrentPath + IMAGES_FOLDER + L"\\1_btn_bgOn.png", m_vecSurvey.at(i).svn_name, m_vecSurvey.at(i).fromDate + "-" + m_vecSurvey.at(i).endDate); m_PngButton[i].SetToolTipText(_T("")); rc = m_PngButton[i].GetStdImageRect(); rc.MoveToXY(100, 500 + i * 100); m_PngButton[i].MoveWindow(rc); } // 버튼 생성 후 설명 메세지를 만든다. if (!m_StaticDesc.Create(_T(""), WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS, CRect(0, 0, 0, 0), this, IDC_LAYOUT_TEXT_000)) { return; } //void Initilize(CString strTransparent, CString strFont, int nFontSize, int nColorRed, int nColorGreen, int nColorBlue, // int nBgColorRed, int nBgColorGreen, int nBgColorBlue, CString strValue) { m_StaticDesc.Initilize(L"YES", L"나눔고딕", 15, 155, 155, 155, 0, 0, 0, L"응답하신 내용은 통계법에 따라 철저하게 비밀이 보장되며, 설문을 통해 얻어진 모든 정보는 통계목적 이외의 다른 목적으로는 사용 되지 않습니다."); m_StaticDesc.MoveWindow(80, 530 + (int)m_vecSurvey.size() * 100, 867, 97); m_StaticDesc.Invalidate(); }
//移动子窗口控件 void CDlgExpEditorDM::MoveItem( CWnd* wndItem, EDirection e, int d ) { CRect rect; wndItem->GetWindowRect(rect); int x = rect.left; int y = rect.top; switch(e) { case UP: { y -= d; break; } case DOWN: { y += d; break; } case LEFT: { x -= d; break; } case RIGHT: { y +=d; break; } } rect.MoveToXY(x, y); ScreenToClient(rect); wndItem->MoveWindow(rect); }
void CLMenu::UpdatePosition(CPoint pt) { if(!IsWindow(m_hWnd) || !IsWindowVisible()) { return; } CMonitors monitors; CMonitor *monitor = monitors.GetMonitor(pt); if(!monitor) { return; } CRect r; GetWindowRect(&r); if(parent) { r.MoveToXY(pt.x - SHADOW_SIZE - BORDER_SIZE, pt.y - SHADOW_SIZE - BORDER_SIZE - RADIUS / 2); } else { switch(position) { case DockPositionBottom: { r.MoveToXY(pt.x - SHADOW_SIZE - BORDER_SIZE - RADIUS / 2 - ARROW_WIDTH / 2, pt.y - SHADOW_SIZE - BORDER_SIZE - RADIUS - ARROW_HEIGHT - ITEM_HEIGHT * ItemCount(TRUE)); } break; case DockPositionTop: { r.MoveToXY(pt.x - SHADOW_SIZE - BORDER_SIZE - RADIUS / 2 - ARROW_WIDTH / 2, pt.y - SHADOW_SIZE - BORDER_SIZE); } break; case DockPositionRight: { r.MoveToXY(pt.x - SHADOW_SIZE - BORDER_SIZE - RADIUS - ITEM_ADDITION - GetMaxItemWidth(), pt.y - SHADOW_SIZE - BORDER_SIZE - RADIUS / 2 - (ITEM_HEIGHT * ItemCount(TRUE)) / 2); } break; case DockPositionLeft: { r.MoveToXY(pt.x - SHADOW_SIZE - BORDER_SIZE, pt.y - SHADOW_SIZE - BORDER_SIZE - RADIUS / 2 - (ITEM_HEIGHT * ItemCount(TRUE)) / 2); } break; default: { r.MoveToXY(pt.x - SHADOW_SIZE - BORDER_SIZE, pt.y - SHADOW_SIZE - BORDER_SIZE - RADIUS / 2); } break; } } CRect monitorRect = monitor->Rect(); // update position on the screen //int a = arrowOffset; //arrowOffset = 0; if(r.left < monitorRect.left) { /*arrowOffset = r.left - monitor->rect.left; if(arrowOffset < SHADOW_SIZE + RADIUS / 2) { arrowOffset = 0; }*/ r.MoveToX(monitorRect.left); } if(r.top < monitorRect.top) { r.MoveToY(monitorRect.top); } if(r.bottom > monitorRect.bottom) { r.MoveToY(r.top - (r.bottom - monitorRect.bottom)); } //int arrowRight = r.Width() - SHADOW_SIZE * 2 - RADIUS - ARROW_WIDTH; if(!parent) { if(r.right > monitorRect.right) { /*arrowOffset = r.right - monitor->rect.right; if(arrowOffset > arrowRight) { arrowOffset = arrowRight; }*/ r.MoveToX(r.left - (r.right - monitorRect.right)); } } else { CRect rect; parent->GetWindowRect(&rect); if(r.right > monitorRect.right) { /*arrowOffset = r.right - monitor->rect.right; if(arrowOffset > arrowRight) { arrowOffset = arrowRight; }*/ r.MoveToX(rect.left - r.Width() + SHADOW_SIZE * 2); } } SetWindowPos(this, r.left, r.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); /*if(a != arrowOffset) { DrawBckg(); Draw(); }*/ }
LRESULT WaitingUsersFrame::onCustomDraw(int /*idCtrl*/, LPNMHDR pnmh, BOOL& bHandled) { /* [-] IRainman if (!BOOLSETTING(SHOW_PROGRESS_BARS)) { bHandled = FALSE; return 0; } */ CRect rc; LPNMLVCUSTOMDRAW cd = reinterpret_cast<LPNMLVCUSTOMDRAW>(pnmh); UploadQueueItem *ii = (UploadQueueItem*)cd->nmcd.lItemlParam; // ?? switch (cd->nmcd.dwDrawStage) { case CDDS_PREPAINT: return CDRF_NOTIFYITEMDRAW; case CDDS_ITEMPREPAINT: #ifdef FLYLINKDC_USE_LIST_VIEW_MATTRESS Colors::alternationBkColor(cd); // [+] IRainman #endif return CDRF_NOTIFYSUBITEMDRAW; case CDDS_SUBITEM | CDDS_ITEMPREPAINT: { // Let's draw a box if needed... if (BOOLSETTING(SHOW_PROGRESS_BARS) && m_ctrlList.findColumn(cd->iSubItem) == UploadQueueItem::COLUMN_TRANSFERRED) // [+] IRainman { // draw something nice... LocalArray<TCHAR, 256> buf; m_ctrlList.GetItemText((int)cd->nmcd.dwItemSpec, cd->iSubItem, buf.data(), 255); m_ctrlList.GetSubItemRect((int)cd->nmcd.dwItemSpec, cd->iSubItem, LVIR_BOUNDS, rc); // Real rc, the original one. CRect real_rc = rc; // We need to offset the current rc to (0, 0) to paint on the New dc rc.MoveToXY(0, 0); // Text rect CRect rc2 = rc; rc2.left += 6; // indented with 6 pixels rc2.right -= 2; // and without messing with the border of the cell // Set references CDC cdc; cdc.CreateCompatibleDC(cd->nmcd.hdc); HBITMAP hBmp = CreateCompatibleBitmap(cd->nmcd.hdc, real_rc.Width(), real_rc.Height()); HBITMAP pOldBmp = cdc.SelectBitmap(hBmp); HDC& dc = cdc.m_hDC; HFONT oldFont = (HFONT)SelectObject(dc, Fonts::g_font); SetBkMode(dc, TRANSPARENT); CBarShader statusBar(rc.bottom - rc.top, rc.right - rc.left, RGB(150, 0, 0), ii->getSize()); statusBar.FillRange(0, ii->getPos(), RGB(222, 160, 0)); statusBar.Draw(cdc, rc.top, rc.left, SETTING(PROGRESS_3DDEPTH)); SetTextColor(dc, SETTING(PROGRESS_TEXT_COLOR_UP)); ::ExtTextOut(dc, rc2.left, rc2.top + (rc2.Height() - WinUtil::getTextHeight(dc) - 1) / 2, ETO_CLIPPED, rc2, buf.data(), _tcslen(buf.data()), NULL); SelectObject(dc, oldFont); BitBlt(cd->nmcd.hdc, real_rc.left, real_rc.top, real_rc.Width(), real_rc.Height(), dc, 0, 0, SRCCOPY); DeleteObject(cdc.SelectBitmap(pOldBmp)); return CDRF_SKIPDEFAULT; } // [!] Colors::getUserColor(ii->getUser(), cd->clrText, cd->clrTextBk); // [!] IRainman fix todo [1] https://www.box.net/shared/f7c509838c3a1125842b , https://crash-server.com/DumpGroup.aspx?ClientID=guest&DumpGroupID=59082 // !SMT!-IP if (m_ctrlList.findColumn(cd->iSubItem) == UploadQueueItem::COLUMN_LOCATION) { const tstring l_text = ii->getText(UploadQueueItem::COLUMN_LOCATION); if (l_text.length() != 0) { m_ctrlList.GetSubItemRect((int)cd->nmcd.dwItemSpec, cd->iSubItem, LVIR_BOUNDS, rc); CRect rc2 = rc; m_ctrlList.SetItemFilled(cd, rc2, cd->clrText); LONG top = rc2.top + (rc2.Height() - 15) / 2; if ((top - rc2.top) < 2) top = rc2.top + 1; const POINT p = { rc2.left, top }; if (ii->m_location.isKnown()) { g_flagImage.DrawLocation(cd->nmcd.hdc, ii->m_location, p); } top = rc2.top + (rc2.Height() - 15 /*WinUtil::getTextHeight(cd->nmcd.hdc)*/ - 1) / 2; if (!l_text.empty()) { ::ExtTextOut(cd->nmcd.hdc, rc2.left + 30, top + 1, ETO_CLIPPED, rc2, l_text.c_str(), l_text.length(), NULL); } return CDRF_SKIPDEFAULT; } } } //[+]PPA // Fall through default: return CDRF_DODEFAULT; } }
int CPrizeEndDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) { CString strCurrentPath; strCurrentPath = CMyUtil::GetCurrentPath(); CRect rc; if (CDialogEx::OnCreate(lpCreateStruct) == -1) return -1; if (!m_btnPrizes.Create(NULL, WS_VISIBLE | WS_CHILD | BS_OWNERDRAW, CRect(0, 0, 0, 0), this, IDC_EVENT_IN_BUTTON)) { TRACE("\n [&rino-error&] Can't Create.... [m_btnPrizes]"); return false; } m_btnPrizes.LoadStdImage(strCurrentPath + IMAGES_FOLDER + L"\\4_btn_otherAttraction.png", strCurrentPath + IMAGES_FOLDER + L"\\4_btn_otherAttractionOn.png", L"", L""); rc = m_btnPrizes.GetStdImageRect(); rc.MoveToXY(400, 590); m_btnPrizes.MoveWindow(rc); if (!m_btnHome.Create(NULL, WS_VISIBLE | WS_CHILD | BS_OWNERDRAW, CRect(0, 0, 0, 0), this, IDC_SURVEY_HOME_PNG_BUTTON)) { TRACE("\n [&rino-error&] Can't Create.... [m_btnHome]"); return false; } m_btnHome.LoadStdImage(strCurrentPath + IMAGES_FOLDER + L"\\2_btn_home.png", strCurrentPath + IMAGES_FOLDER + L"\\2_btn_homeOn.png", L"", L""); rc = m_btnHome.GetStdImageRect(); rc.MoveToXY(850, 700); m_btnHome.MoveWindow(rc); //if(!m_btnAgree1.Create(NULL, WS_VISIBLE | WS_CHILD | BS_OWNERDRAW, // CRect(0, 0, 0, 0), this, IDC_AGREE_1_BUTTON)) { // TRACE("\n [&rino-error&] Can't Create.... [m_btAgree1]"); // return false; //} //m_btnAgree1.LoadToggleImages(strCurrentPath + IMAGES_FOLDER + L"\\4_btn_uncheck.png", // strCurrentPath + IMAGES_FOLDER + L"\\4_btn_check.png", // L"", L""); //rc = m_btnAgree1.GetStdImageRect(); //rc.MoveToXY(97, 632); //m_btnAgree1.MoveWindow(rc); //if(!m_btnAgree2.Create(NULL, WS_VISIBLE | WS_CHILD | BS_OWNERDRAW, // CRect(0, 0, 0, 0), this, IDC_AGREE_2_BUTTON)) { // TRACE("\n [&rino-error&] Can't Create.... [m_btAgree2]"); // return false; //} //m_btnAgree2.LoadToggleImages(strCurrentPath + IMAGES_FOLDER + L"\\4_btn_uncheck.png", // strCurrentPath + IMAGES_FOLDER + L"\\4_btn_check.png", // L"", L""); //rc = m_btnAgree2.GetStdImageRect(); //rc.MoveToXY(315, 632); //m_btnAgree2.MoveWindow(rc); //strCurrentPath = CMyUtil::GetCurrentPath(); //CString filePath = strCurrentPath + L"kiosk_data" + m_strEventImage; //m_SponsorImage.Load(filePath); //CreatePhone(); //LoadMagnetok(); return 0; }
BOOL CFlashParametersDlg::Create(CWnd* pParentWnd, CPoint ptWnd, BOOL bNew) { if (!CDialog::Create(IDD, pParentWnd)) return FALSE; CFlashDatabase& database(m_pFlash->m_OwnerBase); CComboBox* pCombo; CRect rectParameters; CVendorRecord* pVendor; INT i; LOGFONT lf; m_bNew = bNew; // Move window GetWindowRect(&rectParameters); rectParameters.MoveToXY(ptWnd); MoveWindow(&rectParameters); // Init controls pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_VENDOR); for (POSITION nPosVendor = database.GetVendorHeadPosition(); nPosVendor != NULL; ) { pVendor = database.GetVendorNext(nPosVendor); pCombo->SetItemData(pCombo->AddString(pVendor->m_strVendor), pVendor->m_nID); } pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_CS_CHIP); pCombo->SetItemData(pCombo->AddString(_T(" 1")), 0x01); pCombo->SetItemData(pCombo->AddString(_T(" 2")), 0x02); pCombo->SetItemData(pCombo->AddString(_T(" 3")), 0x03); pCombo->SetItemData(pCombo->AddString(_T(" 4")), 0x04); pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_CMD_CYCLE); pCombo->SetItemData(pCombo->AddString(_T(" 1")), 0x01); pCombo->SetItemData(pCombo->AddString(_T(" 2")), 0x02); pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_FULL_ADR_CYCLE); pCombo->SetItemData(pCombo->AddString(_T(" 3")), 0x03); pCombo->SetItemData(pCombo->AddString(_T(" 4")), 0x04); pCombo->SetItemData(pCombo->AddString(_T(" 5")), 0x05); pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_PAGE_ADR_CYCLE); pCombo->SetItemData(pCombo->AddString(_T(" 1")), 0x01); pCombo->SetItemData(pCombo->AddString(_T(" 2")), 0x02); pCombo->SetItemData(pCombo->AddString(_T(" 3")), 0x03); pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_CMD_TYPE); for (i = 0; i < CountCommandType; i++) { pCombo->SetItemData(pCombo->AddString(CFlashRecord::GetStringCommandType(i)), i); } pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_BUS); for (i = 0; i < CountBusWidth; i++) { pCombo->SetItemData(pCombo->AddString(CFlashRecord::GetStringBusWidth(i)), i); } pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_SPEED); for (i = 0; i < CountSpeedAsyn; i++) { pCombo->SetItemData(pCombo->AddString(CFlashRecord::GetStringSpeed(i)), i); } pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_POWER_IO); for (i = 0; i < CountPowerIO; i++) { pCombo->SetItemData(pCombo->AddString(CFlashRecord::GetStringPowerIO(i)), i); } pCombo = (CComboBox*)GetDlgItem(IDC_COMBO_ONFI); for (i = 0; i < CountSupportONFI; i++) { pCombo->SetItemData(pCombo->AddString(CFlashRecord::GetStringSupportONFI(i)), i); } ((CEdit*)GetDlgItem(IDC_EDIT_LU_CS))->SetLimitText(3); ((CEdit*)GetDlgItem(IDC_EDIT_BLOCK_LU))->SetLimitText(5); ((CEdit*)GetDlgItem(IDC_EDIT_PAGE_BLOCK))->SetLimitText(5); ((CEdit*)GetDlgItem(IDC_EDIT_PAGE_SIZE))->SetLimitText(5); m_pEditID = DYNAMIC_DOWNCAST(CDumpEdit, GetDlgItem(IDC_EDIT_ID)); ASSERT(m_pEditID != NULL); m_pEditID->GetFont(&lf); lf.lfHeight = 14; lf.lfWeight = FW_MEDIUM; m_pEditID->SetFont(&lf, false); m_pEditID->SetShowAddress(false, false); m_pEditID->SetShowAscii(false, false); m_pEditID->SetBytesPerRow(COUNT_ID_MASK, false, false); m_pEditID->SetDirectDataPtr((BYTE*)&m_pFlash->m_nID, COUNT_ID_MASK, false); // Show window ShowWindow(SW_SHOW); return TRUE; }
int CEventDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) { CString strCurrentPath; strCurrentPath = CMyUtil::GetCurrentPath(); CRect rc; if (CDialogEx::OnCreate(lpCreateStruct) == -1) return -1; if (!m_btnEventIn.Create(NULL, WS_VISIBLE | WS_CHILD | BS_OWNERDRAW, CRect(0, 0, 0, 0), this, IDC_EVENT_IN_BUTTON)) { TRACE("\n [&rino-error&] Can't Create.... [m_btnEventIn]"); return false; } m_btnEventIn.LoadStdImage(strCurrentPath + IMAGES_FOLDER + L"\\4_btn_entering.png", strCurrentPath + IMAGES_FOLDER + L"\\4_btn_enteringOn.png", L"", L""); rc = m_btnEventIn.GetStdImageRect(); rc.MoveToXY(450, 1640); m_btnEventIn.MoveWindow(rc); if (!m_btnHome.Create(NULL, WS_VISIBLE | WS_CHILD | BS_OWNERDRAW, CRect(0, 0, 0, 0), this, IDC_SURVEY_HOME_PNG_BUTTON)) { TRACE("\n [&rino-error&] Can't Create.... [m_btnHome]"); return false; } m_btnHome.LoadStdImage(strCurrentPath + IMAGES_FOLDER + L"\\2_btn_home.png", strCurrentPath + IMAGES_FOLDER + L"\\2_btn_homeOn.png", L"", L""); rc = m_btnHome.GetStdImageRect(); rc.MoveToXY(780, 1770); m_btnHome.MoveWindow(rc); if(!m_btnAgree1.Create(NULL, WS_VISIBLE | WS_CHILD | BS_OWNERDRAW, CRect(0, 0, 0, 0), this, IDC_AGREE_1_BUTTON)) { TRACE("\n [&rino-error&] Can't Create.... [m_btAgree1]"); return false; } m_btnAgree1.LoadToggleImages(strCurrentPath + IMAGES_FOLDER + L"\\4_btn_uncheck.png", strCurrentPath + IMAGES_FOLDER + L"\\4_btn_check.png", L"", L""); rc = m_btnAgree1.GetStdImageRect(); rc.MoveToXY(297, 1547); m_btnAgree1.MoveWindow(rc); if(!m_btnAgree2.Create(NULL, WS_VISIBLE | WS_CHILD | BS_OWNERDRAW, CRect(0, 0, 0, 0), this, IDC_AGREE_2_BUTTON)) { TRACE("\n [&rino-error&] Can't Create.... [m_btAgree2]"); return false; } m_btnAgree2.LoadToggleImages(strCurrentPath + IMAGES_FOLDER + L"\\4_btn_uncheck.png", strCurrentPath + IMAGES_FOLDER + L"\\4_btn_check.png", L"", L""); rc = m_btnAgree2.GetStdImageRect(); rc.MoveToXY(562, 1547); m_btnAgree2.MoveWindow(rc); strCurrentPath = CMyUtil::GetCurrentPath(); CString filePath = strCurrentPath + L"kiosk_data" + m_strEventImage; m_SponsorImage.Load(filePath); CreatePhone(); LoadMagnetok(); return 0; }
BOOL AboutGameDialog::OnInitDialog() { BaseDialog::OnInitDialog(); CWaitCursor wc; const FrotzApp::GameInfo& gameInfo = theApp.GetGameInfo(); // Initialize the rich edit text control if (m_info.SubclassDlgItem(IDC_INFO,this) == FALSE) return FALSE; m_info.SetText(SF_TEXT,gameInfo.description); // Add the title, author, etc. CString heading; heading.Append(gameInfo.title); heading.AppendChar('\r'); if (gameInfo.seriesNumber.IsEmpty() == FALSE) { heading.Append(gameInfo.series); heading.Append(" #"); heading.Append(gameInfo.seriesNumber); heading.AppendChar('\r'); } if (gameInfo.headline.IsEmpty() == FALSE) { heading.Append(gameInfo.headline); heading.AppendChar('\r'); } heading.Append(gameInfo.author); if (gameInfo.year.IsEmpty() == FALSE) { heading.Append(" ("); heading.Append(gameInfo.year); heading.AppendChar(')'); } heading.Append("\r\r"); m_info.SetSel(0,0); CHARFORMAT format; format.cbSize = sizeof format; format.dwMask = CFM_BOLD; format.dwEffects = CFE_BOLD; m_info.SetSelectionCharFormat(format); m_info.ReplaceSel(heading); // Set the dialog title SetWindowText(gameInfo.title); // Get the initial position of the rich edit, used for spacing CRect initRect; m_info.GetWindowRect(initRect); ScreenToClient(initRect); // Get the cover art FrotzGfx* coverGfx = NULL; if (gameInfo.cover != -1) coverGfx = FrotzGfx::Get(gameInfo.cover,theApp.GetBlorbMap(),gameInfo.coverFormatWrong); CRect screen = theApp.GetScreenSize(true); if (coverGfx != NULL) { // Choose a size for the cover art CSize size = coverGfx->GetSize(1.0); double r = (double) screen.Width() / ((double) size.cx * 3.0); size = coverGfx->GetSize(r); // Resize the cover art CWindowDC dc(this); if (!m_coverBitmap.CreateBitmap(dc,size.cx,size.cy)) return FALSE; coverGfx->Paint(m_coverBitmap,CPoint(0,0),r); m_coverRect = CRect(initRect.TopLeft(),size); } else m_coverRect = CRect(initRect.TopLeft(),CSize(screen.Width()/3,screen.Width()/3)); // Resize the rich edit control CRect infoRect = m_coverRect; if (coverGfx != NULL) infoRect.OffsetRect(m_coverRect.right,0); m_info.MoveWindow(infoRect); // Get the size of the OK button CRect okRect; m_ok.GetClientRect(okRect); // Resize the OK button okRect.MoveToXY( initRect.left+((infoRect.right+initRect.left)/2)-(okRect.Width()/2), m_coverRect.bottom+infoRect.top); m_ok.MoveWindow(okRect,FALSE); // Get the initial dialog size CRect dlgCRect, dlgWRect; GetClientRect(dlgCRect); GetWindowRect(dlgWRect); int dlgX = dlgWRect.Width()-dlgCRect.Width(); int dlgY = dlgWRect.Height()-dlgCRect.Height(); // Resize the dialog MoveWindow(0,0, infoRect.right+initRect.left+dlgX, okRect.bottom+initRect.top+dlgY,FALSE); CenterWindow(); return TRUE; }
void CSampleEditorDlg::MoveControls() { CRect rect; GetClientRect(&rect); if (m_pSampleView) { rect.top++; rect.left++; rect.bottom -= 80; rect.right -= 2; m_pSampleView->MoveWindow(rect); m_pSampleView->Invalidate(); } CWnd *control; CRect controlRect; GetClientRect(&rect); if (control = GetDlgItem(IDC_PLAY)) { control->GetClientRect(&controlRect); controlRect.MoveToXY(10, rect.bottom - 30); control->MoveWindow(controlRect); } if (control = GetDlgItem(IDC_POS)) { control->GetClientRect(&controlRect); controlRect.MoveToXY(5, rect.bottom - 75); controlRect.InflateRect(0, 0, 2, 2); control->MoveWindow(controlRect); } if (control = GetDlgItem(IDC_INFO)) { control->GetClientRect(&controlRect); controlRect.MoveToXY(130, rect.bottom - 75); controlRect.InflateRect(0, 0, 2, 2); controlRect.right = rect.right - 5; control->MoveWindow(controlRect); } if (control = GetDlgItem(IDC_STATIC_PITCH)) { control->GetClientRect(&controlRect); controlRect.MoveToXY(93, rect.bottom - 27); control->MoveWindow(controlRect); } if (control = GetDlgItem(IDC_PITCH)) { control->GetClientRect(&controlRect); controlRect.MoveToXY(120, rect.bottom - 30); control->MoveWindow(controlRect); } if (control = GetDlgItem(IDC_DELTASTART)) { control->GetClientRect(&controlRect); controlRect.MoveToXY(10, rect.bottom - 50); control->MoveWindow(controlRect); } if (control = GetDlgItem(IDC_DELETE)) { control->GetClientRect(&controlRect); controlRect.MoveToXY(250, rect.bottom - 30); control->MoveWindow(controlRect); } if (control = GetDlgItem(IDC_TILT)) { control->GetClientRect(&controlRect); controlRect.MoveToXY(330, rect.bottom - 30); control->MoveWindow(controlRect); } if (control = GetDlgItem(IDCANCEL)) { control->GetClientRect(&controlRect); controlRect.MoveToXY(rect.right - controlRect.right - 10, rect.bottom - 30); control->MoveWindow(controlRect); } if (control = GetDlgItem(IDOK)) { control->GetClientRect(&controlRect); controlRect.MoveToXY(rect.right - controlRect.right - 10, rect.bottom - 55); control->MoveWindow(controlRect); } Invalidate(); RedrawWindow(); }
BOOL CPeraProcessDesignerApp::InitInstance() { ZTools::InitZToolsLog(); if ( !m_CmdLine.Parse() ) { MessageBox( NULL, "解析命令行失败!", g_lpszAppTitle, MB_OK | MB_TOPMOST ); return FALSE; } m_hMetux = CreateMutex(NULL,TRUE,"PeraProcessDesigner.exe"); if (m_hMetux) { if (ERROR_ALREADY_EXISTS== GetLastError()) { HWND hwndPeraProcessDesignerCopied = FindPeraProcessDesignerMainWindow(); //当有互斥,但是没找到窗口时,认为之前的进程还在启动中,简单处理,直接退出 if ( hwndPeraProcessDesignerCopied) { if ( !m_CmdLine.GetValue( NULL ).IsEmpty() ) { #define WS_OPENWS_SENDMSG #ifdef WS_OPENWS_SENDMSG DWORD dwProcessId = 0; GetWindowThreadProcessId(hwndPeraProcessDesignerCopied, &dwProcessId); if ( GetTopModalWindow( dwProcessId ) == NULL ) { CSharedMemory Mem; CString sMemData = g_lpszDoubleOpenWsMemStr; Mem.Init( g_lpszDoubleOpenWsMemName, sMemData.GetLength()+MAX_PATH ); SendCopyData( hwndPeraProcessDesignerCopied, CPMSG_WORKSPACE_MAKESUREINFO, (LPVOID)NULL, 0 ); sMemData.Empty(); sMemData = (LPCTSTR)Mem.GetData(); if ( sMemData.CompareNoCase( g_lpszDoubleOpenWsMemStr ) == 0 ) { MessageBox( NULL, "建模环境处于活动状态,请先保存模型后重试!", g_lpszAppTitle, MB_OK | MB_TOPMOST ); } else { CString sCmdLine = ::GetCommandLine(); SendCopyData( hwndPeraProcessDesignerCopied, CPMSG_WORKSPACE_OPENWS, (LPVOID)(LPCTSTR)sCmdLine, sCmdLine.GetLength()+1 ); } } else { MessageBox( NULL, "建模环境处于活动状态,请先保存模型后重试!", g_lpszAppTitle, MB_OK | MB_TOPMOST ); } #else MessageBox( hwndPeraProcessDesignerCopied, "建模环境已打开,请在建模环境中打开本文件!", g_lpszAppTitle, MB_OK | MB_TOPMOST ); #endif } if (IsIconic(hwndPeraProcessDesignerCopied)) ShowWindow(hwndPeraProcessDesignerCopied,SW_RESTORE); SetForegroundWindow(hwndPeraProcessDesignerCopied); ZTools::WriteZToolsFormatLog("将已经运行的建模窗口激活,并前端显示..."); } CloseHandle(m_hMetux); m_hMetux = NULL; ZTools::WriteZToolsFormatLog("已经存在一个建模客户端,本运行实例将退出..."); return FALSE; } } m_LoginData.m_strRealName = m_CmdLine.GetValue( "realName" ); m_LoginData.m_strUser = m_CmdLine.GetValue( "userName" ); m_LoginData.m_strTicket = m_CmdLine.GetValue( "ticket-proxy" ); WriteShareMemoryLoginInfo(); CCrashHandler ch; ch.SetProcessExceptionHandlers(); ch.SetThreadExceptionHandlers(); //如果PeraTaskService进程不存在,自动启动 StartPeraTaskService(); //_CrtSetBreakAlloc(1300); // InitCommonControlsEx() is required on Windows XP if an application // manifest specifies use of ComCtl32.dll version 6 or later to enable // visual styles. Otherwise, any window creation will fail. INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // Set this to include all the common control classes you want to use // in your application. InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); //hModule = ::LoadLibrary("C:\\Users\\kunmiao-li\\Desktop\\TestBuild\\PeraLicMgr\\Release\\PeraLicMgr.dll"); //#ifndef _DEBUG if (!InitLicense("PeraWorkSpace")) return FALSE; // if(!m_FlexNetMgr.CheckOutLicense("PeraWorkSpace")) // { // return FALSE; // } // hModule = ::LoadLibrary(ZTools::FormatString("%s\\PeraLicMgr.dll", GetFlexwareBinPathMethod()).c_str()); // if( hModule != NULL ) // { // lpFnDLLfunc = (LPFNDLLFUNC) ::GetProcAddress(hModule, "CheckOutLicense"); // if(lpFnDLLfunc != NULL) // { // if(!lpFnDLLfunc("PeraProcessDesigner")) // { // return FALSE; // } // } // else // { // return FALSE; // } // } // else // { // AfxMessageBox("检测到系统安装不完整,请联系管理员重新安装!", MB_OK|MB_ICONINFORMATION); // return FALSE; // } //#endif //if(!m_FlexNetMgr.InitNewJob("PeraProcessDesigner")) //{ // return FALSE; //} CWinApp::InitInstance(); InitGDIPlus(); LoadResLibImageSet(); //LoadDefaultFont(); //CBCGPPopupMenuBar::SetPeraPaint( g_crToolbarBg ); //CXmlBase xml; //MSXML2::IXMLDOMDocument2Ptr pdoc = xml.GetXmlDocPtrByFile(GetExecDir() + "\\Manifest.xml"); //MSXML2::IXMLDOMNodeListPtr pModels; //MSXML2::IXMLDOMNodePtr pModel; //long lModelCount; //HRESULT hr = S_OK; //map<CString, CString> mapAttrs; //map<CString, CString>::iterator iterAttrs; //CString str; //pModels = xml.GetNodeListPtr("/Manifest/Component", pdoc); //if (pModels != NULL) //{ // lModelCount = pModels->Getlength(); // for (long i=0; i<lModelCount; i++) // { // hr = pModels->get_item(i, &pModel); // if (FAILED(hr) || NULL == pModel) // { // continue; // } // if (0 == xml.GetAttrsOfNode(mapAttrs, pModel)) // { // continue; // } // iterAttrs = mapAttrs.find("RobotName"); // if (iterAttrs != mapAttrs.end()) str= iterAttrs->second; // } //} //CCxArray3D a3d(DT_ARRAY3D_INT); //CString str3d = "[1,2,3,4,5,](4,3,2)" //CString str = "[1e150,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24](2,3,4)"; // CString str = "[\"\\\\\\\",,1e150\",\"2\"](2)"; //{ // CString str1; // for (int a=0;a<2;a++) // { // for (int b=0;b<3;b++) // { // for (int c=0;c<4;c++) // { // } // } // } //} // //CxArrayND nd( DT_ARRAY1D_STRING ); //nd.Parse( str ); //vector<int> vPos; //vPos.push_back(0); ////vPos.push_back(0); ////vPos.push_back(0); //LPARAM lpData = nd.GetDataPtr( vPos ); //CString * pData = reinterpret_cast< CString * > ( lpData ); //nd.Clear(); // Initialize OLE libraries if (!AfxOleInit()) { AfxMessageBox(IDP_OLE_INIT_FAILED); return FALSE; } AfxEnableControlContainer(); EnableTaskBarInteraction(FALSE); globalData.SetDPIAware (); //globalData.bDisableAero = TRUE; //Bar挺靠后,Slider宽度,由于Splitter最小宽度为4,所以此值不应小于4,否则与Splitter不协调。 CBCGPSlider::m_nDefaultWidth = 4; // All registry read/write operations will be produced via CBCGPXMLSettings gateway: CBCGPRegistrySP::SetRuntimeClass (RUNTIME_CLASS (CBCGPXMLSettings)); // Read settings: CBCGPXMLSettings::ReadXMLFromFile (FALSE, GetExecDir() + _T("\\user.xml")); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need // Change the registry key under which our settings are stored // TODO: You should modify this string to be something appropriate // such as the name of your company or organization //SetRegistryKey(_T("PeraProcessDesigner")); //LoadStdProfileSettings(0); // Load standard INI file options (including MRU) //SetRegistryBase (_T("Settings")); RECT rectDesktop; SystemParametersInfo(SPI_GETWORKAREA,0,(PVOID)&rectDesktop,0); m_rcLastWindowPlacement = rectDesktop; CRect rectDesktop2 = rectDesktop; int nFlag = 0; int nShowCmd = 0; LoadWindowPlacement( m_rcLastWindowPlacement, nFlag, nShowCmd ); StoreWindowPlacement (rectDesktop2, 2, SW_SHOWMAXIMIZED); theGlobalConfig.Load(); m_bAloneVersionWs = IsPeraProcessRunnerInstalled(); CCxBCGPVisualManager2007::SetStyle (CCxBCGPVisualManager2007::VS2007_Silver); CCxBCGPVisualManager2007::SetDefaultManager (RUNTIME_CLASS (CCxBCGPVisualManager2007)); //globalData.bDisableAero = TRUE; //globalData.bIsOSAlphaBlendingSupport = TRUE; // Initialize all Managers for usage. They are automatically constructed // if not yet present InitMouseManager(); //InitContextMenuManager(); InitKeyboardManager(); // Enable user-defined tools. If you want allow more than 10 tools, // add tools entry to resources (ID_USER_TOOL11, ID_USER_TOOL12,...) EnableUserTools (ID_TOOLS_ENTRY, ID_USER_TOOL1, ID_USER_TOOL10); // TODO: Remove this if you don't want extended tooltips: InitTooltipManager(); CBCGPToolTipParams params; params.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager ()->SetTooltipParams ( BCGP_TOOLTIP_TYPE_ALL, RUNTIME_CLASS (CBCGPToolTipCtrl), ¶ms); // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate(IDR_MAIN, RUNTIME_CLASS(CPeraProcessDesignerDoc), RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(CPeraProcessDesignerView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // create main MDI Frame window CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame->LoadFrame(IDR_MAIN)) return FALSE; m_bCreate = TRUE; m_pMainWnd = pMainFrame; //basehtmldialog中,屏蔽快捷键 g_hwndMainWindow = pMainFrame->GetSafeHwnd(); g_pLoadingWindow = new CLoadingWindow( TIMER_LOADING_WINDOW, IDD_DIALOG_LOGIN_BK, m_pMainWnd ); g_pLoadingWindow->Create( IDD_DIALOG_LOGIN_BK, m_pMainWnd ); g_pLoadingWindow->Init( GetExecDir() + "\\Res\\DlgProgress\\DlgProgress.png" ); pMainFrame->m_wndMenuBar.LoadData(); //pMainFrame->OnMenuModuleOpenjianmo(); // call DragAcceptFiles only if there's a suffix // In an MDI app, this should occur immediately after setting m_pMainWnd // Parse command line for standard shell commands, DDE, file open //CCommandLineInfo cmdInfo; //ParseCommandLine(cmdInfo); //if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew) //{ // if (!pMainFrame->LoadMDIState (GetRegSectionPath ()) || // DYNAMIC_DOWNCAST(CMDIChildWnd, pMainFrame->GetActiveFrame()) == NULL) // { // if (!ProcessShellCommand(cmdInfo)) // return FALSE; // } //} //else //{ // // Dispatch commands specified on the command line // if (!ProcessShellCommand(cmdInfo)) // return FALSE; //} // The main window has been initialized, so show and update it pMainFrame->OnMenuModuleOpenjianmo(); m_bInitMDI = TRUE; m_nCmdShow = SW_SHOWMAXIMIZED; pMainFrame->ShowWindow(m_nCmdShow); pMainFrame->UpdateWindow(); ////////////////////////////////////////////////////////////////////////// //日志输出窗口 #ifdef USE_DLGLOG m_dlgLog.Create(CDlgLog::IDD, NULL); //m_dlgLog.ShowWindow(SW_SHOW); // int x, y; // x = GetSystemMetrics(SM_CXFULLSCREEN); //屏幕宽度 // y = GetSystemMetrics(SM_CYFULLSCREEN); //屏幕高度 CRect rectFull; SystemParametersInfo(SPI_GETWORKAREA,0,&rectFull,0); CRect rect; m_dlgLog.GetWindowRect(rect); rect.MoveToXY(0, rectFull.bottom - rect.Height()); m_dlgLog.MoveWindow(rect); #endif // USE_DLGLOG ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// //延长票据有效期 StartKeepTicketThread(); ////////////////////////////////////////////////////////////////////////// //在线编辑用到的共享内存初始化 m_pSharedMemoryOnlineEdit = NULL; m_pSharedMemoryOnlineEdit = new SharedMemoryOnlineEdit(); ////////////////////////////////////////////////////////////////////////// g_ReadRobotDB.Load(); pMainFrame->m_wndLoginBar.RedrawWindow(); CString sParamFile = m_CmdLine.GetValue( NULL ); if ( !sParamFile.IsEmpty() ) { ZTools::WriteZToolsFormatLog( "--------------********打开文件[%s]**********-------------", sParamFile ); theApp.m_processMgr.Open( sParamFile ); } else { ZTools::WriteZToolsLog( "--------------********未打开文件逻辑**********-------------" ); CDlgStart lgn; lgn.DoModal(); } #ifdef USE_DLGLOG m_dlgLog.ShowWindow(SW_SHOW); #endif // USE_DLGLOG ////////////////////////////////////////////////////////////////////////// WINDOWPLACEMENT wp; memset(&wp, NULL, sizeof(wp)); wp.length = sizeof (WINDOWPLACEMENT); if (pMainFrame->GetWindowPlacement (&wp)) { wp.rcNormalPosition = m_rcLastWindowPlacement; RECT rectDesktop; SystemParametersInfo(SPI_GETWORKAREA,0,(PVOID)&rectDesktop,0); OffsetRect(&wp.rcNormalPosition, -rectDesktop.left, -rectDesktop.top); pMainFrame->SetWindowPlacement (&wp); } return TRUE; }