void COleControl::ExchangeStockProps(CPropExchange* pPX) { BOOL bLoading = pPX->IsLoading(); DWORD dwStockPropMask = GetStockPropMask(); DWORD dwPersistMask = dwStockPropMask; PX_ULong(pPX, _T("_StockProps"), dwPersistMask); if (dwStockPropMask & (STOCKPROP_CAPTION | STOCKPROP_TEXT)) { CString strText; if (dwPersistMask & (STOCKPROP_CAPTION | STOCKPROP_TEXT)) { if (!bLoading) strText = InternalGetText(); if (dwStockPropMask & STOCKPROP_CAPTION) PX_String(pPX, _T("Caption"), strText, _T("")); if (dwStockPropMask & STOCKPROP_TEXT) PX_String(pPX, _T("Text"), strText, _T("")); } if (bLoading) { TRY SetText(strText); END_TRY } }
void CRTreeCtrl::OnDraw( CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid) { // draw the funky piccy m_pic.Render(pdc, rcBounds, rcBounds); // draw a box and fill it with text. // the zoom function will alter the font and box dimensions CFont* pOldFont; TEXTMETRIC tm; const CString& strCaption = InternalGetText(); // Set the ForeColor property color and transparent background mode into the device context pdc->SetTextColor(TranslateColor(GetForeColor())); pdc->SetBkMode(TRANSPARENT); // Draw the caption using the stock Font and ForeColor properties pOldFont = SelectStockFont(pdc); pdc->GetTextMetrics(&tm); pdc->SetTextAlign(TA_LEFT | TA_TOP); int gapsize; int gapsize2; int ydistance; int xdistance=0; int index=0; char* buffer; CRect rect; for (int x=0;x<m_lDepth;x++) { gapsize=(int)(pow(2,x)-1)*m_lBoxHeight; ydistance=gapsize/2; gapsize2=(int)(pow(2,x-2)*m_lBoxHeight); for (int y=0;y<pow(2,m_lDepth-x-1);y++) { rect=CRect(xdistance,ydistance,xdistance+m_lBoxWidth,ydistance+m_lBoxHeight); buffer=(char*)GetText(index); if (buffer!=NULL) pdc->ExtTextOut(rect.left+2, rect.top+2, ETO_CLIPPED, CRect(rect.left+2,rect.top+2,rect.right-2,rect.bottom-2), buffer, strlen(buffer), NULL); pdc->DrawEdge(rect,EDGE_ETCHED,BF_RECT); index++; if (x>0) { pdc->MoveTo(xdistance-m_lGapWidth,ydistance+(m_lBoxHeight/2)+gapsize2); pdc->LineTo(xdistance,ydistance+(m_lBoxHeight/2)); pdc->MoveTo(xdistance-m_lGapWidth,ydistance+(m_lBoxHeight/2)-gapsize2); pdc->LineTo(xdistance,ydistance+(m_lBoxHeight/2)); } ydistance+=gapsize+m_lBoxHeight; } xdistance+=m_lBoxWidth+m_lGapWidth; } pdc->SelectObject(pOldFont); }
void CREditCtrl::OnDraw( CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid) { m_bDisabled = !GetEnabled(); CRect rc = rcBounds; CWnd* parent; CFont* pOldFont; if (m_hWnd) parent=GetParent(); if (m_hWnd) pOldFont = pdc->SelectObject((CFont*)parent->SendMessage(WM_GETGLOBALFONT,abs(m_FontNum),NULL)); else pOldFont = pdc->GetCurrentFont(); if (m_curPos==INT_MAX) { m_curPos=InternalGetText().GetLength(); m_curPoint=pdc->GetTextExtent(InternalGetText()).cx; // if (m_hWnd) // { // partwork = (CBitmap*)this->GetParent()->SendMessage(WM_GETARTWORK,NULL,NULL); // if(partwork) // { // partwork->GetBitmap(&artworkinfo); // } // } } if (m_curPoint-(rc.Width()/2)<m_scrollPoint) m_scrollPoint=max(m_curPoint-(rc.Width()/2),0); if (m_curPoint-rc.Width()+4>m_scrollPoint) m_scrollPoint=m_curPoint-rc.Width()+4; long offsetx; long offsety; if (m_hWnd) { long offsets; offsets=parent->SendMessage(WM_GETXYOFFSET,NULL,NULL); CRect rect; this->GetWindowRect(rect); CRect parentrect; parent->GetWindowRect(parentrect); offsetx=short(offsets & 0x0000FFFF)+parentrect.left-rect.left; offsety=short((offsets & 0xFFFF0000)>>16)+parentrect.top-rect.top; } else {
void CRTitleCtrl::OnDraw( CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid) { // TODO: Replace the following code with your own drawing code. pdc->FillRect(rcBounds, CBrush::FromHandle((HBRUSH)GetStockObject(WHITE_BRUSH))); CRect rc = rcBounds; CFont* pOldFont; TEXTMETRIC tm; const CString& strCaption = InternalGetText(); // Set the ForeColor property color and transparent background mode into the device context pdc->SetTextColor(TranslateColor(GetForeColor())); pdc->SetBkMode(TRANSPARENT); // Draw the caption using the stock Font and ForeColor properties pOldFont = SelectStockFont(pdc); pdc->GetTextMetrics(&tm); pdc->SetTextAlign(TA_CENTER | TA_TOP); pdc->ExtTextOut((rc.left + rc.right) / 2, 0, ETO_CLIPPED, rc, strCaption, strCaption.GetLength(), NULL); pdc->SelectObject(pOldFont); }
void CCircCtrl::OnDraw( CDC* pdc, const CRect& rcBounds, const CRect&) { CBrush* pOldBrush; CBrush bkBrush(TranslateColor(GetBackColor())); CPen* pOldPen; CRect rc = rcBounds; CFont* pOldFont; TEXTMETRIC tm; const CString& strCaption = InternalGetText(); // Set the ForeColor property color and transparent background mode into the device context pdc->SetTextColor(TranslateColor(GetForeColor())); pdc->SetBkMode(TRANSPARENT); // Paint the background using the BackColor property pdc->FillRect(rcBounds, &bkBrush); // Draw the ellipse using the BackColor property and a black pen GetDrawRect(&rc); pOldBrush = pdc->SelectObject(&bkBrush); pOldPen = (CPen*)pdc->SelectStockObject(BLACK_PEN); pdc->Ellipse(rc); // Draw the caption and note using the stock Font and ForeColor properties pOldFont = SelectStockFont(pdc); GetStockTextMetrics(&tm); pdc->SetTextAlign(TA_CENTER | TA_TOP); pdc->ExtTextOut((rc.left + rc.right) / 2, (rc.top + rc.bottom - tm.tmHeight) / 2, ETO_CLIPPED, rc, strCaption, strCaption.GetLength(), NULL); pdc->SetTextAlign(TA_LEFT | TA_TOP); pdc->ExtTextOut(rcBounds.left, rcBounds.top, ETO_CLIPPED, rcBounds, m_note, m_note.GetLength(), NULL); pdc->SelectObject(pOldFont); pdc->SelectObject(pOldPen); pdc->SelectObject(pOldBrush); }
LRESULT CPushCtrl::OnOcmCommand(WPARAM wParam, LPARAM lParam) { #ifdef _WIN32 lParam; WORD wNotifyCode = HIWORD(wParam); #else wParam; WORD wNotifyCode = HIWORD(lParam); #endif switch (wNotifyCode) { case BN_CLICKED: // Fire custom click event, sending caption CString strCaption = InternalGetText(); FireCustomClick(strCaption, (short) strCaption.GetLength()); break; } return 0; }