Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8983127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:45:33+00:00 2026-06-15T20:45:33+00:00

Possible Duplicate: Image splitting into 9 pieces Though I googled enough but unfortunately failed

  • 0

Possible Duplicate:
Image splitting into 9 pieces

Though I googled enough but unfortunately failed to find a help. This Code Project Tutorial also failed to serve me what I actually need.

I have an Image and 9 PictureBox(s) in a WinForm.

Image img = Image.FromFile("media\\a.png"); // a.png has 312X312 width and height
//          some code help, to get
//          img1, img2, img3, img4, img5, img6, img7, img8, img9
//          having equal width and height
//          then...
pictureBox1.Image = img1;
pictureBox2.Image = img2;
pictureBox3.Image = img3;
pictureBox4.Image = img4;
pictureBox5.Image = img5;
pictureBox6.Image = img6;
pictureBox7.Image = img7;
pictureBox8.Image = img8;
pictureBox9.Image = img9;

Here is an example Image for you:

enter image description here

This is a part of my Picture Puzzle class project. I have done with photoshop images, now want to dynamically cut.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:45:34+00:00Added an answer on June 15, 2026 at 8:45 pm

    First off, instead of using img1, img2… use an array with a size of 9. Then it’s much easier to do this using a couple of loops like this:

    var imgarray = new Image[9];
    var img = Image.FromFile("media\\a.png");
    for( int i = 0; i < 3; i++){
      for( int j = 0; j < 3; j++){
        var index = i*3+j;
        imgarray[index] = new Bitmap(104,104);
        var graphics = Graphics.FromImage(imgarray[index]);
        graphics.DrawImage( img, new Rectangle(0,0,104,104), new Rectangle(i*104, j*104,104,104), GraphicsUnit.Pixel);
        graphics.Dispose();
      }
    }
    

    Then you can fill your boxes like this:

    pictureBox1.Image = imgarray[0];
    pictureBox2.Image = imgarray[1];
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: WPF Image to byte[] Relative to this I have a BitmapSource image
Possible Duplicate: Get image data in Javascript? Convert an image into binary data in
Possible Duplicate: Foursquare API for venue user image error I first noticed this problem
Possible Duplicate: C# 4.0 unlock image after creating BitmapImage I have this code to
Possible Duplicate: Image resizing web service many web provider have support for php but
Possible Duplicate: How to add an image in mapview balloon? this is a code
Possible Duplicate: vertical alignment of image inside a div OK, this what I'm trying
Possible Duplicate: Remove white space below image I have this page HERE . All
Possible Duplicate: Drawing an image from a data URL to a canvas This is
Possible Duplicate: Set size on background image with CSS? I need to find a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.