Click to See Complete Forum and Search --> : Splitting Image


Lord Zarm
July 17th, 2001, 09:38 AM
In code I want to take an image and split it into 24 different equal pieces, each in there own image control all 24 peices make up the whole picture minus the bottom right corner. How can i do this??

http://dewtech.20m.com/
Free software made in VC++

shree
July 17th, 2001, 11:21 AM
Here's the code for you:


private Sub Command1_Click()
Picture2.BorderStyle = 0
Picture2.AutoRedraw = true
wid = Picture1.ScaleWidth / 5
hgt = Picture1.ScaleHeight / 5
Picture2.Width = wid
Picture2.Height = hgt
Image1(0).Height = hgt
Image1(0).Width = wid

for i = 0 to 4
for j = 0 to 4
Picture2.PaintPicture Picture1.Image, 0, 0, wid, hgt, i * wid, j * hgt, wid, hgt
Index = i * 5 + j
If Index = 24 then Exit for
If Index <> 0 then Load Image1(Index)
Image1(Index).Left = Image1(0).Left + i * wid
Image1(Index).Top = Image1(0).Top + j * hgt
Image1(Index).Picture = Picture2.Image
Image1(Index).Visible = true
next
next
End Sub