How to draw like this ?

Please discuss general Delphi programming topics here.

How to draw like this ?

Postby kenshin1101 » November 1st, 2009, 4:19 am

Hello,
I'm trying to draw ribbon menu as Win7 does
something like this
Image
But I don't know how to paint this light (at the bottom of image) ->Image

Any one know how to draw/paint that ?
Thanks
kenshin1101
Active Member
Active Member
 
Posts: 7
Joined: October 12th, 2007, 8:42 pm

Re: How to draw like this ?

Postby geowink » November 1st, 2009, 8:32 pm

I put "ribbon menu windows 7 delphi" into Google and saw a bunch of things that might help. TMS appears to have something.

George
George
geowink
Junior Member
Junior Member
 
Posts: 37
Joined: November 29th, 2005, 3:59 am
Location: La Grange, Illinois

Re: How to draw like this ?

Postby P_G » November 2nd, 2009, 11:54 am

Ribbon components are included in Delphi 2009 and 2010. In case you only need menus have a look at this:

http://delphi.about.com/od/vclusing/a/2007ownerdraw.htm

You just have to change the colours within the code above. I took:
Code: Select all
const
  RICHMENU_MARG_X                     = 4;
  RICHMENU_MARG_Y                     = 4;
  RICHMENU_SEPARATOR_LEADING          = 6;
  RICHMENU_GUTTER_WIDTH               = 40;

  RICHMENU_SEPARATOR_BACKGROUND_COLOR = $00eee7dd;
  RICHMENU_SEPARATOR_LINE_COLOR       = $00c5c5c5;
  RICHMENU_GUTTER_COLOR               = $00F2DAC2;
  RICHMENU_ITEM_BACKGROUND_COLOR      = $00fafafa;
  RICHMENU_ITEM_SELECTED_COLOR        = $00e6d5cb;
  RICHMENU_FONT_COLOR                 = $006e1500;
  RICHMENU_FONT_DISABLED_COLOR        = $00dec5d8;

  RICHMENU_GRADIENT_START1            = $00EBFDFF;
  RICHMENU_GRADIENT_END1              = $00ABEBFF;
  RICHMENU_GRADIENT_START2            = $0069D6FF;
  RICHMENU_GRADIENT_END2              = $0096E4FF;


Best regards, PG
P_G
Senior Member
Senior Member
 
Posts: 51
Joined: June 14th, 2004, 11:13 am
Location: Germany

Re: How to draw like this ?

Postby kenshin1101 » November 4th, 2009, 11:30 am

Hello friends!
I'll not use Delphi 2009/2010 because it use bitmap to draw ribbon control :(
All i need is how to draw the bottom image (see the light at the bottom image)
My control have many and different size, i can't use bitmap like CodeGear does :-#
kenshin1101
Active Member
Active Member
 
Posts: 7
Joined: October 12th, 2007, 8:42 pm

Re: How to draw like this ?

Postby Kambiz » November 7th, 2009, 12:02 am

You should use a gradient fill algorithm to paint the control's background.

As an example, look at source code of TGradient component.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron