Re: Color question



u can change the color of the rectangle,just change
the color of gc  to ur desired color.this will work
for u.

GdkColor c;
        GdkGC *gc;
        c.red = 11001;
        c.blue = 60001;
        c.green = 14797;
        gdk_color_alloc (gdk_colormap_get_system (),
&c);
        gc = gdk_gc_new (widget->window);
        gdk_gc_set_foreground (gc, &c);

after whis pass this gc to desired function which is
drawing the rectangle.
or 
gdk_draw_rectangle (pixmap, gc, FALSE, 40,50,20,20);  
   

                                            -manu

------------------------------------------------



 --- Peter Krueger <pkrueger appss de> wrote: > On
Wed, 31 Mar 2004, kadil wrote:
I have an appthat is reading data from an odbc
database and drawing the
results on a drawing area. One line drawn per row
returned. Table data as
follows:

Start_of_line       End_Of_Line     Color
0                   10                      565466
10                  17                      99094
17                  42                      255

One of the columns returned is a color. So I want
to draw the each rectangle
colored as per the record. When I try to change
the color, it changes the
color of all the previous rectangles that I have
drawn. Do I need to define a
separate color for each possible color option?
Hi kadil,
it's not clear to me how you draw your rectangles in
detail. What you
should do is:
- invalidate your drawing area when your data
changes, so that an
  expose-event is generated
(gtk_widget_queue_draw_area)
- in the expose-event handler:
  - set draw color
  - draw a rectangle
  - set next draw color
  - draw next rectangle
  and so on

You should decide yourself whether you read data
from the database every
time an expose-event occurs or rather cache them in
own data structures
inside your program.

Regards,
                         Peter
-- 

====================================================================
Peter Krüger

applied software solutions (appss) GmbH
Sandtorstr. 23
D-39106 Magdeburg
Germany

Phone:  +49-(0)391-54486-19388
Fax:    +49-(0)391-54486-19222
email:  krueger appss de
URL:    http://www.appss.de

Managing Director: Uwe Hess, Dietmar Schäfer
Register: HRB12386, AG Mageburg

"Virtual business becomes reality!"

This e-mail may contain confidential and/or
privileged information. If
you are not the intended recipient (or have received
this e-mail in
error) please notify the sender immediately and
destroy this e-mail. Any
unauthorised copying, disclosure or distribution of
the material in this
e-mail is strictly forbidden.

====================================================================

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list 

________________________________________________________________________
Yahoo! India Insurance Special: Be informed on the best policies, services, tools and more. 
Go to: http://in.insurance.yahoo.com/licspecial/index.html



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