By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,928 Members | 1,200 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,928 IT Pros & Developers. It's quick & easy.

Icon edit at runtime (colour picker)

P: n/a
Hi

I am looking to edit an icon at runtime on menu items such as change fill
colour.

I wish to replicate the features found in most applications where by the
coloured bar on a colour picker icon changes colour to the last selected
colour.

Therefore the user can easily tell which colour will be apllied when
clicking the menu item rather than droping down the colour picker to
re-select a colour.

Regards, Carl
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi,

Dim bm As New Bitmap(16, 16)

Dim g As Graphics = Graphics.FromImage(bm)

g.Clear(Color.SkyBlue) ' Replace with the color selected

Dim ico As Icon = Icon.FromHandle(bm.GetHicon)
Ken
--------------------
"Carl Gilbert" <wj*****@hotmail.com> wrote in message
news:uD**************@TK2MSFTNGP09.phx.gbl...
Hi

I am looking to edit an icon at runtime on menu items such as change fill
colour.

I wish to replicate the features found in most applications where by the
coloured bar on a colour picker icon changes colour to the last selected
colour.

Therefore the user can easily tell which colour will be apllied when
clicking the menu item rather than droping down the colour picker to
re-select a colour.

Regards, Carl

Nov 20 '05 #2

P: n/a
Hi

I have to following code, thanks to Ken, which sets up a new bitmap.

Dim bm As New Bitmap(16, 16)
Dim g As Graphics = Graphics.FromImage(bm)
g.Clear(System.Drawing.Color.Transparent)

Dim pn As Pen = New Pen(System.Drawing.Color.Blue)
g.DrawRectangle(pn, 0, 13, 16, 4)

Dim tmpImg As Image = Me.imgsmImageList.Images(0)

Firstly does anyone know how to overlay this bitmap on the current icon
being used?
And secondly, how to draw a solid rectangle at the bottom of the bitmap.
I have managed to draw an outline, but I think this may be wrongly
positioned anyway.

Ultimately, I am trying to build a transparent bitmap (16x16), draw a
coloured rectangle (4 high x16 wide) at the bottom of the bitmap and finally
overlay this bitmap on an icon in the menu.

Any help on this would be greatly appreciated.

Regards, Car Gilbert
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.