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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Getting subclass to show up in Toolbox

Thread ID:

Created:

Updated:

Platform:

Replies:

14202 May 20,2004 05:23 PM UTC May 22,2004 12:13 AM UTC WinForms 3
loading
Tags: Tools
Administrator [Syncfusion]
Asked On May 20, 2004 05:23 PM UTC

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

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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?

Administrator [Syncfusion]
Replied On 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.

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.

Warning Icon 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.Close Icon

;