BOOL CDiscSpaceCountdown::OnInitDialog() { CDialog::OnInitDialog(); DWORD dwIds[] = {IDC_DISCSPACE_COUNTDOWN_TITLE, IDC_DISCSPACE_COUNTDOWN_TEXT, IDC_DISCSPACE_COUNTDOWN, IDC_DISCSPACE_COUNTDOWN_TEXT2, -1}; MfcUtils::Localize(this, dwIds); HICON hIcon = LoadIcon(NULL, IDI_WARNING); m_wndWarning.SetIcon(hIcon); CString csTitle; csTitle.LoadString(IDS_WARNING); SetWindowText(csTitle); CFont *pWindowFont = XTPPaintManager()->GetRegularFont(); if (pWindowFont != NULL) { LOGFONT lf; pWindowFont->GetLogFont(&lf); m_font.DeleteObject(); lf.lfWeight = FW_BOLD; m_font.CreateFontIndirect(&lf); m_wndTitle.SetFont(&m_font); m_wndSeconds.SetFont(&m_font); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben }
void CLogGraph::OnPaint() { CPaintDC paintDc(this); CDC& dc = FBufferInit(paintDc); dc.IntersectClipRect(&m_rectWnd); // ensure draw only in client area dc.SetWindowOrg(0, 0); dc.SetViewportOrg(0, 0); dc.SetMapMode(MM_ANISOTROPIC); dc.SetWindowExt(1, 1); dc.SetViewportExt(1, 1); // dc.FillSolidRect(&m_rectGraph, m_crBack); XTPPaintManager()->GradientFill(&dc, m_rectGraph, RGB(60,0,0), RGB(0,0,60), FALSE); dc.SetBkMode(TRANSPARENT); // 그리기 시작 if (m_bLoad){ drawHeader(dc); drawGraph(dc); } FBufferRelease(paintDc); if (m_bStylesModified){ // reset style if resized GetParent()->ModifyStyle(WS_CLIPCHILDREN, 0); ModifyStyle(WS_CLIPSIBLINGS, 0); m_bStylesModified = false; } m_nLastCursorPos = -1; }
void CMainFrame::SetTheme(int iTheme) { m_iTheme = iTheme; XTThemeManager()->SetTheme((XTThemeStyle)m_iTheme); XTPPaintManager()->SetTheme((XTPPaintTheme)m_iTheme); RedrawWindow( NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE | RDW_ALLCHILDREN ); RecalcLayout(); }
void CAlphaIconsPage::OnCheckFaded() { UpdateData(); XTP_COMMANDBARS_ICONSINFO* pIconsInfo = XTPPaintManager()->GetIconsInfo(); pIconsInfo->bUseFadedIcons = m_bFaded; RedrawCommandBars(); }
void CAlphaIconsPage::OnCheckShadow() { UpdateData(); XTP_COMMANDBARS_ICONSINFO* pIconsInfo = XTPPaintManager()->GetIconsInfo(); pIconsInfo->bIconsWithShadow = m_bShadow; RedrawCommandBars(); }
void CShortcutBarView::OnDraw(CDC* pDC) { CShortcutBarDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if (XTPPaintManager()->GetCurrentTheme() == xtpThemeOffice2003) pDC->Draw3dRect(CXTPClientRect(this), GetXtremeColor(XPCOLOR_FRAME), GetXtremeColor(XPCOLOR_FRAME)); else pDC->Draw3dRect(CXTPClientRect(this), GetXtremeColor(COLOR_3DSHADOW), GetXtremeColor(COLOR_3DHIGHLIGHT)); }
void CLogGraph::drawScale(CDC& dc, int nIndex, CRect rect, int nAlign) { XTPPaintManager()->GradientFill(&dc, rect, m_crScaleBack, RGB(0,0,0), FALSE); double high, low, step, v; CString fmt; if (nIndex < 0 || nIndex > (int)m_aChannels.size()) { high = 100.0; low = 0.0; fmt = " %.0f%% "; } else { high = m_aChannels[nIndex]->high; low = m_aChannels[nIndex]->low; fmt = m_aChannels[nIndex]->fmt; } step = (high - low) / double(m_nGridSize); v = high; // draw grid & scale text CPen* pOldPen, pen; CFont* pOldFont; pen.CreatePen(PS_SOLID, 1, m_crGrid); pOldPen = dc.SelectObject(&pen); pOldFont = dc.SelectObject(&m_fontScale); dc.SetTextColor(m_crScale); double h = (double)m_rectGraph.Height() / (double)m_nGridSize; double y = m_rectGraph.top; for (int i = 0; i < m_nGridSize; i++) { dc.MoveTo(m_rectGraph.left, (int)y); dc.LineTo(m_rectGraph.right, (int)y); CRect r = rect; r.top = int(y); r.bottom = int(y + 12); CString s; s.Format(fmt, v); dc.DrawText(s, &r, nAlign); y += h; v -= step; } dc.SelectObject(pOldPen); dc.SelectObject(pOldFont); pen.DeleteObject(); }
void CAlphaIconsPage::UpdateContent() { XTP_COMMANDBARS_ICONSINFO* pIconsInfo = XTPPaintManager()->GetIconsInfo(); m_bFaded = pIconsInfo->bUseFadedIcons; m_bShadow = pIconsInfo->bIconsWithShadow; CXTPFrameWnd* pFrame = (CXTPFrameWnd*)AfxGetMainWnd(); CXTPCommandBars* pCommandBars = pFrame->GetCommandBars(); ASSERT(pCommandBars); CXTPCommandBarsOptions* pOptions = pCommandBars->GetCommandBarsOptions(); m_bLargeImages = pOptions->bLargeIcons; UpdateData(FALSE); }
void CMainFrame::SetRibbonFont() { CXTPOffice2007Theme* pOfficeTheme = (CXTPOffice2007Theme*)(m_cmdbars->GetPaintManager()); CString fontname, sizestr; std::wstring fontcfg(GetStringValue(m_appname.c_str(), L"RibbonFont", L".")); if (fontcfg.size() < 2) { fontcfg = GetStringValue(L"uicorextp", L"RibbonFont", getUIOptions()->GetString(L"ribbonFont", L"Tahoma,12").c_str()); } AfxExtractSubString(fontname, fontcfg.c_str(), 0, ','); AfxExtractSubString(sizestr, fontcfg.c_str(), 1, ','); long fontsize = _wtol(sizestr); if (!fontname.IsEmpty() && pOfficeTheme->FontExists(fontname)) { pOfficeTheme->m_strOfficeFont = fontname; XTPPaintManager()->m_strOfficeFont = fontname; } if (fontsize != 0) { #if _XTPLIB_VERSION_MAJOR > 13 pOfficeTheme->SetFontHeight(fontsize); #else CXTPRibbonBar* pRibbonBar = DYNAMIC_DOWNCAST( CXTPRibbonBar, m_cmdbars->GetMenuBar()); pRibbonBar->SetFontHeight(fontsize); #endif } else { pOfficeTheme->UpdateFonts(); } m_cmdbars->GetToolTipContext()->SetFont(m_cmdbars->GetPaintManager()->GetRegularFont()); }
BOOL CMainFrame::InitRibbonTheme() { std::wstring themeName(getUIOptions()->GetString(L"themeName", L"OFFICE2010SILVER.INI")); std::wstring themeDll(getUIOptions()->GetString(L"themeDll", L"Office2010.dll")); getUIOptions()->SetString(L"themeDll", themeDll.c_str()); getUIOptions()->SetString(L"themeName", themeName.c_str()); themeDll = getTranslationsPath((L"../" + themeDll).c_str()); BOOL ret = XTPResourceImages()->SetHandle(themeDll.c_str(), themeName.c_str()); if (!ret) { std::wstring dllfile(getTranslationsPath(L"../Office2007.dll")); ret = XTPResourceImages()->SetHandle(dllfile.c_str(), L"OFFICE2007BLUE.INI"); if (ret) { getUIOptions()->SetString(L"themeDll", L"Office2007.dll"); getUIOptions()->SetString(L"themeName", L"OFFICE2007BLUE.INI"); } } if (ret) { XTPPaintManager()->SetTheme(xtpThemeRibbon); m_cmdbars->SetTheme(xtpThemeRibbon); } else { CString msg; msg.Format(L"Need Office2010.dll or Office2007.dll in the translations folder: %s.\n", getTranslationsPath(L"..").c_str()); ASSERT_MESSAGE(0, w2a(msg).c_str()); } return ret; }
void CAlphaIconsPage::OnActivate() { CXTPFrameWnd* pFrame = (CXTPFrameWnd*)AfxGetMainWnd(); CXTPCommandBars* pCommandBars = pFrame->GetCommandBars(); ASSERT(pCommandBars); CXTPToolBar* pToolBar = pCommandBars->GetAt(1); ASSERT(pToolBar->GetTitle() == _T("Standard")); XTPImageManager()->RemoveAll(); pToolBar->LoadToolBar(IDR_ICONS_MENU_32); XTP_COMMANDBARS_ICONSINFO* pIconsInfo = XTPPaintManager()->GetIconsInfo(); pIconsInfo->bUseDisabledIcons = TRUE; CXTPCommandBarsOptions* pOptions = pCommandBars->GetCommandBarsOptions(); pOptions->szIcons = CSize(16, 16); pOptions->szLargeIcons = CSize (42, 35); pOptions->bLargeIcons = FALSE; XTPImageManager()->SetIcons(IDR_ICONS_TOOLBAR_32); if (!XTPImageManager()->IsAlphaIconsSupported()) { m_bResample = TRUE; GetDlgItem(IDC_CHECK_RESAMPLE)->EnableWindow(FALSE); UpdateData(FALSE); } ResampleImages(); UpdateContent(); }
int CSgSelectionPreparationBar::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CWnd::OnCreate(lpCreateStruct) == -1) return -1; //Create font 1 LOGFONT logFontBtn1, logFontBtn2, logFont3; XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontBtn1); //logFontBtn1.lfHeight += 0.1; m_Font1.CreateFontIndirect(&logFontBtn1); XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontBtn2); logFontBtn2.lfHeight += 2; m_Font2.CreateFontIndirect(&logFontBtn2); XTPPaintManager()->GetRegularFont()->GetLogFont(&logFont3); logFont3.lfHeight += 4; m_Font3.CreateFontIndirect(&logFont3); CRect rcClient; GetClientRect(&rcClient); // Create close button CRect rcElement(rcClient.right - 18 - 2/*- 6*/, rcClient.top, rcClient.right -2/*-0 - 6*/, rcClient.top+18); CRect rcButton; rcButton.SetRect(0,0, 16, 16); BOOL bCreate = m_btnCancelSelection.Create(_T(""), WS_CHILD | WS_VISIBLE /*| BS_PUSHBUTTON*/, rcButton, this, IDC_CANCELSELECTION); if(bCreate == TRUE) { SetButtonImage(&m_btnCancelSelection, IDR_CLOSE_SGHINTS, CSize(16, 16)); m_btnCancelSelection.SetFlatStyle(true); m_btnCancelSelection.SetTheme(xtpButtonThemeOffice2007); m_btnCancelSelection.SetShowFocus(FALSE); m_btnCancelSelection.SetTransparent(TRUE); } m_btnCancelSelection.SetWindowPos(NULL, rcElement.left, rcElement.top, rcElement.Width(), rcElement.Height(), SWP_NOZORDER); UINT nYPos = 7; CreateSgSelectionButtons(nYPos); CreateAudioButtons(nYPos); CreateSgSettingButtons(nYPos); UpdateDialogControls(this, FALSE); //SetTimer(13, 10, 0); if(m_pPresentationBar) { m_pPresentationBar->DestroyWindow(); m_pPresentationBar->CreateEx(WS_EX_LAYERED | WS_EX_TOPMOST | WS_EX_TOOLWINDOW, AfxRegisterWndClass(0,0,0,0), NULL, WS_POPUP | WS_VISIBLE, CRect(100, 100, 400, 200), this, 0); m_pPresentationBar->SetLayeredWindowAttributes(RGB(255, 255, 255), (255 * 30) / 100, LWA_ALPHA | LWA_COLORKEY); } if(m_pPresentationBar!=NULL && m_bShowPresentationBar) { m_pPresentationBar->ShowWindow(SW_SHOW); } if(m_pWidgetRef) { CRect rcWidget(0,0,100,80); if ( m_pWidgetRef->GetSafeHwnd() != NULL) m_pWidgetRef->GetWindowRect(rcWidget); m_pWidgetRef->DestroyWindow(); m_pWidgetRef->CreateEx(WS_EX_LAYERED | WS_EX_TOPMOST | WS_EX_TOOLWINDOW, AfxRegisterWndClass(0,0,0,0), NULL, WS_POPUP | WS_VISIBLE, CRect(100, 100, 400, 200), this, 0); m_pWidgetRef->StartSavePosition(); // hide it for mom. will be displayed manually. m_pWidgetRef->ShowWindow(SW_HIDE); m_pWidgetRef->UpdateWindowPlacement();// == false ) // m_pWidgetRef->SetWindowPos(NULL, 100, 100, rcWidget.Width(), rcWidget.Height(), SWP_NOZORDER); } UpdateDialogControls(this, FALSE); return 0; }
void CLogGraph::drawHeader(CDC& dc) { XTPPaintManager()->GradientFill(&dc, m_rectHeader,m_crHeaderBack, RGB(0,0,0), FALSE); CPen* pOldPen, pen; CFont* pOldFont; CString fmt, s; int i; if (m_nScaleIndex != -1) drawScale(dc, m_nScaleIndex, m_rectScale, DT_RIGHT); if (m_nScaleIndex2 != -1) drawScale(dc, m_nScaleIndex2, m_rectScale2, DT_LEFT); // draw Header (로그 시작점, 로그 끝점 표시) CString tmp; pOldFont = dc.SelectObject(&m_fontHeader); dc.SetTextColor(m_crHeader); if (!m_bLoad)return; //short* a = new short [lib->mque_reclen(m_hQue)]; ////////////// tdata* tp = getTptr(m_nCurrentPos); // read date // lib->mque_getn(m_hQue, m_nCurrentPos+1, a); m_tStart = tp->time; s = tformat("%Y-%m-%d\r\n%H:%M:%S", m_tStart); tmp.Format("%s\r\n%d", s, m_nCurrentPos); dc.DrawText(tmp, &m_rectHeader, DT_LEFT); // lib->mque_getn(m_hQue, getWndQueLastPos()-1, a); tp = getTptr(getWndQueLastPos()-1); // m_tEnd = lib->mque_time(m_hQue); // s = tformat("%Y-%m-%d\r\n%H:%M:%S", (int)m_tEnd); tmp.Format("%s\r\n%d", s, getWndQueLastPos()); dc.DrawText(tmp, &m_rectHeader, DT_RIGHT); // delete a; // draw Header (nav button, zoom) int nav[4][20] = { // 20x20 짜리 nav button { 1,1, 4,1, 4,8, 18,1, 18,19, 4,12, 4,19, 1,19, 1,1, 0,0 }, // home { 1,10, 10,1, 10,8, 19,1, 19,19, 10,12, 10,19, 1,10, 0,0 }, // pgup { 1,1, 10,8, 10,1, 19,10, 10,19, 10,12, 1,19, 1,1, 0,0 }, // pgdn { 1,1, 16,8, 16,1, 19,1, 19,19, 16,19, 16,12, 1,19, 1,1, 0,0 } // end }; CRect r = m_rectHeader; int w = 20; // button width & height int iw = w - 4; // icon size CBrush brush; CRgn rgn; CPoint pt[20]; brush.CreateSolidBrush(RGB(255, 100, 100)); pen.CreatePen(PS_SOLID, 1, RGB(255, 255, 255)); pOldPen = dc.SelectObject(&pen); r.left = r.Width() / 2 - (w * 4) / 2; r.right = r.left + w * 4; r.bottom = r.top + w; int x = r.left; for (i = 0; i < 4; i++) { CRect rect = r; rect.left = x + 1; rect.right = x + w - 1; rect.top++; rect.bottom--; switch (i) { case 0 : m_rectHome = rect; break; case 1 : m_rectPgUp = rect; break; case 2 : m_rectPgDn = rect; break; case 3 : m_rectEnd = rect; break; } XTPPaintManager()->GradientFill(&dc, &rect, RGB(100,100,100), RGB(0,0,0), FALSE); int j; for (j = 0; nav[i][j] !=0; j+=2) { pt[j/2].x = int(double(nav[i][j]) * iw / 20.0) + x + 2; pt[j/2].y = int(double(nav[i][j+1]) * iw / 20.0) + r.top + 2; } VERIFY(rgn.CreatePolygonRgn(pt, j/2, WINDING)); dc.FillRgn(&rgn, &brush); rgn.DeleteObject(); x += w; } dc.SelectObject(pOldPen); r.top = r.top + w; r.DeflateRect(2, 2); r.bottom = m_rectHeader.bottom; m_rectZoom = r; XTPPaintManager()->GradientFill(&dc, &r, RGB(100,50,50), RGB(0,0,0), FALSE); s.Format("Zoom %.0f:1", m_fZoomFactor); dc.DrawText(s, &r, DT_CENTER | DT_VCENTER | DT_SINGLELINE); dc.SelectObject(pOldFont); }
int CStartupView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CScrollView::OnCreate(lpCreateStruct) == -1) return -1; CMainFrameA* pMainFrame = CMainFrameA::GetCurrentInstance(); if(pMainFrame!=NULL) { m_pImageManager = pMainFrame->GetCommandBars()->GetImageManager(); } WCHAR *pFontName = _T("Segoe UI"); LOGFONT logFontBtn; XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontBtn); //WCHAR *pFontName = _T("Segoe UI"); _tcscpy(logFontBtn.lfFaceName, pFontName); //logFontBtn.lfUnderline = true; logFontBtn.lfHeight = 12 + 2; m_btnFont.CreateFontIndirect(&logFontBtn); LOGFONT logFontBtn14; XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontBtn14); //WCHAR *pFontName = _T("Segoe UI"); _tcscpy(logFontBtn14.lfFaceName, pFontName); logFontBtn14.lfWeight = FW_BOLD; logFontBtn14.lfHeight = 14 + 2; m_btnFont14.CreateFontIndirect(&logFontBtn14); LOGFONT logFontBtn12; XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontBtn12); //WCHAR *pFontName = _T("Segoe UI"); _tcscpy(logFontBtn12.lfFaceName, pFontName); logFontBtn12.lfWeight = FW_BOLD; logFontBtn12.lfHeight = 12 + 2; m_btnFont12.CreateFontIndirect(&logFontBtn12); LOGFONT logFontWebBtn; XTPPaintManager()->GetRegularFont()->GetLogFont(&logFontWebBtn); //WCHAR *pFontName = _T("Segoe UI"); _tcscpy(logFontWebBtn.lfFaceName, pFontName); logFontWebBtn.lfItalic = true; logFontWebBtn.lfWeight = FW_BOLD; logFontWebBtn.lfHeight = 12 + 2; m_webBtnFont.CreateFontIndirect(&logFontWebBtn); // Calculate width and height of tab title region LOGFONT logFont; ASSISTANT::FillLogFont(logFont, m_csTabFontFamily, m_iTabFontSize, _T("bold"), _T("roman"), false); m_iTabWidth = DrawSdk::Text::GetTextWidth(m_csStartPage, m_csStartPage.GetLength(), &logFont) + 3; m_iTabHeight = DrawSdk::Text::GetTextHeight(m_csStartPage, m_csStartPage.GetLength(), &logFont); LoadBitmaps(); CreateCloseButton(); CreateWelcomeButtons(); //CreateRecentlyOpenedButtons(); CreateShowAgainButton(); CreateToolTips(); SetScrollSizes( MM_TEXT, CSize(VIEW_DEFAULT_WIDTH, VIEW_DEFAULT_HEIGHT) ); RepositionButtons(); ShowToolTips(); return 0; }