473,750 Members | 2,202 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Optmizing images in Windows Forms

Hi,

Everytime I use a image in a Windows Form, Visual Studio.Net creates the
image in the respective resx file. This can be very expensive in a project
with about one hundred forms, where images of delete, insert and update (for
example) appear several times.

The only way I found to optimize this is creating a Windows Form with a
ImageList with all images, and inherit every form from this one. But then I
would be loading in memory all images in every form.

Some idea?

Regards,
Bruno Rodrigues
Nov 16 '05 #1
3 3776
Bruno,

Why not have the base class reference a static imagelist which is loaded
as needed from the resources?

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Bruno Rodrigues" <br*********@si plan.com.br> wrote in message
news:e1******** ******@tk2msftn gp13.phx.gbl...
Hi,

Everytime I use a image in a Windows Form, Visual Studio.Net creates the image in the respective resx file. This can be very expensive in a project
with about one hundred forms, where images of delete, insert and update (for example) appear several times.

The only way I found to optimize this is creating a Windows Form with a ImageList with all images, and inherit every form from this one. But then I would be loading in memory all images in every form.

Some idea?

Regards,
Bruno Rodrigues

Nov 16 '05 #2
Nicholas,

How can I load the images as needed? Once I referr the imagelist, he is
not loaded in the memory with all images?

Thanks
Bruno Rodrigues

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> escreveu
na mensagem news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Bruno,

Why not have the base class reference a static imagelist which is loaded as needed from the resources?

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Bruno Rodrigues" <br*********@si plan.com.br> wrote in message
news:e1******** ******@tk2msftn gp13.phx.gbl...
Hi,

Everytime I use a image in a Windows Form, Visual Studio.Net creates the
image in the respective resx file. This can be very expensive in a project with about one hundred forms, where images of delete, insert and update

(for
example) appear several times.

The only way I found to optimize this is creating a Windows Form

with a
ImageList with all images, and inherit every form from this one. But
then I
would be loading in memory all images in every form.

Some idea?

Regards,
Bruno Rodrigues


Nov 16 '05 #3
Bruno,

You have two ways you can go with this. You can place all of the images
in the image list in the static constructor. The imagelist would be
publically accessible, as well as static.

The other would be to expose a method which would take the identifier
for the image. You would then check a hashtable for the identifier, to see
if it item exists. If it doesn't, then load the image from the resource
file, and store it in the hashtable. Of course, this method would be static
as well.

The imagelist solution will allow you to just bind most controls that
accept an imagelist (which can provide benefits).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Bruno Rodrigues" <br*********@si plan.com.br> wrote in message
news:OD******** ******@TK2MSFTN GP11.phx.gbl...
Nicholas,

How can I load the images as needed? Once I referr the imagelist, he is not loaded in the memory with all images?

Thanks
Bruno Rodrigues

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> escreveu na mensagem news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Bruno,

Why not have the base class reference a static imagelist which is

loaded
as needed from the resources?

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Bruno Rodrigues" <br*********@si plan.com.br> wrote in message
news:e1******** ******@tk2msftn gp13.phx.gbl...
Hi,

Everytime I use a image in a Windows Form, Visual Studio.Net
creates
the
image in the respective resx file. This can be very expensive in a project with about one hundred forms, where images of delete, insert and

update (for
example) appear several times.

The only way I found to optimize this is creating a Windows Form

with
a
ImageList with all images, and inherit every form from this one. But

then
I
would be loading in memory all images in every form.

Some idea?

Regards,
Bruno Rodrigues



Nov 16 '05 #4

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

Similar topics

0
1620
by: Anushya | last post by:
Hi I am trying to add image items to listview. Here how to handle if i need to add images?? Pls go thru the code. In the form where i have used this virtualListView, have handled QueryItemText.. And text alone is working fine.. using System; using System.Windows.Forms; using System.Diagnostics;
9
3503
by: Terrance | last post by:
Good Afternoon: I was hoping if someone could share some light on a problem that I'm facing. When I create a Visual Basic.Net program and I use the XP style for my Window Forms and buttons; if I add images to my menu buttons they don't show when the form is created. But, if I don't use the XP style the images show on my buttons correctly. Can someone please explain to me what the problem is and how to get around it? Here is how I'm calling...
3
3481
by: Dalan | last post by:
At first I was not certain what could cause Access 97 from displaying most jpeg images, but not all. After further testing, it seemed that all original images of less than 275 pixels per inch or less would display, but those close to 300 pixels/inch or greater would not (MS Access cannot recognize the file format xxx.jpg). The larger, original images were scanned and saved as .bmp (at 300 dpi producing a 15MB file). Then the images were...
0
1038
by: Enrique | last post by:
Hi, I am trying to create buttons with images at runtime I am doing thi Dataset ds ds = WebService1.ReadLines () ; // From windows Service ds.Merge (ds)
3
2227
by: mraj | last post by:
Hello... I am new to C#. My requirement is that, I will receive over 100s of images from the network to local machine and display these images on an image viewer one by one on mouse scroll. To improve the performance, I want these images to reside on the RAM instead of the hard disk. How do I load the images to the ram and access it to improve my performance. -- Mohan
2
8535
by: Sanjeeva Reddy | last post by:
hai Anti Keskinen, i have used the following code MyListView->LargeImageList->ImageSize = gcnew System::Drawing::Size(100, 100); // Sets large image size to 100, 100 here i am getting error like "gcnew is undeclared error",how to deeclare 'gcnew" and when i am using in runtime to change the size of images in imagelist in listview control in .net(forms application) by chnging one trckbar(like tb1->Value),
11
1490
by: Andy Chan | last post by:
First of all, thanks to Crirus and Fergus for helping me with a related posted a few days ago. Ok, I can add images to my form (for whatever reason I cannot added more than 1 image within the same procedure; rather I had to call the same "addimage" procedure over and over again to get it working). For anyone that's curious the code I used is the following: ----------------------------------------------------------------------------...
14
1452
by: EdB | last post by:
We are having an odd problem saving images. We capture customer signatures on a Palm Pilot and save them as points on a graph. We are able to reconstruct these points to display the signature, but when we attempt to save the file off so that we can pass it back to our customers we get an odd result. If we try to view the file using Windows Picture and Fax viewer, everything's ok. But try to view it using any other graphics program (such...
0
1479
by: Marcus Kwok | last post by:
I have written a class (Windows Form) in Managed C++ that accepts an array of image filenames and will display them sequentially. All images will be the same size. I got it to work, but I know something is not right because of the way I am using Application::DoEvents() (ref: http://www.codinghorror.com/blog/archives/000159.html and http://www.codinghorror.com/blog/archives/000370.html ), along with the fact that I get a crash when I try...
0
8999
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8836
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
9575
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9394
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
9338
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
9256
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
8260
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...
1
6803
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3322
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

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.