473,721 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Having a very odd problem with an imagelist?

Hey everyone. I have Visual Basic .NET 2003 and am trying to show images on
a treeview control. I have the imagelist on the form filled with images,
and have the ImageList property of the treeview control set to the imagelist
containing the images I want to be displayed next to each node.

It seems that no matter what I do there will be no images displayed next to
the nodes during runtime. I tried creating nodes during designtime using
the Nodes property, and the image appears next to the node in the designer
like it should, but when I run the app, there's no image visible, just a
blank space where the image is supposed to be followed by the node text.
Does this even when I add nodes at runtime, using code:

MyTreeview.Node s.Add(New TreeNode("Node text", 0, 0))
0 is the index of the image in the imagelist that I want displayed.

I just noticed it does this with everything that uses the imagelist! The
toolbar, listview, treeview; everything behaves the same.

Also, this didn't always be a problem. It started acting this way when I
cut and pasted an imagelist control to a different form in one of my
projects. Its not a project-specific problem either, because I started a
new project and it does the same thing. I've tried restarting, running a
repair installation on VB.NET, nothing will fix it.

Even when I run the compiled app on another PC, same thing.

Anyone else having this weird problem? It's becoming very frustrating, and
would love to hear anyone's ideas. Thanks a lot.

Andrew
Nov 20 '05 #1
7 2098
Hi,

I had a similar problem with a toolbar a while ago. Look in the
Windows Form Designer generated code region. Make sure the imagelist is
created before the treeview.

Ken

-------------------------------

"Andrew Christiansen" <no-spam> wrote in message
news:O1******** ******@TK2MSFTN GP11.phx.gbl...
Hey everyone. I have Visual Basic .NET 2003 and am trying to show images on a treeview control. I have the imagelist on the form filled with images,
and have the ImageList property of the treeview control set to the imagelist containing the images I want to be displayed next to each node.

It seems that no matter what I do there will be no images displayed next to the nodes during runtime. I tried creating nodes during designtime using
the Nodes property, and the image appears next to the node in the designer
like it should, but when I run the app, there's no image visible, just a
blank space where the image is supposed to be followed by the node text.
Does this even when I add nodes at runtime, using code:

MyTreeview.Node s.Add(New TreeNode("Node text", 0, 0))
0 is the index of the image in the imagelist that I want displayed.

I just noticed it does this with everything that uses the imagelist! The
toolbar, listview, treeview; everything behaves the same.

Also, this didn't always be a problem. It started acting this way when I
cut and pasted an imagelist control to a different form in one of my
projects. Its not a project-specific problem either, because I started a
new project and it does the same thing. I've tried restarting, running a
repair installation on VB.NET, nothing will fix it.

Even when I run the compiled app on another PC, same thing.

Anyone else having this weird problem? It's becoming very frustrating, and would love to hear anyone's ideas. Thanks a lot.

Andrew

Nov 20 '05 #2
Tried that just now. I was excited because it sounded like it would solve
the problem, doesn't. I moved the block of code that sets the properties of
the imagelist:

'
ImageList1
'
Blah .........

Above where the listview is, and still no luck. Dang I'm getting very
frusterated I can't really do much of anything until I get this fixed, I've
been working on this problem for like 3 days now. Any other ideas? Is that
all you did to fix the toolbar problem you had? Thanks.

Andrew

"Andrew Christiansen" <no-spam> wrote in message
news:O1******** ******@TK2MSFTN GP11.phx.gbl...
Hey everyone. I have Visual Basic .NET 2003 and am trying to show images on a treeview control. I have the imagelist on the form filled with images,
and have the ImageList property of the treeview control set to the imagelist containing the images I want to be displayed next to each node.

It seems that no matter what I do there will be no images displayed next to the nodes during runtime. I tried creating nodes during designtime using
the Nodes property, and the image appears next to the node in the designer
like it should, but when I run the app, there's no image visible, just a
blank space where the image is supposed to be followed by the node text.
Does this even when I add nodes at runtime, using code:

MyTreeview.Node s.Add(New TreeNode("Node text", 0, 0))
0 is the index of the image in the imagelist that I want displayed.

I just noticed it does this with everything that uses the imagelist! The
toolbar, listview, treeview; everything behaves the same.

Also, this didn't always be a problem. It started acting this way when I
cut and pasted an imagelist control to a different form in one of my
projects. Its not a project-specific problem either, because I started a
new project and it does the same thing. I've tried restarting, running a
repair installation on VB.NET, nothing will fix it.

Even when I run the compiled app on another PC, same thing.

Anyone else having this weird problem? It's becoming very frustrating, and would love to hear anyone's ideas. Thanks a lot.

Andrew

Nov 20 '05 #3
I had the same problem when I used Application.Ena bleVisualStyles , my
existing toolbar icons didn't display their icons.
Another thing, the depth of the image may not be supported by your video
card, check the depth property of the image in the imagelist. Just some
extra suggestions.

"Andrew Christiansen" <no-spam> wrote in message
news:uo******** ******@TK2MSFTN GP10.phx.gbl...
Tried that just now. I was excited because it sounded like it would solve
the problem, doesn't. I moved the block of code that sets the properties of the imagelist:

'
ImageList1
'
Blah .........

Above where the listview is, and still no luck. Dang I'm getting very
frusterated I can't really do much of anything until I get this fixed, I've been working on this problem for like 3 days now. Any other ideas? Is that all you did to fix the toolbar problem you had? Thanks.

Andrew

"Andrew Christiansen" <no-spam> wrote in message
news:O1******** ******@TK2MSFTN GP11.phx.gbl...
Hey everyone. I have Visual Basic .NET 2003 and am trying to show images
on
a treeview control. I have the imagelist on the form filled with

images, and have the ImageList property of the treeview control set to the

imagelist
containing the images I want to be displayed next to each node.

It seems that no matter what I do there will be no images displayed next

to
the nodes during runtime. I tried creating nodes during designtime using the Nodes property, and the image appears next to the node in the designer like it should, but when I run the app, there's no image visible, just a
blank space where the image is supposed to be followed by the node text.
Does this even when I add nodes at runtime, using code:

MyTreeview.Node s.Add(New TreeNode("Node text", 0, 0))
0 is the index of the image in the imagelist that I want displayed.

I just noticed it does this with everything that uses the imagelist! The toolbar, listview, treeview; everything behaves the same.

Also, this didn't always be a problem. It started acting this way when I cut and pasted an imagelist control to a different form in one of my
projects. Its not a project-specific problem either, because I started a new project and it does the same thing. I've tried restarting, running a repair installation on VB.NET, nothing will fix it.

Even when I run the compiled app on another PC, same thing.

Anyone else having this weird problem? It's becoming very frustrating,

and
would love to hear anyone's ideas. Thanks a lot.

Andrew


Nov 20 '05 #4
Wow, I commented out the Application.Ena bleVisualStyles method that I was
calling in Sub Main() and, voulia, the image was there. Hmmm.... should I
call EnableVisualSty les elsewhere to keep it from doing that? Thanks!

Andrew

"Jared" <VB***********@ email.com> wrote in message
news:vu******** ****@corp.super news.com...
I had the same problem when I used Application.Ena bleVisualStyles , my
existing toolbar icons didn't display their icons.
Another thing, the depth of the image may not be supported by your video
card, check the depth property of the image in the imagelist. Just some
extra suggestions.

"Andrew Christiansen" <no-spam> wrote in message
news:uo******** ******@TK2MSFTN GP10.phx.gbl...
Tried that just now. I was excited because it sounded like it would solve
the problem, doesn't. I moved the block of code that sets the properties
of
the imagelist:

'
ImageList1
'
Blah .........

Above where the listview is, and still no luck. Dang I'm getting very
frusterated I can't really do much of anything until I get this fixed, I've
been working on this problem for like 3 days now. Any other ideas? Is

that
all you did to fix the toolbar problem you had? Thanks.

Andrew

"Andrew Christiansen" <no-spam> wrote in message
news:O1******** ******@TK2MSFTN GP11.phx.gbl...
Hey everyone. I have Visual Basic .NET 2003 and am trying to show

images
on
a treeview control. I have the imagelist on the form filled with

images, and have the ImageList property of the treeview control set to the

imagelist
containing the images I want to be displayed next to each node.

It seems that no matter what I do there will be no images displayed next to
the nodes during runtime. I tried creating nodes during designtime using the Nodes property, and the image appears next to the node in the designer like it should, but when I run the app, there's no image visible, just
a blank space where the image is supposed to be followed by the node text. Does this even when I add nodes at runtime, using code:

MyTreeview.Node s.Add(New TreeNode("Node text", 0, 0))
0 is the index of the image in the imagelist that I want displayed.

I just noticed it does this with everything that uses the imagelist! The toolbar, listview, treeview; everything behaves the same.

Also, this didn't always be a problem. It started acting this way
when I cut and pasted an imagelist control to a different form in one of my
projects. Its not a project-specific problem either, because I
started
a new project and it does the same thing. I've tried restarting,
running
a repair installation on VB.NET, nothing will fix it.

Even when I run the compiled app on another PC, same thing.

Anyone else having this weird problem? It's becoming very

frustrating, and
would love to hear anyone's ideas. Thanks a lot.

Andrew



Nov 20 '05 #5
Figured it out! For everyone having this problem, call Application.DoE vents
right after calling EnableVisualSty les, it will enable the styles plus keep
the images intact. I have no idea why calling DoEvents fixes the problem,
but it does. The article I read that told me this said that there was
probably some message that gets filtered out upon calling EnableVisualSty les
that keeps the images from being visible, but when you call DoEvents the
message gets processed. Makes sense.

Thanks.

Andrew

"Andrew Christiansen" <no-spam> wrote in message
news:uv******** ******@TK2MSFTN GP12.phx.gbl...
Wow, I commented out the Application.Ena bleVisualStyles method that I was
calling in Sub Main() and, voulia, the image was there. Hmmm.... should I
call EnableVisualSty les elsewhere to keep it from doing that? Thanks!

Andrew

"Jared" <VB***********@ email.com> wrote in message
news:vu******** ****@corp.super news.com...
I had the same problem when I used Application.Ena bleVisualStyles , my
existing toolbar icons didn't display their icons.
Another thing, the depth of the image may not be supported by your video
card, check the depth property of the image in the imagelist. Just some
extra suggestions.

"Andrew Christiansen" <no-spam> wrote in message
news:uo******** ******@TK2MSFTN GP10.phx.gbl...
Tried that just now. I was excited because it sounded like it would solve the problem, doesn't. I moved the block of code that sets the properties
of
the imagelist:

'
ImageList1
'
Blah .........

Above where the listview is, and still no luck. Dang I'm getting very
frusterated I can't really do much of anything until I get this fixed, I've
been working on this problem for like 3 days now. Any other ideas?
Is that
all you did to fix the toolbar problem you had? Thanks.

Andrew

"Andrew Christiansen" <no-spam> wrote in message
news:O1******** ******@TK2MSFTN GP11.phx.gbl...
> Hey everyone. I have Visual Basic .NET 2003 and am trying to show

images
on
> a treeview control. I have the imagelist on the form filled with

images,
> and have the ImageList property of the treeview control set to the
imagelist
> containing the images I want to be displayed next to each node.
>
> It seems that no matter what I do there will be no images displayed

next to
> the nodes during runtime. I tried creating nodes during designtime

using
> the Nodes property, and the image appears next to the node in the

designer
> like it should, but when I run the app, there's no image visible,
just a > blank space where the image is supposed to be followed by the node text. > Does this even when I add nodes at runtime, using code:
>
> MyTreeview.Node s.Add(New TreeNode("Node text", 0, 0))
> 0 is the index of the image in the imagelist that I want displayed.
>
> I just noticed it does this with everything that uses the imagelist!

The
> toolbar, listview, treeview; everything behaves the same.
>
> Also, this didn't always be a problem. It started acting this way when
I
> cut and pasted an imagelist control to a different form in one of my
> projects. Its not a project-specific problem either, because I

started
a
> new project and it does the same thing. I've tried restarting,

running
a
> repair installation on VB.NET, nothing will fix it.
>
> Even when I run the compiled app on another PC, same thing.
>
> Anyone else having this weird problem? It's becoming very

frustrating, and
> would love to hear anyone's ideas. Thanks a lot.
>
> Andrew
>
>



Nov 20 '05 #6
Cor
Hi Andrew,

That is greath this message because this is a workaround for what I thought
I have often seen in this newsgroup mentioned as something that was
imposible.

Cor
Figured it out! For everyone having this problem, call Application.DoE vents right after calling EnableVisualSty les, it will enable the styles plus keep the images intact. I have no idea why calling DoEvents fixes the problem,
but it does. The article I read that told me this said that there was
probably some message that gets filtered out upon calling EnableVisualSty les that keeps the images from being visible, but when you call DoEvents the
message gets processed. Makes sense.

Nov 20 '05 #7
Sorry, should have told you to use the DoEvents after EnbaleVisualSty les. I
thought the documentation said you should always do it. I must have started
using it when I first had the problem and just made it mandatory in my mind.
I guess I could have saved you a little time. Sorry about that.

Jared

"Cor" <no*@non.com> wrote in message
news:O4******** ******@TK2MSFTN GP11.phx.gbl...
Hi Andrew,

That is greath this message because this is a workaround for what I thought I have often seen in this newsgroup mentioned as something that was
imposible.

Cor
Figured it out! For everyone having this problem, call

Application.DoE vents
right after calling EnableVisualSty les, it will enable the styles plus

keep
the images intact. I have no idea why calling DoEvents fixes the problem, but it does. The article I read that told me this said that there was
probably some message that gets filtered out upon calling

EnableVisualSty les
that keeps the images from being visible, but when you call DoEvents the
message gets processed. Makes sense.


Nov 20 '05 #8

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

Similar topics

4
4332
by: David | last post by:
I have a problem that just cropped up with using an ImageList in my project I am using VB .NET 200 Problem: I have existing Form with 2 Image List controls. ImageList16 (for 16x16 Images) and ImageList24 (for 24x24). I have inserted images in each and it has worked fine for months... The System.Drawing.Bitmap properties for these images are PixelFormat=32bppArgb and RawFormat=MemoryBmp with the Horiz and VerticalResolution = 96 I...
0
2863
by: Andre Viens | last post by:
Hello, I am using the following variation of code from <http://support.microsoft.com/default.aspx?scid=kb;EN-US;319340> to add icons to an imagelist for use in a listview: Private Structure SHFILEINFO Public hIcon As IntPtr ' : icon Public iIcon As Integer ' : icondex Public dwAttributes As Integer ' : SFGAO_ flags
7
2938
by: Mitchell Vincent | last post by:
I've been trying to get a standard toolbar to play nice with some nice icons that I have. When I put them on a button or anything they look perfect, but through an imagelist and on a toolbar they all have this blue aura around them. I assume that is from the transparency, but I don't understand why almost any other control displays them properly.. There really is no replacement for the toolbar (without paying!), so I hope someone can tell...
2
3474
by: johnb41 | last post by:
In my app, I need to open up a multipage tiff file, and also display it's thumbnail images IN HIGH QUALITY. (High Quality meaning anti-aliased, and looking good; not rough and pixely) The thumbnail images are displayed in a ListView control. (I go through each page of the file, create a thumbnail of it, and put it into an ImageList. Then i hook that imagelist up to the ListView.) It works fine, but it is VERY slow. Creating and...
5
3543
by: | last post by:
I do not want to setup and create my ImageList over and over again on different forms in my project. Is there any ways to achieve it? so that I will be more easy to manage my ImageList as well as minimize the performance overhead. Thanks~
1
3736
by: DK | last post by:
I have an image list control on a user control that I'm trying to access from the main form. I've tried different code but can't get it. I get an error: Cannot convert type 'System.Windows.Forms.Control' to 'System.Windows.Forms.ImageList' ImageList il = new ImageList(); il = (ImageList)userControlMedia1.Controls.Find("imageListMedia", true); Any ideas??
2
3557
by: =?Utf-8?B?S2VuTg==?= | last post by:
We're using a System.Windows.Forms.ImageList to store a bunch of Images that I've loaded, and rendering each image in the ImageList during a draw loop. The process was running unusually slow and was causing memory spikes. After several hours we discovered that the ImageList.Images indexer is actually returning a copy of the added Images instead of simply returning a reference. Needless to say, we were a bit surprised and disturbed to...
7
1944
by: raknin | last post by:
Hi I have a carousel script. I want to load the carousel with a new set of pictures every time I press a button. The problem that I have that the script append the new pictures to the olds one and the next and previous buttons are added again and again. Please help meto solve the problem. The full html and javascript are attached for your conviniet. HTML ------- <HTML> <HEAD> <META http-equiv="Content-Language" content="en-us">
0
2180
by: Phil Stanton | last post by:
I am using an imageList control for a tree menu. Works fine Problem I have is using VB to populate the ImageList Basically I have a table of Icons that I wish to use. They point to a folder where I store the Icon images. The name of the ImageList is ImList. The LoadPicture routine finds the full path of the Icon, and obviously I want to store these icons in the ImList. No problem doing it manually with the form in design view, but this...
0
8727
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9212
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9127
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9056
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8002
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4483
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4748
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3186
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2127
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.