Re: why i can't draw the graphic??



闄 鑳 wrote:


hi,
i am using the GDK to draw graphic,the compilation is ok.but it still can't draw

the graphic.here is my code:

[snip]


    Drawing_area=gtk_drawing_area_new ();
gtk_drawing_area_size (GTK_DRAWING_AREA (Drawing_area),640,300);

[snip]


    /* draw the graphic */
    gdk_draw_rectangle(Drawing_area->window,
               Drawing_area->style->white_gc,
               TRUE,
               0,0,
               Drawing_area->allocation.width,
               Drawing_area->allocation.height);

    /*gdk_draw_line(Drawing_area->window,
              Drawing_area->style->black_gc,0,0,100,100);
*/

[snip]



Where is the bug?
Thanks for any help.

With a drawing area, you should connect to the expose event, and your handler should redraw the widget on demand. The following section of the GTK+ tutorial may give you some ideas:
 http://www.gtk.org/tutorial/sec-thedrawingareawidget.html

James.

--
Email: james daa com au              | Linux.conf.au 2003 Call for Papers out
WWW:   http://www.daa.com.au/~james/ |   http://conf.linux.org.au/cfp.html







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]