472,802 Members | 1,292 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

icon in statusbar panel

Hi
I'm having trouble getting icons from an imagelist in a statusbar panel.
if i load the icons directly it works
Dim ico As new Icon("W95MBX03.ICO")

statusbarPanel..Icon = ico

but if i try to set the icon property with an imagelist i get this

Value of type 'System.Drawing.Image' cannot be converted to
'System.Drawing.Icon'

If anyone has a thought, pls let me know.

tnx in advance

--
Juchtmans Eric
Omnipack
Nov 20 '05 #1
3 1863
When are you getting this error? At compile time? You may need to
explicitly cast the image you get an Icon object (if you have Option strict
on), or it may be that it is not an icon, but some other format of image.

Try doing something like this and see what you get;
Dim MyImage As Image
Dim MyIcon As Icon

MyImage = Me.ImageList1.Images(0)

If SrcOverlay.RawFormat.Equals(Drawing.Imaging.ImageF ormat.Icon) Then
MyIcon = DirectCast(SrcOverlay, Drawing.Icon)

' Place icon into statusbar here

Else

MessageBox.Show("Not an Icon")

End If
BTW - not sure if this is the best way to check an image is actually an
icon, if there's a better way can someone shout?

Jon

"EricJ" <er********@THISomnipack.be> wrote in message
news:3f***********************@reader0.news.skynet .be...
Hi
I'm having trouble getting icons from an imagelist in a statusbar panel.
if i load the icons directly it works
Dim ico As new Icon("W95MBX03.ICO")

statusbarPanel..Icon = ico

but if i try to set the icon property with an imagelist i get this

Value of type 'System.Drawing.Image' cannot be converted to
'System.Drawing.Icon'

If anyone has a thought, pls let me know.

tnx in advance

--
Juchtmans Eric
Omnipack

Nov 20 '05 #2
* "EricJ" <er********@THISomnipack.be> scripsit:
I'm having trouble getting icons from an imagelist in a statusbar panel.
if i load the icons directly it works
Dim ico As new Icon("W95MBX03.ICO")

statusbarPanel..Icon = ico

but if i try to set the icon property with an imagelist i get this

Value of type 'System.Drawing.Image' cannot be converted to
'System.Drawing.Icon'


<http://www.google.de/groups?selm=%23VfMRcmiDHA.2452%40tk2msftngp13.phx. gbl>

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
do i have to declare SrcOverlay or do i need an import for that ?

"Jonathan Williamson" <jo*****************@amadeus.co.uk> wrote in message
news:Ob**************@TK2MSFTNGP11.phx.gbl...
When are you getting this error? At compile time? You may need to
explicitly cast the image you get an Icon object (if you have Option strict on), or it may be that it is not an icon, but some other format of image.

Try doing something like this and see what you get;
Dim MyImage As Image
Dim MyIcon As Icon

MyImage = Me.ImageList1.Images(0)

If SrcOverlay.RawFormat.Equals(Drawing.Imaging.ImageF ormat.Icon) Then
MyIcon = DirectCast(SrcOverlay, Drawing.Icon)

' Place icon into statusbar here

Else

MessageBox.Show("Not an Icon")

End If
BTW - not sure if this is the best way to check an image is actually an
icon, if there's a better way can someone shout?

Jon

"EricJ" <er********@THISomnipack.be> wrote in message
news:3f***********************@reader0.news.skynet .be...
Hi
I'm having trouble getting icons from an imagelist in a statusbar panel.
if i load the icons directly it works
Dim ico As new Icon("W95MBX03.ICO")

statusbarPanel..Icon = ico

but if i try to set the icon property with an imagelist i get this

Value of type 'System.Drawing.Image' cannot be converted to
'System.Drawing.Icon'

If anyone has a thought, pls let me know.

tnx in advance

--
Juchtmans Eric
Omnipack


Nov 20 '05 #4

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

Similar topics

1
by: Oleg Medyanik | last post by:
Hi, faced the following problem.. (NET 1.1) Steps to reproduce - 1.Create New Windows Forms Application 2. Add StatusBar and set ShowPanels = True 3. Add new panel and Set Autosize = Contents...
1
by: Ahmet | last post by:
In my application, I have statusbar on which i show icons. On some cases, I have to change icon of my statusbar to show different messages on panels. But I dont know how to change icon of one...
10
by: Nicolas | last post by:
When I resize (Enlarge) the form while the progress bar is running the rectangle drawing is not going to the end of the rectangle? I got a form with one button, one statusbar with three...
7
by: Geoff | last post by:
I would like to have a status bar which has a few panels, one of which I want to display a different .gif under different conditions. I have added the status bar to the form, I have added the...
6
by: Anony | last post by:
Hi All, I have two icons: Private micoIcon1 As New System.Drawing.Icon(System.IO.Path.Combine(Application.StartupPath, "Icon1.ico")) Private micoIcon2 As New...
14
by: Kishan Hathiwala | last post by:
Hi i have kept a statusbar in the form with panels = true. and total there 3 panels. whenever i click on the 3rd panel a menu appears showing online and offline and either is enable at a time....
10
by: Flashster | last post by:
How do I put a custom animated icon on the status bar of a form? I have an animated icon file called icon.ani, and I've tried getting 'statusbar1.Animate' to work with no success. Can someone give...
2
by: reidarT | last post by:
Is it possible to show icon on statusbar, when my application is opened. (Not on taskbar, but on the right side of the 'bottombar') reidarT
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.