本文整理汇总了C++中PrepareDC函数的典型用法代码示例。如果您正苦于以下问题:C++ PrepareDC函数的具体用法?C++ PrepareDC怎么用?C++ PrepareDC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PrepareDC函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetFocus
void RegRichTextCtrl::OnLeftClick( wxMouseEvent& event )
{
SetFocus();
wxClientDC dc(this);
PrepareDC(dc);
dc.SetFont(GetFont());
long position = 0;
int hit = GetBuffer().HitTest(dc, event.GetLogicalPosition(dc), position);
if (hit != wxRICHTEXT_HITTEST_NONE)
{
bool caretAtLineStart = false;
if (hit & wxRICHTEXT_HITTEST_BEFORE)
{
// If we're at the start of a line (but not first in para)
// then we should keep the caret showing at the start of the line
// by showing the m_caretAtLineStart flag.
wxRichTextParagraph* para = GetBuffer().GetParagraphAtPosition(position);
wxRichTextLine* line = GetBuffer().GetLineAtPosition(position);
if (line && para &&
line->GetAbsoluteRange().GetStart() == position
&& para->GetRange().GetStart() != position)
caretAtLineStart = true;
position--;
}
MoveCaret(position, caretAtLineStart);
SelectWord(GetCaretPosition());
}
}
示例2: dc
void ExplainCanvas::OnMouseMotion(wxMouseEvent &ev)
{
ev.Skip(true);
if (ev.Dragging())
return;
wxClientDC dc(this);
PrepareDC(dc);
wxPoint logPos(ev.GetLogicalPosition(dc));
double x, y;
x = (double) logPos.x;
y = (double) logPos.y;
// Find the nearest object
int attachment = 0;
ExplainShape *nearestObj = dynamic_cast<ExplainShape *>(FindShape(x, y, &attachment));
if (nearestObj)
{
ShowPopup(nearestObj);
}
}
示例3: dc
// This implements a tiny doodling program! Drag the mouse using the left
// button.
void MyCanvas::OnEvent(wxMouseEvent& event)
{
wxClientDC dc(this);
PrepareDC(dc);
wxPoint pt(event.GetLogicalPosition(dc));
static long xpos = -1;
static long ypos = -1;
if (xpos > -1 && ypos > -1 && event.Dragging())
{
dc.SetPen(*wxBLACK_PEN);
dc.DrawLine(xpos, ypos, pt.x, pt.y);
m_dirty = true;
}
else
{
event.Skip();
}
xpos = pt.x;
ypos = pt.y;
}
示例4: dc
void FortyCanvas::Redo()
{
wxClientDC dc(this);
PrepareDC(dc);
dc.SetFont(* m_font);
m_game->Redo(dc);
}
示例5: WXUNUSED
void wxGenericStaticText::OnPaint(wxPaintEvent& WXUNUSED(event))
{
if ( m_label.empty() )
return;
wxPaintDC dc(this);
PrepareDC(dc);
wxRect rect = GetClientRect();
if ( IsEnabled() )
{
dc.SetTextForeground(
wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
}
else // paint disabled text
{
// draw shadow of the text
dc.SetTextForeground(
wxSystemSettings::GetColour(wxSYS_COLOUR_BTNHIGHLIGHT));
wxRect rectShadow = rect;
rectShadow.Offset(1, 1);
dc.DrawLabel(m_label, rectShadow, GetAlignment(), m_mnemonic);
dc.SetTextForeground(
wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
}
dc.DrawLabel(m_label, wxNullBitmap, rect, GetAlignment(), m_mnemonic);
}
示例6: dc
void RulerMidi::OnPaint(wxPaintEvent &event)
{
wxPaintDC dc(this);
wxSize size;
wxString s;
double x;
long m;
PrepareDC(dc);
size = GetSize();
dc.SetPen(wxPen(CL_RULER_BACKGROUND, 1, wxSOLID));
dc.SetBrush(wxBrush(CL_RULER_BACKGROUND));
dc.SetTextForeground(CL_RULER_PATTERNNUM);
dc.DrawRectangle(0, 0, size.x, size.y);
dc.SetPen(wxPen(CL_RULER_FOREGROUND, 1, wxSOLID));
m = 0;
for (x = 0; (long) floor(x) < size.x; x += ROW_WIDTH * ZoomX)
{
if (!(m % 4))
{
s.Printf(wxT("%lu"), (long) (m / 4));
dc.DrawText(s, (int) floor(x) + 2, 0);
}
dc.DrawLine((int) floor(x), (m++ % 4) ? MIDI_RULER_HEIGHT - 8 : 0,
(int) floor(x), MIDI_RULER_HEIGHT);
}
}
示例7: WXUNUSED
// This calls OnDraw, having adjusted the origin according to the current
// scroll position
void wxScrolledWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
{
wxPaintDC dc(this);
PrepareDC(dc);
OnDraw(dc);
}
示例8: dc
void CStandardApertureViewStatic::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
// Do not call CStatic::OnPaint() for painting messages
//CRect clientRect;
//GetClientRect(&clientRect);
//dc.Ellipse(&clientRect);
CCEtoODBDoc* doc = getCamCadDoc();
CCamCadDocGraph camCadDocGraph(doc);
if (m_camCadFrame != NULL)
{
PrepareDC(&dc);
HBRUSH hBrush = CreateSolidBrush(doc->getSettings().Foregrnd);
HBRUSH oldBrush = (HBRUSH) SelectObject(dc.m_hDC, hBrush);
CRect clientRect;
GetClientRect(&clientRect);
dc.DPtoLP(&clientRect);
dc.Rectangle(&clientRect);
//dc.Rectangle(doc->minXCoord, doc->minYCoord, doc->maxXCoord, doc->maxYCoord);
DeleteObject(SelectObject(dc.m_hDC, oldBrush));
Draw(&dc);
}
}
示例9: WXUNUSED
void csCanvas::OnEndDragLeft(double x, double y, int WXUNUSED(keys))
{
ReleaseMouse();
wxClientDC dc(this);
PrepareDC(dc);
// Select all images within the rectangle
float min_x, max_x, min_y, max_y;
min_x = wxMin(x, sg_initialX);
max_x = wxMax(x, sg_initialX);
min_y = wxMin(y, sg_initialY);
max_y = wxMax(y, sg_initialY);
wxObjectList::compatibility_iterator node = GetDiagram()->GetShapeList()->GetFirst();
while (node)
{
wxShape *shape = (wxShape *)node->GetData();
if (shape->GetParent() == NULL && !shape->IsKindOf(CLASSINFO(wxControlPoint)))
{
float image_x = shape->GetX();
float image_y = shape->GetY();
if (image_x >= min_x && image_x <= max_x &&
image_y >= min_y && image_y <= max_y)
{
shape->Select(true, &dc);
GetView()->SelectShape(shape, true);
}
}
node = node->GetNext();
}
}
示例10: context
/*****************************************************
**
** BasicWidget --- OnPaint
**
******************************************************/
void BasicWidget::OnPaint( wxPaintEvent &event )
{
int vx, vy;
wxPaintDC context( this );
PrepareDC( context );
wxRegionIterator upd( GetUpdateRegion());
if ( upd ) refreshRect = upd.GetRect();
while ( ++upd )
{
refreshRect.Union( upd.GetRect() );
}
GetViewStart( &vx, &vy );
if ( vx || vy )
{
refreshRect.x += vx;
refreshRect.y += vy;
}
assert( painter == 0 );
painter = new DcPainter( &context );
doPaint();
delete painter;
painter = 0;
}
示例11: dc
void customWindowLeft::recalculateComponentsSizes() {
wxClientDC dc( this );
PrepareDC( dc );
m_parent->PrepareDC( dc );
m_config->widowLeftWidth = m_drawing->setHeaderWidth( dc );
m_drawing->setCellHeight( dc );
}
示例12: PrepareDC
void wxListBox::DoDraw(wxControlRenderer *renderer)
{
// adjust the DC to account for scrolling
wxDC& dc = renderer->GetDC();
PrepareDC(dc);
dc.SetFont(GetFont());
// get the update rect
wxRect rectUpdate = GetUpdateClientRect();
int yTop, yBottom;
CalcUnscrolledPosition(0, rectUpdate.GetTop(), NULL, &yTop);
CalcUnscrolledPosition(0, rectUpdate.GetBottom(), NULL, &yBottom);
// get the items which must be redrawn
wxCoord lineHeight = GetLineHeight();
size_t itemFirst = yTop / lineHeight,
itemLast = (yBottom + lineHeight - 1) / lineHeight,
itemMax = m_strings->GetCount();
if ( itemFirst >= itemMax )
return;
if ( itemLast > itemMax )
itemLast = itemMax;
// do draw them
wxLogTrace(_T("listbox"), _T("Repainting items %d..%d"),
itemFirst, itemLast);
DoDrawRange(renderer, itemFirst, itemLast);
}
示例13: dc
void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
{
wxPaintDC dc( this );
PrepareDC( dc );
DrawShapes(dc);
}
示例14: WXUNUSED
void wxGenericStaticBitmap::OnPaint(wxPaintEvent& WXUNUSED(event))
{
wxPaintDC dc(this);
PrepareDC(dc);
if (m_bitmap.Ok())
dc.DrawBitmap(m_bitmap, 0, 0, true);
}
示例15: PaintDC
void wxsDrawingWindow::OnPaint(wxPaintEvent& event)
{
if ( !m_DuringFetch )
{
wxPaintDC PaintDC(this);
PrepareDC(PaintDC);
if ( m_IsBlockFetch || NoNeedToRefetch() )
{
if ( m_Bitmap )
{
wxBitmap BmpCopy = m_Bitmap->GetSubBitmap(wxRect(0,0,m_Bitmap->GetWidth(),m_Bitmap->GetHeight()));
wxBufferedDC DC(&PaintDC,BmpCopy);
PaintExtra(&DC);
}
}
else
{
StartFetchingSequence();
}
}
else
{
event.Skip();
}
}