473,387 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Draw ToolbarButton Image

Tom
Hi

Hi i am trying to draw on top of a button on a standard toolbar. All i
want to do is draw a small rectangle on the button to represent the
selected color.

I have tried the folowing code in the toolbar's parent control, which
is fired when the selected color is changed:

Dim r As Rectangle = FontColorButton.Rectangle
Dim g As Graphics = CreateGraphics()

g.FillRectangle(New SolidBrush(Color.Green), r)

This is not working, not really sure why, although i am pretty sure i
am approaching it from completely wrong angle.

Any help appreciated.

Thanks

Tom
Nov 20 '05 #1
3 1620
Hi,

Dim g As Graphics = ToolBar1.CreateGraphics
Dim r As Rectangle = ToolBarButton1.Rectangle

g.FillRectangle(New SolidBrush(Color.FromArgb(128, Color.Blue)), r)

Ken
-------------------------------
"Tom" <re***@to.group> wrote in message
news:mm********************************@4ax.com...
Hi

Hi i am trying to draw on top of a button on a standard toolbar. All i
want to do is draw a small rectangle on the button to represent the
selected color.

I have tried the folowing code in the toolbar's parent control, which
is fired when the selected color is changed:

Dim r As Rectangle = FontColorButton.Rectangle
Dim g As Graphics = CreateGraphics()

g.FillRectangle(New SolidBrush(Color.Green), r)

This is not working, not really sure why, although i am pretty sure i
am approaching it from completely wrong angle.

Any help appreciated.

Thanks

Tom

Nov 20 '05 #2
* "Ken Tucker [MVP]" <vb***@bellsouth.net> scripsit:
Dim g As Graphics = ToolBar1.CreateGraphics
Dim r As Rectangle = ToolBarButton1.Rectangle

g.FillRectangle(New SolidBrush(Color.FromArgb(128, Color.Blue)), r)


.... but don't forget to dispose the brush ;-).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
Tom
>* "Ken Tucker [MVP]" <vb***@bellsouth.net> scripsit:
Dim g As Graphics = ToolBar1.CreateGraphics
Dim r As Rectangle = ToolBarButton1.Rectangle

g.FillRectangle(New SolidBrush(Color.FromArgb(128, Color.Blue)), r)


... but don't forget to dispose the brush ;-).


Thanks guys, i actually went back a bit and decided what i should be
doing is modifying the image that is displayed on the toolbarbutton,
rather than the button it's self.

Cheers

Tom
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: DraguVaso | last post by:
Hi, I have an inherited DataGrid, that does lots of extra stuff. For exemple drawing a backgroundimage in every cell. The problem is that it's taking too much time (using gdi+), so I want to do...
0
by: Dana Epp | last post by:
I have a ToolBarButton that when I set it to disabled (button.Enabled = false;) causes a really ugly gray masking effect to take place. This is normal and the intended way of the button, but I...
1
by: R.Balaji | last post by:
Hi, We are developing a windows application using c#. We have created a toolbar with some toolbar buttons. When we disable the toolbar button, the toolbar button image should be displayed...
2
by: Peter Rilling | last post by:
It seems to me that the ToolBarButton should be a control, but instead it inherits from Component. Is there a reason this could not have inherited from Control since really a ToolBarButton is...
5
by: Barry Gast | last post by:
Hi. I am trying to access the names of the toolbar buttons in order to match to correct button name passed to a function. However, there is no ..Name property on a ToolBarButton control. Is...
4
by: Ahmed | last post by:
Hi everyone, Is there a way to add a toolbarbutton with dropdown menu similar to the mail button in IE? In another word, when the chevron is part of the button not beside it. Thanks Ahmed
1
by: zxo102 | last post by:
Hi everyone, I have tried two days to figure out how to draw the image in wx.BufferedDC on the page created by AddPage of wx.Notebook but still got no clue. The attached example works fine. If...
0
by: benfly08 | last post by:
Hi, guys. I have a program to draw bar/pie chart based on the data i hard coded in it. However, my image comes with "BLACK" background color. I don't know how to fix this. The code snippet is...
1
by: kummu4help | last post by:
hi, i want to draw rectangle based on mousedrag event. if user dragging the mouse, then the rectangle on the applet should increase or decrease basing on current mouse coordinates. i have the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.