I would like to know how to give margins to the pictureBox in C #, I currently have this code:
posX = posX + 100;
PictureBox pic = new PictureBox();
pic.Location = new Point(posX, 50);
pic.Name = "pic" + z;
pic.Size = new Size(100, 100);
pic.ImageLocation = directoriosE[z];
pic.Margin = new Padding(100); --- deberia setear un valor al padding
In the last line I'm doing an equalization from margin to padding, but I did not find any function that was like this new Margin(100);
and it was the only one that came closer, anyway it does not generate the setting of margins like me I was waiting.
Example of the current window.
As you can see, I would like to separate by means of margins each of my elements that is generated through a for cycle.
Also do it with the following code:
Thickness margin = pic.Margin;
margin.Left = 10;
pic.Margin = margin;
But I got the following error:
Can not find the name or type of namespace Thickness, missing a using directive or an assembly reference
I also did it in the following way:
pic.Margin = new Padding(50,50,50,50);
But in the same way I do not apply the margin I am asking for. If I debug my application and position myself on my pic in the line where I set the maregenes, it gives me the following: