We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

changing border color of Textbox control

Thread ID:

Created:

Updated:

Platform:

Replies:

13982 May 14,2004 01:14 PM May 18,2004 12:16 PM Windows Forms 1
loading
Tags: FAQ
Hitesh
Asked On May 14, 2004 01:14 PM

Hello Everyone, I am trying to create a custom textbox control and set the border color to green. I have created a new class and defined the following: public class MyTextBox : TextBox { public Color m_Color; public MyTextBox() { } protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); int borderWidth = 1; ControlPaint.DrawBorder(e.Graphics, e.ClipRectangle, this.hitesh, borderWidth, ButtonBorderStyle.Solid, this.hitesh, borderWidth, ButtonBorderStyle.Solid, this.hitesh, borderWidth, ButtonBorderStyle.Solid, this.hitesh, borderWidth, ButtonBorderStyle.Solid); } After doing this, I am creating textbox control programatically on my form. However, I am not able to change the border color. If I try to create a button instead, everything works fine. Can somebody please suggest me what am I doing wrong here? Thanking you all, Hitesh

Administrator [Syncfusion]
Replied On May 18, 2004 12:16 PM

In short, the problem is that the border should be draw in the Non-Client area. Start by listening to the WM_NCPAINT in the WndProc override and go from there. You should look up some samples on how to paint in the NC area. -Praveen Syncufsion.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;