winforms - Convert a PictureBox to an array in C# -
how can convert , save picturebox array, want save place of picturebox array. thanks.
for example:
picarray[1,0] = picturebox21 // place of array = picturebo21 edited:
i took 2 dimension array:
picturebox[,] pic = new picturebox[8,8]; now how can assign parameter each dimension? (for example i=8,j=8) thanks.
according understand of requirements, want array of pictureboxes. easiest method array of type picturebox :d
so begin defining it
picturebox[] mypicboxarray = new picturebox[10]; now have array of 10 picture boxes.
you can use after that
mypicboxarray[0] = mypicturebox //already existing picturebox hope helps :)
update
again intentions bit vague.
setting value multi-dimension array similar.
you write
picturebox[,] pic = new picturebox[x,y]; pic[a,b] = myexistingpicturebox //a , b value `0 <= < x` , `0 <= b < y` if talking assigning dimensions, can use nested for loop.
int x=3; int y=3; for(int i=0; < x;i++) { for(int j=0; j < y; j++) { pic[i,j] = somepicturebox; console.writeline(string.format("[i,j] = [{0},{1}]",i,j)); } } this function assign somepicturebox dimensions of pic , output
[i,j] = [0,0] [i,j] = [0,1] [i,j] = [0,2] [i,j] = [1,0] [i,j] = [1,1] [i,j] = [1,2] [i,j] = [2,0] [i,j] = [2,1] [i,j] = [2,2]
Comments
Post a Comment