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





From: James Henstridge <james daa com au>
To: 闂?閼?<bdragon2001 hotmail com>
CC: gnome-devel-list gnome org
Subject: Re: why i can't draw the graphic??
Date: Wed, 10 Jul 2002 17:06:30 +0800


闂?閼?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.

--

hi,james
After reading the material showed by you,I don't understand why the first time
drawing can't be viewed?and it is obviously hidden.

The configure event,i keep it in the code.But only when i hit the window,the configure event will happen,and draw the graphic.It make me confused because it
should happen when the window originally produced.

regards,


_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.microsoft.com/cn




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