Working through the zetcode wxwidgets tutorial:Device Contexts:Simple Line

If anyone besides myself is reading this blog will notice that I’m blowing off to pieces of sample code..

Basically, I’m ignoring (for now)

  • zetcode:widgets II: scrolled window
  • zetcode:drag and drop.

I don’t tend to use that stuff in my vb6 stuff and I’m running out of fun free time. I was looking at the code for the drag and drop and I don’t want to invest the time to understand whats going on there for the moment.

That brings me to simple line.

This code is actually pretty easy..

#include “Line.h”

Line::Line(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(280, 180))
this->Connect(wxEVT_PAINT, wxPaintEventHandler(Line::OnPaint));

void Line::OnPaint(wxPaintEvent& event)
wxPaintDC dc(this);

wxCoord x1 = 50, y1 = 60;
wxCoord x2 = 190, y2 = 60;

dc.DrawLine(x1, y1, x2, y2);

“OnPaint” fires on a resize event.
The thing that struck me a curious is the wxCoord’s.
This is an interesting post that explains it
This seems very straight forward on to the next item.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *