وسط چین کردن فرم
private void Form1_Load(object sender, System.EventArgs e)
{
Graphics graphics = this.CreateGraphics();
double startingPoint = (this<.Width / 2) - (graphics.MeasureString(this.Text.Trim(),this.Font).Width / 2);
double widthOfASpace = graphics.MeasureString(" ", this.Font).Width;
temp = " ";
double tempWidth = 0;
while ((tempWidth + widthOfASpace) startingPoint)
{
temp += " ";
tempWidth += widthOfASpace;
}
this.Text = temp + this.Text.Trim();
}
+ نوشته شده در شنبه بیست و دوم شهریور ۱۳۹۹ ساعت 13:55 توسط محسن
|