English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

well the problem is i want to use 1 image and cut it in 4 pieces so i can make a buttons hover and pressed and down and disabled state out of 1 image file...iv been searching in google but i cant find any info....does anyone know what this is called trying to and use parts of a image and display the parts in different picture boxes....im using vb 6 and vb.net...if anyone has any info on how to do this then plz help...thank you....im really looking for a link with a example...plz give me all info on this thanks again.

2007-02-16 02:34:34 · 4 answers · asked by nasser_matrix 1 in Computers & Internet Programming & Design

i want to load just 1 gif or bmp and cut it in a few pieces and display them pieces in different picture boxes...

2007-02-16 02:36:20 · update #1

i dont mean a image editing program...i want to make 1 image and cut the image with visual basic code and display the cut images in a picture box.....like the xp visual style has...it has 1 image with all 4 hover states of a button and it cuts them and displays them as a buttons 4 states....

2007-02-16 03:25:45 · update #2

4 answers

What you are asking about is called a rollover image.

You'll need an image editing program to achieve what you are after. http://www.gimp.com and http://www.irfanview.com are free ones.

2007-02-16 03:20:54 · answer #1 · answered by Anonymous · 0 0

I don't think VB will cut it up for you on Load, but maybe you can trick it out like this.

Set your frame for the picture..let's say it's 4" x 4"

Make 4 - 2" x 2" frames and place them over the top (bring to front) of the first frame to create your 4 pieces. Make them transparent and don't put anything in them so on Load, you should see the picture behind them.

Then make your mouseover events on the 4 frames.

Hope that helps

2007-02-16 12:52:19 · answer #2 · answered by rod 6 · 0 0

I'm not sure how to do it using VB, but you could use an Imagemap in HTML. This is how its normally done. If you want each element to act independently when doing a mouse over or mouse down event, then you will need to overlay separate images over your image map and place events on those.

http://www.ihip.com/

2007-02-16 11:30:57 · answer #3 · answered by gstier42 1 · 0 0

The functionality you're looking for is in the Graphics class. Not sure why you'd want to do it that way, but here's a place to start (c#, but easy enough to get to VB):

private Bitmap sliceImage(Bitmap patient)
{

Rectangle sliceRec = new Rectangle(this.Location, this.Size);
Bitmap theSlice = new Bitmap(sliceRec.Width, sliceRec.Height);

Graphics g = Graphics.FromImage(theSlice);
g.DrawImage(patient, sliceRec, Location.X, Location.Y, 5, 5, GraphicsUnit.Pixel);
g.Dispose();
return theSlice;

} // close private void sliceImage(Image patient)

2007-02-16 12:48:40 · answer #4 · answered by King Awesome 2 · 0 0

fedest.com, questions and answers