//控件绘制事件处理方法 void CLedCtrl::OnPaint() { // TODO: Add your message handler code here // Do not call CStatic::OnPaint() for painting messages GetClientRect(&m_recClient); CPaintDC dc(this); CMemDC memDC(&dc, m_recClient); CMemDC* pDC = &memDC; CRect clip; pDC->GetClipBox(&clip); pDC->FillSolidRect(&m_recClient, m_crColorBackground ); for (int nCount = 0; nCount< m_strNumber.GetLength(); nCount++) { if (m_bDrawFadedNotches) Draw( pDC, STCOUNTERALL, nCount ); // Draw the faded bits //CString str = m_strNumber[nCount]; if ( m_strNumber[nCount] == _T('0') ) Draw( pDC, STCOUNTER0, nCount ); else if ( m_strNumber[nCount] == _T('1') ) Draw( pDC, STCOUNTER1, nCount ); else if ( m_strNumber[nCount] == _T('2') ) Draw( pDC, STCOUNTER2, nCount ); else if ( m_strNumber[nCount] == _T('3') ) Draw( pDC, STCOUNTER3, nCount ); else if ( m_strNumber[nCount] == _T('4') ) Draw( pDC, STCOUNTER4, nCount ); else if ( m_strNumber[nCount] == _T('5') ) Draw( pDC, STCOUNTER5, nCount ); else if ( m_strNumber[nCount] == _T('6') ) Draw( pDC, STCOUNTER6, nCount ); else if ( m_strNumber[nCount] == _T('7') ) Draw( pDC, STCOUNTER7, nCount ); else if ( m_strNumber[nCount] == _T('8') ) Draw( pDC, STCOUNTER8, nCount ); else if ( m_strNumber[nCount] == _T('9') ) Draw( pDC, STCOUNTER9, nCount ); else if ( m_strNumber[nCount] == _T('-') ) Draw( pDC, STCOUNTER10, nCount ); else if ( m_strNumber[nCount] == _T(':') ) Draw( pDC, STCOUNTER11, nCount ); } }
void PreviousImagesView::DrawCurrentImage(CPaintDC& dc, int& iWidth) { // calculate bitmap size CRect rcPaint; GetClientRect(&rcPaint); BITMAP bm = { 0 }; GetObject(m_bmpPreviousImage, sizeof(bm), &bm); iWidth = rcPaint.Width(); int iHeight = rcPaint.Height(); ScaleBitmapSize(bm, iWidth, iHeight); // select bitmap into bitmap DC CDC bmpDC; bmpDC.CreateCompatibleDC(dc); HBITMAP hbmT = bmpDC.SelectBitmap(m_bmpPreviousImage); // draw to memory DC CMemoryDC memDC(dc, dc.m_ps.rcPaint); memDC.FillSolidRect(&dc.m_ps.rcPaint, ::GetSysColor(COLOR_3DFACE)); // blit bitmap memDC.SetStretchBltMode(COLORONCOLOR); memDC.StretchBlt(0, 0, iWidth, iHeight, bmpDC, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); bmpDC.SelectBitmap(hbmT); }
void CUIDesignerView::OnDraw(CDC* pDrawDC) { CUIDesignerDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if (!pDoc) return; // TODO: 在此处为本机数据添加绘制代码 CMemDC memDC(*pDrawDC, this); CDC* pDC = &memDC.GetDC(); CRect rectClient; GetClientRect(rectClient); CPoint point=GetScrollPosition(); rectClient.OffsetRect(point); pDC->FillSolidRect(rectClient,RGB(255, 255, 255)); CSize szFormSize=m_LayoutManager.GetForm()->GetInitSize(); CSize szFormOffset(FORM_OFFSET_X,FORM_OFFSET_Y); CDC hCloneDC; HBITMAP hNewBitmap; hCloneDC.CreateCompatibleDC(pDC); hNewBitmap=::CreateCompatibleBitmap(pDC->GetSafeHdc(),szFormSize.cx,szFormSize.cy); HBITMAP hOldBitmap=(HBITMAP)hCloneDC.SelectObject(hNewBitmap); m_LayoutManager.Draw(&hCloneDC); pDC->BitBlt(szFormOffset.cx,szFormOffset.cy,szFormSize.cx,szFormSize.cy,&hCloneDC,0,0,SRCCOPY); hCloneDC.SelectObject(hOldBitmap); ::DeleteDC(hCloneDC); ::DeleteObject(hNewBitmap); m_MultiTracker.Draw(pDC,&szFormOffset); }
void CXTPReportHeaderDragWnd::OnPaint() { CPaintDC dc(this); CXTPClientRect rc(this); CXTPBufferDC memDC(dc, rc); OnDraw(&memDC, rc); }
wxSize clEditorTipWindow::DoGetTipSize() { wxDC *dc; wxGCDC gdc; wxBitmap bmp(1, 1); wxMemoryDC memDC(bmp); if ( !DrawingUtils::GetGCDC(memDC, gdc) ) { dc = (wxDC*)&memDC; } else { dc = (wxDC*)&gdc; } wxSize sz; wxSize sz2; dc->SetFont(m_font); sz = dc->GetTextExtent(m_tipText); sz2 = dc->GetTextExtent(wxT("100 of 100")); sz.y *= 2; sz.y += (2*TIP_SPACER); sz.x += (2*TIP_SPACER); if(sz.x < sz2.x) { sz.x = sz2.x; } return sz; }
void CAddrDropDownList::OnPaint(CDCHandle dc, RECT rect) { SCROLLINFO si = { sizeof(SCROLLINFO), SIF_POS }; GetScrollInfo(SB_VERT, &si); CMemoryDC memDC(dc, rect); RECT rcClient; GetClientRect(&rcClient); int iDelta = s()->Combo()->GetComboDropdownItemBackgroundHeight(m_bBigDropDown); for (int i = 0, y = -si.nPos; i < m_iDisplayDataCount; i++, y += iDelta) { RECT rcItem = { 0, y, rcClient.right, y + iDelta }; int iBackColor = 0; if (i == 0 && m_pComboBox->IsInAutoCompletionMode()) iBackColor = 2; else if (m_LocalData[i].iType == 1) iBackColor = 1; else iBackColor = 0; s()->Combo()->DrawComboDropDownListItem(memDC, rcItem, m_iCurrentSelection == i ? Btn_MouseOver : Btn_MouseOut, m_LocalData[i].strURL, m_LocalData[i].strTitle, m_LocalData[i].strURLMask, m_LocalData[i].strTitleMask, (HICON)m_LocalData[i].hSiteIcon, m_bBigDropDown, iBackColor, m_eDeleteButtonStatus); } }
wxSize clEditorTipWindow::DoGetTipSize() { wxDC* dc; wxGCDC gdc; wxBitmap bmp(1, 1); wxMemoryDC memDC(bmp); if(!DrawingUtils::GetGCDC(memDC, gdc)) { dc = (wxDC*)&memDC; } else { dc = (wxDC*)&gdc; } wxSize sz; wxSize sz2; dc->SetFont(m_font); sz = dc->GetTextExtent(m_tipText); if(GetTip() && GetTip()->Count() > 1) { // for multiple tips, use second line as well sz2 = dc->GetTextExtent(wxT("100 of 100")); sz.y *= 2; } else { sz2 = wxSize(1, 1); } sz.y += (2 * TIP_SPACER); sz.x += (2 * TIP_SPACER); if(sz.x < sz2.x) { sz.x = sz2.x; } return sz; }
void CSkinHorizontalScrollbar::Draw() { CClientDC dc(this); CRect clientRect; GetClientRect(&clientRect); CMemDC memDC(&dc, &clientRect); memDC.FillSolidRect(&clientRect, pList->GetBkColor()); CDC bitmapDC; bitmapDC.CreateCompatibleDC(&dc); //draw left arrow of scrollbar CBitmap bitmap; bitmap.LoadBitmap(IDB_LISTCTRL_HORIZONTAL_SCROLLBAR_LEFTARROW); CBitmap* pOldBitmap = bitmapDC.SelectObject(&bitmap); memDC.BitBlt(clientRect.left,clientRect.top,26,12,&bitmapDC,0,0,SRCCOPY); bitmapDC.SelectObject(pOldBitmap); bitmap.DeleteObject(); pOldBitmap = NULL; bitmap.LoadBitmap(IDB_LISTCTRL_HORIZONTAL_SCROLLBAR_SPAN); pOldBitmap = bitmapDC.SelectObject(&bitmap); int nWidth = clientRect.Width() - 26; memDC.StretchBlt(clientRect.left+26, clientRect.top, nWidth,12,&bitmapDC, 0,0, 1, 12, SRCCOPY); bitmapDC.SelectObject(pOldBitmap); bitmap.DeleteObject(); pOldBitmap = NULL; bitmap.LoadBitmap(IDB_LISTCTRL_HORIZONTAL_SCROLLBAR_RIGHTARROW); pOldBitmap = bitmapDC.SelectObject(&bitmap); memDC.BitBlt(nWidth,clientRect.top,26,12,&bitmapDC,0,0,SRCCOPY); bitmapDC.SelectObject(pOldBitmap); bitmap.DeleteObject(); pOldBitmap = NULL; //If there is nothing to scroll then don't //show the thumb control otherwise show it if(pList->GetScrollLimit(SB_HORZ) != 0) { bitmap.LoadBitmap(IDB_LISTCTRL_HORIZONTAL_SCROLLBAR_THUMB); pOldBitmap = bitmapDC.SelectObject(&bitmap); memDC.BitBlt(clientRect.left+nThumbLeft,clientRect.top,26,12,&bitmapDC,0,0,SRCCOPY); bitmapDC.SelectObject(pOldBitmap); bitmap.DeleteObject(); pOldBitmap = NULL; } }
void CReagentAreaCtrl::OnPaint() { CPaintDC dc(this); CMemDC memDC(&dc,m_rcClient); // 默认矩形为裁剪区域 memDC.CopyFromSrcDC(); _DrawFrame(&memDC); memDC.CopyToSrcDC(); }
/****************************************************************************** Function Name : OnPaint Input(s) : - Output : - Functionality : This function will be called by framewrok to paint the client area. The double buffering concept is used to avoid flickering of display Member of : CFFListCtrl Author(s) : Raja N Date Created : 23.06.2004 Modification : ******************************************************************************/ void CFFListCtrl::OnPaint() { CPaintDC dc(this); // device context for painting // Create Offscreen Buffer COffScreenDC memDC(&dc, &m_rectClient); // Do not call CListCtrl::OnPaint() for painting messages CWnd::DefWindowProc( WM_PAINT, (WPARAM)memDC.m_hDC, 0 ); }
void CBacnetAlarmWindow::OnPaint() { CPaintDC dc(this); // device context for painting // Do not call CDialogEx::OnPaint() for painting messages CMemDC memDC(dc,this); CRect rcClient; GetClientRect(&rcClient); memDC.GetDC().FillSolidRect(&rcClient,RGB(230,230,230)); Graphics *mygraphics; mygraphics = new Graphics(memDC.GetDC()); mygraphics->SetSmoothingMode(SmoothingModeAntiAlias); CRect test_rect; HWND temp_hwnd = this->m_hWnd; ::GetWindowRect(temp_hwnd,&test_rect); //获取 view的窗体大小; Bitmap bitmap(show_bitmap,NULL); mygraphics->DrawImage(&bitmap,0 ,0,test_rect.Width(),test_rect.Height()); delete mygraphics; //Graphics graphics(memDC.GetDC()); //SolidBrush *BlackBrush; //SolidBrush *CharacterBlackBrush; //Graphics *mygraphics; //mygraphics = new Graphics(memDC.GetDC()); //mygraphics->SetSmoothingMode(SmoothingModeAntiAlias); //BlackBrush =new SolidBrush(MY_COLOR_RED) ; //CharacterBlackBrush = new SolidBrush(MY_COLOR_BLACK_CHARACTER); //mygraphics->FillRectangle(BlackBrush,0,0,rcClient.Width(),40); //FontFamily CharacterfontFamily(_T("Arial")); //PointF TitlepointF(0, 0); //SolidBrush TitleCharacterColor(Color(255,255,255,255)); //Gdiplus::Font Scroll_font(&CharacterfontFamily, 28, FontStyleBold, UnitPixel); //TitlepointF.X = 250; //TitlepointF.Y = 5; //mygraphics->DrawString(_T("Remote Connect procedure"), -1, &Scroll_font, TitlepointF,&TitleCharacterColor); //PointF WarningMessagePoint(0, 0); //SolidBrush WarningMessageColor(Color(255,0,0,0)); //Gdiplus::Font WarningMessageFont(&CharacterfontFamily, 21, FontStyleRegular, UnitPixel); //SolidBrush MessageRetColor(Color(255,0,255,255)); //CString step1_message; end_connect_paint: return; }
void HKeyPixelFrame::OnPaint() { CPaintDC dc(this); CRect rect; GetClientRect(&rect); HMemDC memDC(&dc,rect); m_Image.Draw(memDC.GetSafeHdc(),0,0); OnRender(memDC); }
void CStaticMemDC::OnPaint() { CPaintDC dc(this); CRect clip; GetWindowRect(&clip); // get rect of the control ScreenToClient(&clip); CMemDC2 memDC(&dc,&clip); DefWindowProcA(WM_PAINT, (WPARAM)memDC->m_hDC, (LPARAM)0); }
void CGraphicView::OnPaint() { CPaintDC dc(this); // device context for painting CMemDC memDC(dc,this); CRect rcClient; GetClientRect(&rcClient); //memDC.GetDC().FillSolidRect(&rcClient,::GetSysColor (COLOR_3DLIGHT)); // if(g_strImagePathName.IsEmpty()) if(!m_bImgExist) PainNoImageInfo(&memDC.GetDC()); else { // CMemDC memDC(dc,this); memDC.GetDC().FillSolidRect(&rcClient,RGB(202,208,216)); Graphics graphics(memDC.GetDC()); Bitmap bitmap(m_strImgPathName); graphics.DrawImage(&bitmap,XStart,YStart,bitmap.GetWidth(),bitmap.GetHeight()); } for(int i=0; i<(int)m_RelayLabelLst.size(); i++) { if(i==m_nFoucsIndext&& !m_LbtDown) { CRect rcItem; m_RelayLabelLst.at(i).plabelCtrl->GetWindowRect(&rcItem); ScreenToClient(&rcItem); rcItem.DeflateRect(-1,-1,-1,-1); HBRUSH hOldBrush; HPEN hOldPen; hOldBrush=(HBRUSH)memDC.GetDC().SelectObject(GetStockObject(NULL_BRUSH)); CPen pen(1,2,RGB(0,0,201)); hOldPen=(HPEN)memDC.GetDC().SelectObject(pen); memDC.GetDC().Rectangle(rcItem); memDC.GetDC().SelectObject(hOldBrush); memDC.GetDC().SelectObject(hOldPen); // m_RelayLabelLst.at(i).plabelCtrl->SetWindowText(_T("")); } Label_information label; label=m_RelayLabelLst.at(i); //m_RelayLabelLst.at(i).plabelCtrl->SetLabelInfo(label.tstat_id,label.input_or_output,label.status,label.clrTxt,label.bkColor); if(bac_cm5_graphic == false) label.plabelCtrl->SetLabelInfo(label.tstat_id,label.input_or_output,label.status,label.clrTxt,label.bkColor); else label.plabelCtrl->SetLabelInfo_General(label.tstat_id,label.input_or_output,label.status,label.clrTxt,label.bkColor); } //m_Label.ShowWindow(SW_SHOW); // m_Label.SetRedraw(1); // TODO: Add your message handler code here // Do not call CFormView::OnPaint() for painting messages }
bool MakeBitFont(const iStringT& face_name, sint32 siz, LONG style, const iStringT& fname) { iStringT pngName = fname+_T(".png"); printf("%s (%s) : ",face_name.CStr(),fname.CStr()); /* if (iFile::Exists(pngName)){ printf("Already exists. Skiped...\n"); return false; }*/ HFONT hFont = CreateFont(siz,0,0,0, style, FALSE, FALSE, FALSE, RUSSIAN_CHARSET, OUT_RASTER_PRECIS, CLIP_STROKE_PRECIS, NONANTIALIASED_QUALITY, DEFAULT_PITCH, face_name.CStr()); iMemoryDC memDC(iSize(4096,128)); memDC.SetFont(hFont); // calculate widths for whole table int *fntW = new int[0xFFFF]; if (!GetCharWidth32(memDC,0,0xFFFF,fntW)) { printf("Error: 0x%X\n",GetLastError()); return false; } // calculate total width of all required characters int tw=0; for (uint32 cc=0; cc<CHS_COUNT; ++cc) { for (uint32 xx=CHARSET_TABLES[cc][0]; xx<=CHARSET_TABLES[cc][1]; ++xx) tw += (fntW[xx]); } // Prepare text metrics and dib TEXTMETRIC tm; GetTextMetrics(memDC,&tm); memDC.Resize(iSize(tw,tm.tmHeight+3)); memDC.m_Dib.Fill(cColorBlack, BLEND_SRCCOPY); memDC.SetFont(hFont); memDC.SetTextBkMode(TRANSPARENT); int px=0; for (cc=0; cc<CHS_COUNT; ++cc) { for (uint32 xx=CHARSET_TABLES[cc][0]; xx<=CHARSET_TABLES[cc][1]; ++xx) { ComposeCharacter(memDC, xx, px, fntW[xx]); px += (fntW[xx]); } } iDibColorChannel::FillChannel(memDC.m_Dib, Channel_Alpha, 0xFF); if (!iDibSaver::SavePNG(memDC.m_Dib,pngName)){ printf("Error! Unable to save png file!\n"); return false; } printf("Done!\n"); return true; }
// CWzCalendarCtrl message handlers void CWzCalendarCtrl::OnPaint() { CPaintDC dc(this); // device context for painting CRect rcClient; GetClientRect(rcClient); CMemoryDC memDC(&dc,&rcClient); DrawCalendar(&memDC, rcClient); }
void Graphics::drawBitmap(const Bitmap *bitmap, int x, int y, int w, int h) { DeviceContext memDC(m_dc); HGDIOBJ oldBitmap = memDC.selectObject(bitmap->m_bitmap); BitBlt(m_dc->m_dc, x, y, w, h, memDC.m_dc, 0, 0, SRCCOPY); memDC.selectObject(oldBitmap); }
void gcImgButtonCount::doPaint(wxDC* dc) { gcImageButton::doPaint(dc); if (m_uiCount == 0 || !m_imgCount.getImg() || !m_imgCount->IsOk()) { return; } gcWString text(L"+"); if (m_uiCount < 10) { text = gcWString(L"{0}", m_uiCount); wxFont font(6, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); dc->SetFont(font); } else { wxFont font(6, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD); dc->SetFont(font); } if (isHovering()) dc->SetTextForeground(wxColor(GetGCThemeManager()->getColor("countbubble", "hov-fg"))); else dc->SetTextForeground(wxColor(GetGCThemeManager()->getColor("countbubble", "fg"))); wxSize sz = GetSize(); int x = sz.GetWidth()-15; int y = 4; int w = m_imgCount->GetWidth(); int h = m_imgCount->GetHeight(); int tx = x+(w - dc->GetTextExtent(text).GetWidth())/2; int ty = y+(h - dc->GetTextExtent(text).GetHeight())/2; wxBitmap temp(m_imgCount->Copy()); wxMemoryDC memDC(temp); dc->Blit(x, y, // Draw at (100, 100) w, h, // Draw full bitmap &memDC, // Draw from memDC 0, 0, // Draw from bitmap origin wxCOPY, // Logical operation true); // Take mask into account memDC.SelectObject(wxNullBitmap); dc->DrawText(text, tx, ty); }
//**************************************************************************************** BOOL CBCGPPropertyPage::OnEraseBkgnd(CDC* pDC) { BOOL bRes = TRUE; CRect rectClient; GetClientRect (rectClient); if (IsVisualManagerStyle ()) { #ifndef _BCGSUITE_ if (IsBackstageMode()) { CBCGPMemDC memDC(*pDC, this); CDC* pDCMem = &memDC.GetDC(); CBCGPVisualManager::GetInstance ()->OnFillRibbonBackstageForm(pDCMem, this, rectClient); if (!m_rectBackstageWatermark.IsRectEmpty() && m_pBackstageWatermark != NULL && !globalData.IsHighContastMode()) { ASSERT_VALID(m_pBackstageWatermark); m_pBackstageWatermark->DrawEx(pDCMem, m_rectBackstageWatermark, 0); } bRes = TRUE; } else #endif { if (!CBCGPVisualManager::GetInstance ()->OnFillDialog (pDC, this, rectClient)) { bRes = CPropertyPage::OnEraseBkgnd (pDC); } } } else if (m_bIsAeroWizardPage && !globalData.IsHighContastMode()) { pDC->FillSolidRect(rectClient, RGB(255, 255, 255)); bRes = TRUE; } else { bRes = CPropertyPage::OnEraseBkgnd(pDC); } if (!m_rectHeader.IsRectEmpty () && m_rectHeader.Height() > 1) { CBCGPPropertySheet* pParent = DYNAMIC_DOWNCAST(CBCGPPropertySheet, GetParent ()); if (pParent != NULL) { pParent->OnDrawPageHeader (pDC, pParent->GetPageIndex (this), m_rectHeader); } } return bRes; }
BOOL CDlgCfgSafeCenter::OnEraseBkgnd(CDC* pDC) { CRect rcClient; GetClientRect(rcClient); CMemDC memDC(*pDC, rcClient); memDC.GetDC().FillSolidRect(rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), RGB(255, 255, 255)); return TRUE; }
void CProgressListBox::OnPaint() { CPaintDC dc(this); // device context for painting CRect rcClip; dc.GetClipBox(&rcClip); CMemDC memDC(&dc, &rcClip); memDC.FillSolidRect(&rcClip, GetSysColor(COLOR_3DFACE)); DefWindowProc(WM_PAINT, reinterpret_cast<WPARAM>(memDC.m_hDC), 0); }
LRESULT CWidgetAddress::OnPrint(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { TRY_CATCH RECT rc; GetClientRect(&rc); CMemoryDC memDC(reinterpret_cast<HDC>(wParam), rc); // Drawing original ComboBox item DefWindowProc(WM_PRINT,reinterpret_cast<WPARAM>(memDC.m_hDC),lParam); memDC.ExcludeClipRect(rc.left,rc.top,rc.right,rc.bottom); return OnEraseBkgnd(hWnd, uMsg,reinterpret_cast<WPARAM>(memDC.m_hDC), lParam, bHandled); CATCH_THROW() }
void CProgressCtrlX::OnPaint() { CPaintDC dc(this); // device context for painting // TODO: Add your message handler code here CDrawInfo info; GetClientRect(&info.rcClient); // retrieve current position and range info.nCurPos = GetPos(); GetRange(info.nLower, info.nUpper); // Draw to memory DC CMemDC memDC(&dc); info.pDC = &memDC; // fill background if(m_pbrBk) memDC.FillRect(&info.rcClient, m_pbrBk); else memDC.FillSolidRect(&info.rcClient, m_clrBk); // apply borders info.rcClient.DeflateRect(m_rcBorders); // if current pos is out of range return if (info.nCurPos < info.nLower || info.nCurPos > info.nUpper) return; info.dwStyle = GetStyle(); BOOL fVert = info.dwStyle&PBS_VERTICAL; BOOL fSnake = info.dwStyle&PBS_SNAKE; BOOL fRubberBar = info.dwStyle&PBS_RUBBER_BAR; // calculate visible gradient width CRect rcBar(0,0,0,0); CRect rcMax(0,0,0,0); rcMax.right = fVert ? info.rcClient.Height() : info.rcClient.Width(); rcBar.right = (int)((float)(info.nCurPos-info.nLower) * rcMax.right / ((info.nUpper-info.nLower == 0) ? 1 : info.nUpper-info.nLower)); if(fSnake) rcBar.left = (int)((float)(m_nTail-info.nLower) * rcMax.right / ((info.nUpper-info.nLower == 0) ? 1 : info.nUpper-info.nLower)); // draw bar if(m_pbrBar) memDC.FillRect(&ConvertToReal(info, rcBar), m_pbrBar); else DrawMultiGradient(info, fRubberBar ? rcBar : rcMax, rcBar); // Draw text DrawText(info, rcMax, rcBar); // Do not call CProgressCtrl::OnPaint() for painting messages }
BOOL WZDlgSafeCenter::OnEraseBkgnd(CDC* pDC) { CRect rcClient; GetClientRect(rcClient); WTL::CMemoryDC memDC(pDC->GetSafeHdc(), rcClient); HBRUSH brush = AtlGetBackgroundBrush(GetSafeHwnd(), GetParent()->GetSafeHwnd()); memDC.FillRect(rcClient, brush); return TRUE; }
void CODStaticImageImpl::DrawItem (LPDRAWITEMSTRUCT lpdis) { if (!m_szImagePath.IsEmpty()) { RECT rcClient; GetClientRect(&rcClient); CDCHandle dc = lpdis->hDC; dc.SaveDC(); HBITMAP hBitmap, hOldBitmap; HPALETTE hPalette, hOldPalette; BITMAP bm; if( LoadBitmapFromBMPFile( m_szImagePath.LockBuffer(), &hBitmap, &hPalette ) ) { GetObject(hBitmap, sizeof(BITMAP), &bm); HDC hMemDC = CreateCompatibleDC(dc.m_hDC); hOldBitmap = (HBITMAP)SelectObject(hMemDC, hBitmap); hOldPalette = dc.SelectPalette(hPalette, FALSE); dc.RealizePalette(); dc.StretchBlt(rcClient.left, rcClient.top, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,\ hMemDC, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY ); SelectObject(hMemDC, hOldBitmap); DeleteObject(hBitmap); dc.SelectPalette(hOldPalette, FALSE); DeleteObject(hPalette); } m_szImagePath.UnlockBuffer(); dc.RestoreDC(-1); } else if (m_nBitmapId > 0) { RECT rcClient; GetClientRect(&rcClient); CDCHandle dc = lpdis->hDC; dc.SaveDC(); CBitmap bitmap; _U_STRINGorID id (m_nBitmapId); bitmap.LoadBitmap(id); CMemDC memDC(dc, &rcClient); memDC.SelectBitmap(bitmap.m_hBitmap); dc.RestoreDC(-1); } return; }
void CRTListCtrl::OnPaint() { int nmax; int npos; nmax = GetScrollLimit(SBS_VERT); m_Container.SetVerRange(0,nmax); npos = GetScrollPos(SBS_VERT); m_Container.SetVerPos(npos); nmax = GetScrollLimit(SBS_HORZ); m_Container.SetHorRange(0,nmax); npos = GetScrollPos(SBS_HORZ); m_Container.SetHorPos(npos); if(!m_bIsEnableSkin)return CListCtrl::OnPaint(); CRect rcArea; CRect rcWnd; GetClientRect(&rcWnd); rcArea = rcWnd; DWORD style = GetStyle(); if((style & LVS_NOCOLUMNHEADER) != LVS_NOCOLUMNHEADER && (style & LVS_REPORT) == LVS_REPORT) { if(IsWindow(m_HeaderCtrl.m_hWnd)) { CRect rtHeader; m_HeaderCtrl.GetWindowRect(&rtHeader); rcArea.top += rtHeader.Height(); } } CClientDC ptDC(this); CDC defDC; CMemDC memDC(&ptDC,rcArea); defDC.CreateCompatibleDC(&ptDC); CBitmap defBmp; CBitmap* defOld; defBmp.CreateCompatibleBitmap(&ptDC,rcWnd.Width(),rcWnd.Height()); defOld = defDC.SelectObject(&defBmp); DefWindowProc(WM_ERASEBKGND, (WPARAM)defDC.m_hDC , 0); DefWindowProc(WM_PAINT, (WPARAM)defDC.m_hDC , 0); CRTDraw::RTDrawBitmap(&memDC,rcArea,m_BackBitmap[BMP_BACK],m_BackBitmapDrawMode[BMP_BACK]); memDC.TransparentBlt(rcArea.left,rcArea.top,rcArea.Width(),rcArea.Height(),&defDC,rcArea.left,rcArea.top,rcArea.Width(),rcArea.Height(),GetSysColor(COLOR_WINDOW)); CPaintDC dc(this); defDC.SelectObject(defOld); }
int wxCodeCompletionBox::GetSingleLineHeight() const { wxBitmap bmp(1, 1); wxMemoryDC memDC(bmp); memDC.SetFont(m_ccFont); wxSize size = memDC.GetTextExtent("Tp"); int singleLineHeight = size.y + (2 * Y_SPACER) + 2; // the extra pixel is for the border line if(singleLineHeight < 16) { singleLineHeight = 16; // at least 16 pixels for image } return singleLineHeight; }
void Graphics::Render(HDC hdc) { zBuffer->Reset(); MemDC memDC(hdc, &stage); const char* info = "°´F1»ñÈ¡°ïÖú"; TextOut(memDC, 0, 0, info, strlen(info)); RenderList renderList; camera->RunPipeline(renderList, container); Plot(memDC, renderList); }
void EqualizerView::OnPaint() { CPaintDC dc(this); CRect rect; GetClientRect(&rect); CMemDC memDC(&dc, &rect); CRect clip; memDC.GetClipBox(&clip); memDC.FillSolidRect(clip, Globals::Preferences->GetBtnFaceColor()); DefWindowProc(WM_PAINT, (WPARAM)memDC->m_hDC, (LPARAM)0); }
void CPropPageFrameEx::OnPaint() { CPaintDC dc(this); CRect rect; GetClientRect(&rect); CMemDC memDC( &dc,&rect ); // Draw the background. DrawBackground( &memDC ); // Draw the title pane. Draw( &memDC ); }