準備一個圖片控制項pictureBox00,

準備9個radio控制項radioButton1~radioButton9

屬性

appearance: button

autosize: false

size:104, 104


private void Form1_Load(object sender, EventArgs e)
{
var imgarray = new Image[9];
var img = pictureBox00.Image;

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();
}
}


radioButton1.Image = imgarray[0];
radioButton2.Image = imgarray[1];
radioButton3.Image = imgarray[2];
radioButton4.Image = imgarray[3];
radioButton5.Image = imgarray[4];
radioButton6.Image = imgarray[5];
radioButton7.Image = imgarray[6];
radioButton8.Image = imgarray[7];
radioButton9.Image = imgarray[8];
}
}

 

Cut an Image into 9 pieces

arrow
arrow
    文章標籤
    c# vb.net 圖片擷取區域
    全站熱搜
    創作者介紹
    創作者 kinomelma 的頭像
    kinomelma

    基尼而絲(G.N.A.S)的大世界

    kinomelma 發表在 痞客邦 留言(0) 人氣()