Re: Applying color to Toolbars
From: Tonny (anonymous_at_discussions.microsoft.com)
Date: 05/02/04
- Previous message: Ken Tucker [MVP]: "Re: Applying color to Toolbars"
- In reply to: Ken Tucker [MVP]: "Re: Applying color to Toolbars"
- Next in thread: Tonny: "Re: Applying color to Toolbars"
- Reply: Tonny: "Re: Applying color to Toolbars"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 1 May 2004 23:26:04 -0700
Hi,
Thank you very much. Your suggestion worked fine. Now I'm able to draw a gradient "backcolor".
I have one problem though. It seems that the gradient "backcolor" is drawn on top of the buttons, because I'm not able to see any of the buttons after i have drawn the "backcolor". I guess I have to redraw the buttons in order to be able to view them.
My original idea was to use a foreach an run through all the ToolbarButton's and redraw them. However, there is no refresh()-method or invalidate()-method.
Any suggestions on how to solve this problem?
Kind regards,
Tonny
----- Ken Tucker [MVP] wrote: -----
Hi,
Try this.
//
// TODO: Add constructor logic here
//
this.SetStyle(System.Windows.Forms.ControlStyles.UserPaint, true);
Ken
--------------------
"Tonny" <anonymous@discussions.microsoft.com> wrote in message
news:305748E6-DB6A-4C9A-8B18-A6C3ECFFD94B@microsoft.com...
> Hi
>> I'm trying to draw an gradient on a Toolbar. I have created my own
> GradientToolbar, which inherrits from Toolbar. In this I try to override
> OnPaint in order to draw something:
>> protected override void OnPaint(PaintEventArgs e)
> {
> Rectangle rectangle = new Rectangle(0, 0, this.Width, this.Height);
> Color gradientColorA = Color.Blue;
> Color gradientColorB = Color.White;
> Brush brush = new LinearGradientBrush(rectangle, gradientColorA,
> gradientColorB, 0.0F);
> e.Graphics.FillRectangle(brush, rectangle);
> }
>> However, nothing happens. The toolbar is not drawn with the desired
> colors.
>> Is there anyone who knows how to draw the background of an toolbar. I
> obviously don't. I have also tried to override the BackColor - also
> without an positive result.
>> If anyone have an answer to how to solve this problem I would be
> gratefull, if you respond to this message.
>> Kind regards,
> Tonny
- Previous message: Ken Tucker [MVP]: "Re: Applying color to Toolbars"
- In reply to: Ken Tucker [MVP]: "Re: Applying color to Toolbars"
- Next in thread: Tonny: "Re: Applying color to Toolbars"
- Reply: Tonny: "Re: Applying color to Toolbars"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|