CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Splitting Image

  1. #1
    Join Date
    Feb 2001
    Location
    New Jersey
    Posts
    312

    Splitting Image

    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++
    http://www.dewgames.com
    Shareware and Free games!

  2. #2
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: Splitting Image

    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





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured