I'm trying to draw in C # with the graphics class, so I create a panel (to which I set width: 500 and height: 300) and execute it by printing the length and width of the panel by console and print to me that It is 375x244. Why does this happen?
Your question is not very clear, but if what it refers to is: Why does a panel change size at runtime?
There may be several factors, the form has a property called AutoScaleMode
it is advisable to assign the property as:
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
.
You must also make sure that the panel contains the Anchor
property such as:
panel1.Anchor = (AnchorStyles.Top | AnchorStyles.Left);
and property AutoSize
as panel1.AutoSize = false;
I hope it will be useful.