本文整理汇总了C++中wxDC::DrawLine方法的典型用法代码示例。如果您正苦于以下问题:C++ wxDC::DrawLine方法的具体用法?C++ wxDC::DrawLine怎么用?C++ wxDC::DrawLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxDC
的用法示例。
在下文中一共展示了wxDC::DrawLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoDrawBottomScrollButton
void wxCodeCompletionBox::DoDrawBottomScrollButton(wxDC& dc)
{
wxRect scrollRect = m_scrollArea;
scrollRect.Deflate(0, 2);
scrollRect.SetWidth(scrollRect.GetWidth() - 2);
// Separate the scrollbar area into 2 big buttons: up and down
m_scrollBottomRect =
wxRect(wxPoint(scrollRect.GetTopLeft().x, scrollRect.GetTopLeft().y + scrollRect.GetHeight() / 2),
wxSize(scrollRect.GetWidth(), scrollRect.GetHeight() / 2));
#if 0
wxPoint topRight;
topRight = m_scrollBottomRect.GetTopRight();
topRight.x += 1;
dc.SetPen(m_lightBorder);
dc.DrawLine(m_scrollBottomRect.GetTopLeft(), topRight);
#endif
// Draw the up arrow
wxCoord x, y;
x = m_scrollBottomRect.x + ((m_scrollBottomRect.GetWidth() - m_bmpDown.GetWidth()) / 2);
y = m_scrollBottomRect.y + m_scrollBottomRect.GetHeight() - (2 * m_bmpDown.GetHeight());
wxBitmap bmp = CanScrollDown() ? m_bmpDownEnabled : m_bmpDown;
dc.DrawBitmap(bmp, x, y);
}
示例2: DoDrawTopScrollButton
void wxCodeCompletionBox::DoDrawTopScrollButton(wxDC& dc)
{
wxRect scrollRect = m_scrollArea;
scrollRect.Deflate(0, 2);
scrollRect.SetWidth(scrollRect.GetWidth() - 2);
// Separate the scrollbar area into 2 big buttons: up and down
m_scrollTopRect = wxRect(scrollRect.GetTopLeft(), wxSize(scrollRect.GetWidth(), scrollRect.GetHeight() / 2));
#if 0
wxPoint bottomRight;
bottomRight = m_scrollTopRect.GetBottomRight();
bottomRight.x += 1;
dc.SetPen(m_darkBorder);
dc.DrawLine(m_scrollTopRect.GetBottomLeft(), bottomRight);
#endif
// Draw the up arrow
wxCoord x, y;
x = m_scrollTopRect.x + ((m_scrollTopRect.GetWidth() - m_bmpUp.GetWidth()) / 2);
y = m_scrollTopRect.y + m_bmpUp.GetHeight();
wxBitmap bmp = CanScrollUp() ? m_bmpUpEnabled : m_bmpUp;
dc.DrawBitmap(bmp, x, y);
}
示例3: PaintMarkers
void AudioDisplay::PaintMarkers(wxDC &dc, TimeRange updtime)
{
AudioMarkerVector markers;
controller->GetTimingController()->GetMarkers(updtime, markers);
if (markers.empty()) return;
wxDCPenChanger pen_retainer(dc, wxPen());
wxDCBrushChanger brush_retainer(dc, wxBrush());
for (const auto marker : markers)
{
int marker_x = RelativeXFromTime(marker->GetPosition());
dc.SetPen(marker->GetStyle());
dc.DrawLine(marker_x, audio_top, marker_x, audio_top+audio_height);
if (marker->GetFeet() == AudioMarker::Feet_None) continue;
dc.SetBrush(wxBrush(marker->GetStyle().GetColour()));
dc.SetPen(*wxTRANSPARENT_PEN);
if (marker->GetFeet() & AudioMarker::Feet_Left)
PaintFoot(dc, marker_x, -1);
if (marker->GetFeet() & AudioMarker::Feet_Right)
PaintFoot(dc, marker_x, 1);
}
}
示例4: DrawPanelBorder
void wxRibbonMetroArtProvider::DrawPanelBorder(wxDC& dc, const wxRect& rect,
wxPen& primary_colour,
wxPen& secondary_colour)
{
dc.SetPen(m_panel_border_pen);
dc.DrawLine(rect.GetTopRight(), rect.GetBottomRight());
}
示例5: Draw
void GroupVisual::Draw ( wxDC& dc, InstanceCtrl* parent, wxRect limitingRect, bool hasSelection, int selectionIndex, bool hasFocus, int focusIndex, bool highlight )
{
int i;
int count = items.size();
int style = 0;
wxRect rect;
// Draw the header
if(!no_header)
{
wxColour textColor = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
if (highlight)
{
textColor = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
}
wxBrush brush(textColor);
wxPen pen(textColor);
dc.SetBrush(brush);
dc.SetPen(pen);
wxSize sz = dc.GetTextExtent(GetName());
dc.SetTextForeground(textColor);
dc.DrawText( GetName() , 20, y_position + 5 );
int atheight = y_position + header_height / 2;
if(sz.x + 30 < limitingRect.width - 10)
dc.DrawLine(sz.x + 30,atheight, limitingRect.width - 10, atheight);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.SetPen(textColor);
// Ungrouped can't be hidden, so don't draw the box.
if (m_group)
{
dc.DrawRectangle(5,atheight -5, 10,10);
dc.DrawRectangle(7,atheight -1, 6,2);
if(!IsExpanded())
{
dc.DrawRectangle(9,atheight -3, 2,6);
}
}
}
if(IsExpanded()) for (i = 0; i < count; i++)
{
parent->GetItemRect(VisualCoord(index,i), rect, false);
if (!limitingRect.Intersects(rect))
continue;
style = 0;
if (hasSelection && selectionIndex == i)
style |= wxINST_SELECTED;
if (hasFocus && i == focusIndex)
style |= wxINST_IS_FOCUS;
InstanceVisual& item = items[i];
item.Draw(dc, parent, rect, style);
}
}
示例6: Draw
void wxGridCellIconRenderer::Draw(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc,
const wxRect& rectCell, int row, int col, bool isSelected)
{
wxGridCellRenderer::Draw(grid, attr, dc, rectCell, row, col, isSelected);
const char** psz=NULL;
// if (grid.GetCellValue(row, col) == wxT("IDI_PC"))
// psz = szIconPC;
// else psz = szIconNomad;
wxIcon icon(psz);
icon.SetHeight(16);
icon.SetWidth(16);
// wxColour colourBackGround = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_BTNFACE);
// dc.SetBrush(wxBrush(colourBackGround, wxSOLID));
// dc.SetPen(wxPen(colourBackGround, 1, wxSOLID));
// dc.DrawRectangle(rectCell);
int nMargin = (rectCell.GetHeight() - icon.GetHeight()) /2;
if (nMargin < 0) nMargin = 0;
dc.DrawIcon(icon, rectCell.x, rectCell.y+nMargin);
if (m_border == wxLAYOUT_TOP)
{
dc.SetPen(wxPen(*wxBLACK, 1, wxDOT));
dc.DrawLine(rectCell.GetRight(), rectCell.GetTop(),
rectCell.GetLeft(), rectCell.GetTop());
}
// dc.DrawIcon(icon, 16, 0);
}
示例7: drawTopLine
void SeqABI::drawTopLine ( wxDC &dc , int y )
{
wxPen p = dc.GetPen () ;
dc.SetPen(*wxLIGHT_GREY_PEN);
dc.DrawLine ( 4 , y , minx + maxx , y ) ;
dc.SetPen(p);
}
示例8: DrawRowLabel
void CustomGrid::DrawRowLabel( wxDC& dc, int row )
{
//init dc font and colours
dc.SetFont( m_labelFont );
dc.SetPen(GetDefaultGridLinePen());
dc.SetBrush( wxBrush( m_labelBackgroundColour, wxBRUSHSTYLE_SOLID ) );
int w = dc.GetTextExtent(_T("Speed")).x;
wxString label1,label2;
label1 = GetRowLabelValue(row).BeforeFirst(',', &label2);
bool pline = true;
//row is the first of 3 for the same parameter (wind ... waves ...)
if(GetNumberRows() > row + 2 && label1 == GetRowLabelValue(row + 2).BeforeFirst(',')){
pline = false;
if(IsRowVisible(row + 2))
label1 = _T(" ");
}
//row is the second of 3 or the first of 2
else if(GetNumberRows() > row + 1 && label1 == GetRowLabelValue(row + 1).BeforeFirst(',')){
pline = false;
if(row > 0 && label1 == GetRowLabelValue(row - 1).BeforeFirst(',')){ //second of 3
if(!IsRowVisible(row + 1))
label1 = _T(" ");
}
}
//row is the last of 3
else if(row > 1 && label1 == GetRowLabelValue(row - 2).BeforeFirst(',')){
if(IsRowVisible(row - 1))
label1 = _T(" ");
}
//row is the last of 2
else if(row > 0 && label1 == GetRowLabelValue(row - 1).BeforeFirst(',')){
if(IsRowVisible(row - 1))
label1 = _T(" ");
}
//draw first part of the label
wxRect aRect(5, GetRowTop(row), m_rowLabelWidth - w, GetRowHeight(row));
dc.DrawLabel(label1, aRect, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
//draw second part of the label
wxRect bRect(m_rowLabelWidth - w, GetRowTop(row), w, GetRowHeight(row));
dc.SetFont( wxFont(m_labelFont).Scale(0.85) );
dc.DrawLabel(label2 , bRect, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL);
//draw row lines around labels
if(pline)
dc.DrawLine(0, GetRowBottom(row) - 1, m_rowLabelWidth, GetRowBottom(row) - 1);
dc.DrawLine(0, GetRowTop(row), 0, GetRowBottom(row) );
dc.DrawLine(m_rowLabelWidth - 1, GetRowTop(row), m_rowLabelWidth - 1, GetRowBottom(row) );
}
示例9: draw_key
void Plotter::draw_key(wxDC& dc){
// if no data, don't draw tic marks
if( this->values.size() == 0 )
return;
int x0 = this->panel_width - this->margin_x - 100;
int y0 = this->margin_y_upper + 10;
if( this->key_location==KEY_UPPER_RIGHT){
x0 = this->panel_width - this->margin_x - 100;
y0 = this->margin_y_upper + 10;
}
else if(this->key_location==KEY_UPPER_LEFT){
x0 = this->margin_x + 50;
y0 = this->margin_y_upper + 10;
}
else if(this->key_location==KEY_LOWER_RIGHT){
x0 = this->panel_width - this->margin_x - 100;
y0 = this->panel_height - this->margin_y_lower - 100;
}
else if(this->key_location==KEY_LOWER_LEFT){
x0 = this->margin_x + 50;
y0 = this->panel_height - this->margin_y_lower - 100;
}
int y_cur = y0;
dc.SetFont(wxFont(8,wxFONTFAMILY_SWISS,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_BOLD));
for(int i=0; i<(int)this->value_labels.size(); i++){
dc.DrawText( wxString::FromAscii(this->value_labels.at(i).c_str()), x0, y_cur);
wxPen pen(*this->colors.at( i % (int)this->colors.size() ));
pen.SetWidth(6);
dc.SetPen(pen);
if(i>=(int)this->colors.size()){
pen.SetWidth(3);
dc.DrawLine(x0-15, y_cur+5, x0-14, y_cur+5);
dc.DrawLine(x0-7,y_cur+5, x0-5, y_cur+5);
}
else
dc.DrawLine(x0-15, y_cur+5, x0-5, y_cur+5);
y_cur += 10;
}
wxPen pen(*wxBLACK_PEN);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.SetPen(pen);
dc.DrawRectangle(x0-25, y0-5, 150, y_cur - y0 + 10 );
}
示例10: DrawTags
//Disegna i tag impostati
void kwxLinearReg::DrawTags(wxDC &dc)
{
int ntag = 0 ;
int w, h ;
int tw,th;
int scalval = 0 ;
double tcoeff ;
wxString text ;
if(m_aTagsVal==NULL)
return;
GetClientSize(&w,&h);
if((!(m_iStyle&STYLE_VERTICAL)))
tcoeff = (w - 2) / (double)(m_iMax - m_iMin);
else
tcoeff = (h - 2) / (double)(m_iMax - m_iMin);
dc.SetPen(*wxThePenList->FindOrCreatePen(m_cTagsColour, 1, wxSOLID));
dc.SetBrush(*wxTheBrushList->FindOrCreateBrush(m_cTagsColour,wxSOLID));
dc.SetTextForeground(m_cTagsColour);
while (ntag < m_iTagsCount)
{
scalval = (int)floor((m_aTagsVal[ ntag] - m_iMin) * tcoeff);// \todo: need floor ?
text.Printf("%d", m_aTagsVal[ ntag]) ;
if(m_iStyle & STYLE_VERTICAL)
{
dc.DrawLine(w - 2, h - scalval , w - TAGS_LENGTH , h - scalval);
if(m_iStyle & STYLE_DRAW_TAG_NUMBERS){
dc.GetTextExtent(text, &tw, &th);
dc.DrawText(text, w - TAGS_LENGTH - tw, h - scalval - (th / 2) );
}
}
else
{
dc.DrawLine(scalval + 1, h - 2 , scalval + 1, h - TAGS_LENGTH);
if(m_iStyle & STYLE_DRAW_TAG_NUMBERS){
dc.GetTextExtent(text, &tw, &th);
dc.DrawText(text, scalval + 1 - (tw / 2 ), h - TAGS_LENGTH - th);
}
}
ntag++ ;
}
}
示例11: DrawProgressBar
void CStatusLineCtrl::DrawProgressBar(wxDC& dc, int x, int y, int height, int bar_split, int permill)
{
wxASSERT(bar_split != -1);
wxASSERT(permill != -1);
// Draw right part
dc.SetPen(*wxTRANSPARENT_PEN);
dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
dc.DrawRectangle(x + 1 + bar_split, y + 1, PROGRESSBAR_WIDTH - bar_split - 1, height - 2);
if (bar_split && height > 2)
{
// Draw pretty gradient
int greenmin = 128;
int greenmax = 255;
int colourCount = ((height + 1) / 2);
for (int i = 0; i < colourCount; i++)
{
int curGreen = greenmax - ((greenmax - greenmin) * i / (colourCount - 1));
dc.SetPen(wxPen(wxColour(0, curGreen, 0)));
dc.DrawLine(x + 1, y + colourCount - i, x + 1 + bar_split, y + colourCount - i);
dc.DrawLine(x + 1, y + height - colourCount + i - 1, x + 1 + bar_split, y + height - colourCount + i - 1);
}
}
dc.SetPen(*wxBLACK_PEN);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawRectangle(x, y, PROGRESSBAR_WIDTH, height);
// Draw percentage-done text
wxString prefix;
if( permill > 1000)
{
prefix = _T("> ");
permill = 1000;
}
wxString text = wxString::Format(_T("%s%d.%d%%"), prefix.c_str(), permill / 10, permill % 10);
wxCoord w, h;
dc.GetTextExtent(text, &w, &h);
dc.DrawText(text, x + PROGRESSBAR_WIDTH / 2 - w / 2, y + height / 2 - h / 2);
}
示例12: Line
//
// Draw a line while accounting for differences in wxWidgets versions
//
void AColor::Line(wxDC & dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
{
// As of 2.8.9 (possibly earlier), wxDC::DrawLine() on the Mac draws the
// last point since it is now based on the NEW wxGraphicsContext system.
// Make the other platforms do the same thing since the other platforms
// "may" follow they get wxGraphicsContext going.
#if defined(__WXMAC__) || defined(__WXGTK3__)
dc.DrawLine(x1, y1, x2, y2);
#else
bool point = false;
if (x1 == x2) {
if (y1 < y2) {
y2++;
}
else if (y2 < y1) {
y1++;
}
else {
point = true;
}
}
else if (y1 == y2) {
if (x1 < x2) {
x2++;
}
else if (x2 < x1) {
x1++;
}
else {
point = true;
}
}
else {
dc.DrawPoint(x2, y2);
}
if (point) {
dc.DrawPoint(x2, y2);
}
else {
dc.DrawLine(x1, y1, x2, y2);
}
#endif
}
示例13: PaintShapes
void TestScrollWinCanvas::PaintShapes(wxDC& dc)
{
TemplateCanvas::PaintShapes(dc);
dc.SetPen(*wxBLACK_PEN);
dc.SetBrush(*wxRED_BRUSH);
dc.SetTextForeground(*wxBLACK);
dc.SetTextBackground(wxTransparentColor); // new const in wxWidgets 2.9.1
dc.SetFont(*wxSMALL_FONT);
int y=10;
int dy=20;
int i=0;
dc.DrawLine(30,30, 250,15);
dc.DrawText("*wxSMALL_FONT", 10, y+(dy*i++));
dc.SetFont(*wxNORMAL_FONT);
dc.DrawText("*wxNORMAL_FONT", 10, y+(dy*i++));
dc.SetFont(wxSystemSettings::GetFont(wxSYS_ANSI_VAR_FONT));
dc.DrawText("GetFont(wxSYS_ANSI_VAR_FONT)", 10, y+(dy*i++));
dc.SetFont(wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT));
dc.DrawText("GetFont(wxSYS_SYSTEM_FONT)", 10, y+(dy*i++));
wxFont f1(8, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
dc.SetFont(f1);
dc.DrawText("8, wxFONTFAMILY_SWISS", 10, y+(dy*i++));
wxFont f1_1(9, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
dc.SetFont(f1_1);
dc.DrawText("9, wxFONTFAMILY_SWISS", 10, y+(dy*i++));
wxFont f2(10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
dc.SetFont(f2);
dc.DrawText("10, wxFONTFAMILY_SWISS", 10, y+(dy*i++));
wxFont f3(11, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
dc.SetFont(f3);
dc.DrawText("11, wxFONTFAMILY_SWISS", 10, y+(dy*i++));
wxFont f4(12, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
dc.SetFont(f4);
dc.DrawText("12, wxFONTFAMILY_SWISS", 10, y+(dy*i++));
wxFont f5(14, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
dc.SetFont(f5);
dc.DrawText("14, wxFONTFAMILY_SWISS", 10, y+(dy*i++));
f5.SetPointSize(16);
dc.SetFont(f5);
dc.DrawText("16, wxFONTFAMILY_SWISS", 10, y+(dy*i++));
f5.SetPixelSize(wxSize(0,15));
dc.SetFont(f5);
dc.DrawText("SetPixelSize(0,15), wxFONTFAMILY_SWISS", 10, y+(dy*i++));
f5.SetPixelSize(wxSize(0,10));
dc.SetFont(f5);
dc.DrawText("SetPixelSize(0,10), wxFONTFAMILY_SWISS", 10, y+(dy*i++));
f5.SetPixelSize(wxSize(0,20));
dc.SetFont(f5);
dc.DrawText("SetPixelSize(0,20), wxFONTFAMILY_SWISS", 10, y+(dy*i++));
dc.SetFont(*GdaConst::small_font);
dc.DrawText("*GdaConst::small_font", 10, y+(dy*i++));
dc.SetFont(*GdaConst::medium_font);
dc.DrawText("*GdaConst::medium_font", 10, y+(dy*i++));
dc.SetTextForeground(GdaConst::selectable_fill_color);
dc.SetFont(*GdaConst::large_font);
dc.DrawText("*GdaConst::large_font", 10, y+(dy*i++));
}
示例14: DrawRowLabel
void wxGridCtrl::DrawRowLabel(wxDC& dc, int row)
{
if (GetRowHeight(row) <= 0 || m_rowLabelWidth <= 0)
return;
wxRect rect;
int rowTop = GetRowTop(row), rowBottom = GetRowBottom(row) - 1;
dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW), 1, wxSOLID));
dc.DrawLine(m_rowLabelWidth - 1, rowTop, m_rowLabelWidth - 1, rowBottom);
dc.DrawLine(0, rowTop, 0, rowBottom);
dc.DrawLine(0, rowBottom, m_rowLabelWidth, rowBottom);
dc.SetPen(*wxWHITE_PEN);
dc.DrawLine(1, rowTop, 1, rowBottom);
dc.DrawLine(1, rowTop, m_rowLabelWidth - 1, rowTop);
if (row == GetGridCursorRow())
{
dc.DrawBitmap(wxBitmap(small_arrow_xpm), 0, GetRowTop(row), true);
}
}
示例15: FinaliseBackground
void clTabRendererClassic::FinaliseBackground(wxWindow* parent, wxDC& dc, const wxRect& clientRect,
const clTabColours& colours, size_t style)
{
wxUnusedVar(parent);
clTabColours c = colours;
if(DrawingUtils::IsDark(c.activeTabBgColour)) {
InitDarkColours(c, c.activeTabBgColour);
} else {
InitLightColours(c, c.activeTabBgColour);
}
dc.SetPen(c.activeTabPenColour);
if(style & kNotebook_BottomTabs) {
dc.DrawLine(clientRect.GetTopLeft(), clientRect.GetTopRight());
} else {
dc.DrawLine(clientRect.GetBottomLeft(), clientRect.GetBottomRight());
}
}