create customize control
-
You can inherit a control from System.Windows.Forms.Label and override its OnPaint event:
// Constructor
public BorderLabel() {
InitializeComponent();
this.Paint += new System.Windows.Forms.PaintEventHandler(BorderLabel_Paint);
}// Event
void BorderLabel_Paint(object sender, System.Windows.Forms.PaintEventArgs e) {
Brush brush = new SolidBrush(Color.Red);
Pen pen = new Pen(brush);
Rectangle rect = e.ClipRectangle;// this is needed to see the right and bottom edges
rect.Inflate(-1, -1);e.Graphics.DrawRectangle(pen, rect);
}Regards, Lev
modified on Thursday, January 8, 2009 6:15 AM
-
You can inherit a control from System.Windows.Forms.Label and override its OnPaint event:
// Constructor
public BorderLabel() {
InitializeComponent();
this.Paint += new System.Windows.Forms.PaintEventHandler(BorderLabel_Paint);
}// Event
void BorderLabel_Paint(object sender, System.Windows.Forms.PaintEventArgs e) {
Brush brush = new SolidBrush(Color.Red);
Pen pen = new Pen(brush);
Rectangle rect = e.ClipRectangle;// this is needed to see the right and bottom edges
rect.Inflate(-1, -1);e.Graphics.DrawRectangle(pen, rect);
}Regards, Lev
modified on Thursday, January 8, 2009 6:15 AM
Lev Danielyan wrote:
OnPain event
I know that one well! :laugh:
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) -
Lev Danielyan wrote:
OnPain event
I know that one well! :laugh:
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)I wish I did it on purpose :laugh: :laugh:
Regards, Lev