c# - How to fix the size of my TableLayoutPanel-pictures? -


i have problem tablelayoutpanel. every cell contains picturebox, when display tablelayoutpanel (with pictures), appears "spaces" between pictures... how fix ?

please have @ see problem

here code :

private void button1_click(object sender, eventargs e) {     _hauteurmap = convert.toint32(numericupdown1.value);     _largeurmap = convert.toint32(numericupdown2.value);      tablelayoutpanel1.columncount = _largeurmap;     tablelayoutpanel1.rowcount = _hauteurmap;      tablelayoutpanel1.controls.clear();      int i, j;      (i = 0; < _hauteurmap; i++)     {         (j = 0; j < _largeurmap; j++)         {             picturebox pb = new picturebox             {                 size = new size(20, 20),                 sizemode = pictureboxsizemode.autosize             };              pb.image = image.fromfile("c:/users/sébastien/documents/visual studio 2010/projects/isometrictileengine_ite/isometrictileengine_ite/bin/images/empty_tile.png");             tablelayoutpanel1.controls.add(pb, j, i);         }     } } 

maybe pictures have margins. try :

picturebox pb = new picturebox {     size = new size(20, 20),     margin = new padding(0) }; 

Comments