PDA

View Full Version : سوال: کشیدن حاشیه برای فرم



kamran_14
جمعه 27 شهریور 1394, 11:19 صبح
سلام
1- می خوام برای فرم حاشیه بکشم و خاصیت formBorderstyle خودشو None کنم
من اینکار رو کردم برای فرم خودم حاشیه کشیدم با دو دور یعنی ضخامت برابر 2 هست. آیا روشی بهتر از این نیست؟

// ایجاد حاشیه برای فرم
void borderForm()
{
Graphics g = this.CreateGraphics();
g.DrawLine(new Pen(Color.FromArgb(180, 190, 200)), 0, 0, 0, this.Height);
g.DrawLine(new Pen(Color.FromArgb(180, 190, 200)), 1, 0, 1, this.Height);
g.DrawLine(new Pen(Color.FromArgb(180, 180, 180)), 0, this.Height, this.Width, this.Height);
g.DrawLine(new Pen(Color.FromArgb(180, 180, 180)), 0, this.Height - 1, this.Width, this.Height - 1);
g.DrawLine(new Pen(Color.FromArgb(180, 180, 200)), this.Width, 0, this.Width, this.Height);
g.DrawLine(new Pen(Color.FromArgb(180, 180, 200)), this.Width - 1, 0, this.Width - 1, this.Height);
}

mahdi87_gh
جمعه 27 شهریور 1394, 12:37 عصر
راحت تر اینه که یک پنل یا گروپ باکس بزاری و سایر چیزها رو بزاری داخل اون. بعد واسه پنل یا گروپ باکس border رو تنظیم کنی