السلام عليكم
كيف اغير لون border لـ panel ؟؟؟؟؟؟؟؟؟؟؟
السلام عليكم
كيف اغير لون border لـ panel ؟؟؟؟؟؟؟؟؟؟؟
السلام عليكم
فى الحدث Paint
private void panel2_Paint(object sender, PaintEventArgs e)
{
Rectangle rect = e.ClipRectangle;
rect.Width--;
rect.Height--;
//choose color for pen to draw rectangle
e.Graphics.DrawRectangle(Pens.Black, rect);
}تم تعديل هذه المشاركة بواسطة SOLO.NET في 28 فبراير 2014 في 01:19
VB.NET and C# Comparison
http://www.harding.edu/fmccown/vbnet_csharp_comparison.html
=-=-=-=-=-=-=
ذو العلم يشقى فى النعيم بعلمه .:. واخو الجهالة فى الشقاوة ينعم
=-=-=-=-=-=-=
يا من بدنياه اشتغل . قد غره طول الأمل . فالموت يأتى بغتة . والقبر صندوق العمل
=-=-=-=-=-=-=
ان لم تستطع ان تجد ما تفعله فافعل ما لم تسطع ان تجده

بالفعل الكود يعمل .............
شكراً لك
وهناك كود اخر مشابه قد وجدته ولكنه طويل
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace mySpace
{
class MyPanel : Panel
{
private Color colorBorder = Color.Transparent;
public MyPanel()
: base()
{
this.SetStyle(ControlStyles.UserPaint, true);
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.DrawRectangle(
new Pen(
new SolidBrush(colorBorder),2),
e.ClipRectangle);
}
public Color BorderColor
{
get
{
return colorBorder;
}
set
{
colorBorder = value;
}
}
}
}