[wxruby-users] how can I use draw line in wxruby??
Alex Fenton
alex at pressure.to
Wed Jan 2 10:30:19 EST 2008
Mario Steele wrote:
> Unfortunately, you cannot instantiate the DC (Device Context) directly
> from the DC Class. You need to utilize Window#draw or Window#paint to
> create a DC. The difference between these two methods, is that when
> you are in a paint event (EG: evt_paint), you utilize the Window#paint
> method to acquire a Device Context. When your outside of the paint
> event, you utilize Window#draw to acquire the Device Context.
Just a quick follow-up; Mario's quite right that you use the
Window#paint method to acquire a DeviceContext to do drawing. It is
recommended that this is within an evt_paint handler which means that
drawing will only be done when necessary. The sample image/images.rb is
probably the simplest example to look at.
However, there isn't a "draw" method as far as I know. "paint" is used
in all circumstances, but the exact type of DC will be different
dependent on the, um, context. But there will be no functional difference
hth
alex
More information about the wxruby-users
mailing list