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. Image for the cookie policy date

Getting subclass to show up in Toolbox

I''m trying to subclass TextBoxExt to add certain behaviors. I added a file called MyTextBox.cs to my project in VS.Net 2003 which reads: [using and namespace stuff] public class MyTextBox : Syncfusion.Windows.Forms.Tools.TextBoxExt { public const int WM_PAINT = 0xf; //Move constant protected override void WndProc(ref Message m) { base.WndProc (ref m); if(WM_PAINT==m.Msg) { PaintEventArgs pea = new PaintEventArgs(CreateGraphics(), Bounds); OnPaint(pea); } } protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { base.OnPaint(e); Graphics g = e.Graphics; g.DrawRectangle(Pens.HotPink, 1, 1, 5, 5); } it seems to compile ok, but I was expecting it to automatically show up in the My User Controls section of the toolbox. Am I missing something? (Also, is this the best way to draw some extra stuff on top of a TextBoxExt?) Thank you, dan

3 Replies

AD Administrator Syncfusion Team May 21, 2004 01:17 PM UTC

Hi Dan, To be able to perform drawing on the client area of TextBoxExt, you would have to invoke its SetStyle method using the ControlStyles.UserPaint enum value. But when this is set, the system delegates the entire drawing responsibility to the user, and the user would have take of every detail like the borders, text, cursor etc. To be able to add your control to the VS.Net''s ToolBox please follow the steps given below : Right click on the ToolBox >> Add/Remove Items >> Click on Browse button >> Navigate to the exe file of your project >> Select it Please try this and let me know if you need further assistance. Regards, Guru Patwal Syncfusion, Inc.

AD Administrator Syncfusion Team May 21, 2004 11:36 PM UTC

> To be able to add your control to the VS.Net''''s ToolBox please follow the steps given below ... Excellent; that works. Do you know if it will correctly pick up whether I''m doing a debug vs. release build?

AD Administrator Syncfusion Team May 22, 2004 12:13 AM UTC

Oh. never mind, it seems to just add the code, so it should deal with debug/release ok. Thanks.

Live Chat Icon For mobile
Up arrow icon