Hi,
In my application i use many picture file (jpg and not icon file). I want all this picture merge into one file and then from vb i will access this file and extract right picture as parameter i passed. How to do this with VB?
Thanks
Printable View
Hi,
In my application i use many picture file (jpg and not icon file). I want all this picture merge into one file and then from vb i will access this file and extract right picture as parameter i passed. How to do this with VB?
Thanks
May I recommend the Microsoft PictureClip Control 6.0 (add it from the Project\Components menu). I think it will help you.
Here is the extract from MSDN:
########################################
The PictureClip control allows you to select an area of a source bitmap and then display the image of that area in a form or picture box. PictureClip controls are invisible at run time.
File Name
PICCLP32.OCX
Class Name
PictureClip
Remarks
The PictureClip control provides an efficient mechanism for storing multiple picture resources. Instead of using multiple bitmaps or icons, create a source bitmap that contains all the icon images required by your application. When you need to display an individual icon, use the PictureClip control to select the region in the source bitmap that contains that icon.
For example, you could use this control to store all the images needed to display a toolbox for your application. It is more efficient to store all of the toolbox images in a single PictureClip control than it is to store each image in a separate picture box. To do this, first create a source bitmap that contains all of the toolbar icons. The picture at the top of this topic is an example of such a bitmap.
Note For international localized applications, resource files are sometimes a more useful way to store bitmaps. For more information, refer to Chapter 16, "International Issues," in the Visual Basic Programmer's Guide.
You can specify the clipping region in the source bitmap in one of two ways:
Select any portion of the source bitmap as the clipping region. Specify the upper-left corner of the clipping region using the ClipX and ClipY properties. Specify the area of the clipping region using the ClipHeight and ClipWidth properties. This method is useful when you want to view a random portion of a bitmap.
Divide the source bitmap into a specified number of rows and columns. The result is a uniform matrix of picture cells numbered 0, 1, 2, and so on. You can display individual cells using the GraphicCell property. This method is useful when the source bitmap contains a palette of icons that you want to display individually, such as in a toolbar bitmap.
Load the source bitmap into the PictureClip control using the Picture property. You can load only bitmap (.bmp) files into the PictureClip control.
Distribution Note When you create and distribute applications that use the PictureClip control, you should install PicClp32.ocx in the customer's Microsoft Windows System or System32 subdirectory. The Setup Kit included with Visual Basic provides tools to help you write setup programs that install your applications correctly.
will try that, but will it take much memory?
Because i want to load only picture i need, mostly one at the time. After use it i will destroy it or replace it with another picture but i don't want picture to store as many single file on client computer, since if that so picture can be erased or changed by client.
Thanks
I'm not sure how much memory it would take. Obviously it depends on how many pictures you're storing.
Maybe you'd be better off storing your pictures in a database? I think this would be quite easy - the only challenge is working out how to make the database store a picture, but I imagine there are plenty of examples in this forum of how to do that.
If you're storing all the pictures as a single file you'll need enough memory to load all the pictures into memory every time you need to access one of them, unless you know where in the file each picture is, and you access the file in binary mode, just getting those bytes that make up that picture (which can be exceedingly slow).
It's a trade-off between speed, memory size and number of files. As the number of files gets smaller, the speed gets slower and the needed memory gets larger. You can't make it smaller faster and fewer files all at the same time.