GDI handles icons. L
I have a winforms application. I have a custom control with a lot of icons. a user can load this control on a form many times (in a tabbed layout). right now i am loading icons every time the control is created (can be up to 50 times in the application). is there a way to cache these icons in the app. if I did it, it would reduce the number of gdi descriptors I use as it becomes a problem.
source to share
You can create a singleton class for each icon. The first link creates a handle. Subsequent calls use the existing descriptor.
Without knowing more about your user, my next suggestion can only be very general. But you can have one raster layer on which you paint all your icons. The rest of your custom control will exist above and around this bitmap.
Unfortunately, this idea can be problematic. Require you to refactor the code that you are all willing to use for icon layout. Finally, it is not fundamental to how control mold structures work ideally.
We are facing an input form resource issue for the parametric form that we ship with our CAM software. Too many text entries caused various forms of weirdness and leaks. So we instead created labels with borders that looked like text entries and had ONE text input (and combo entry). When the user enters tabs, enters or clicks one text entry moved to a new entry and the label has been adjusted for the previous entry.
It's a completely intuitive setup than how you usually code it, but it was the only way to deal with our resource issue.
In my experience, it looks like there are problems with GUIs when you have to deal with tens or hundreds of records and that you must approach the problem using a different design.
source to share