Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 8th, 2007, 6:43 AM   #1
InfoGeek
Professional Programmer
 
InfoGeek's Avatar
 
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4 InfoGeek is on a distinguished road
How to add inherited control to toolbox.

Hi all.
I created a custom control by inheriting the trackbar control. It works fine but I've to write code every time I need to add that control to a form. I want that the users of the control should be able to drag and drop the control from the toolbox (like all the other controls) but the control isn't showing in the toolbox.

Any Ideas how to go about that?
__________________
PFO - My daily dose of technology.
InfoGeek is offline   Reply With Quote
Old Feb 8th, 2007, 8:37 AM   #2
r30
Newbie
 
Join Date: Feb 2007
Posts: 3
Rep Power: 0 r30 is on a distinguished road
Assuming you started your project as a Windows Control Library:



Open a new instance of the VS .NET. Create a new project choosing the Windows Application template.

From a new Windows Forms project, we can add the compiled custom control to the toolbox. I do this by right-clicking the toolbox, selecting Customize Toolbox, and from the .NET Framework Components tab, clicking Browse and locating the Control Library DLL. The component will then appear in the Toolbox.
r30 is offline   Reply With Quote
Old Feb 8th, 2007, 8:59 PM   #3
InfoGeek
Professional Programmer
 
InfoGeek's Avatar
 
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4 InfoGeek is on a distinguished road
I think you didn't understand what I meant.

If I create a UserControl, I can edit the appearance and put other controls on it at design time. But I wanted to directly inherit from TrackBar and by not putting the TrackBar on UserControl. I simply created a class file having code something like:
public class myTrackbar: Trackbar
{
  ...
}

If I create a UserControl, then after compilation, the control is automatically added to the toolbox. But for inherited control I have to write code like:

private myTrackBar tb1;

...

tb1 = new TrackBar();
...
this.controls.add(tb1);
...

??
__________________
PFO - My daily dose of technology.
InfoGeek is offline   Reply With Quote
Old Feb 8th, 2007, 9:12 PM   #4
InfoGeek
Professional Programmer
 
InfoGeek's Avatar
 
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4 InfoGeek is on a distinguished road
Solved!

I figured out that I needed to create a myTrackbar.Designer.cs file.
__________________
PFO - My daily dose of technology.
InfoGeek is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Coding standards without control? martinig Other Programming Languages 1 Dec 4th, 2006 7:04 AM
questions on windows sendMessage and RichEdit control nomer C++ 1 Mar 3rd, 2006 2:51 AM
Multiple sets of radio buttons -- Win32 API uman C++ 11 Jun 6th, 2005 10:35 PM
C programing control of the Serial Port. Light C++ 5 Feb 24th, 2005 2:14 PM
Show web user control hidden see07 C# 1 Feb 2nd, 2005 10:35 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:14 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC