Hello Bass Guitar,<br><br>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.
<br><br>An Example of inside an paint event would be this:<br><br>evt_paint() do<br> self.paint do |dc|<br> dc.draw_line(50, 50, 100, 100)<br> end<br>end<br><br>And an example of how to draw outside of a paint event:
<br><br>def run_draw()<br> self.draw do |dc|<br> dc.draw_line(50, 50, 100, 100)<br> end<br>end<br><br>Once you implement this, it will work.<br><br>L8ers,<br><br>Mario Steele<br><br><div><span class="gmail_quote">On 1/2/08,
<b class="gmail_sendername">Bass Guitar</b> <<a href="mailto:lists@ruby-forum.com">lists@ruby-forum.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I use<br><br>dc = DC.new()<br>dc.draw_line(50, 50, 100, 100)<br><br>but it can't be compiled<br>I don't know how to declare DC variable??<br>in <a href="http://wxruby.rubyforge.org/doc/dc.html">http://wxruby.rubyforge.org/doc/dc.html
</a><br>it don't tell me how to declare now variable<br>plese tell me :'(<br>--<br>Posted via <a href="http://www.ruby-forum.com/">http://www.ruby-forum.com/</a>.<br>_______________________________________________
<br>wxruby-users mailing list<br><a href="mailto:wxruby-users@rubyforge.org">wxruby-users@rubyforge.org</a><br><a href="http://rubyforge.org/mailman/listinfo/wxruby-users">http://rubyforge.org/mailman/listinfo/wxruby-users
</a><br></blockquote></div><br>