Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Design Time / January 2005

Tip: Looking for answers? Try searching our database.

bool - checkbox on design-time

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
choyk1 - 04 Jan 2005 00:47 GMT
Hi all,

How can I show checkbox for bool properties of my custom control in
design-time. The usage of 'DesignerVerb' shows just plain MenuItem.
I am wondering how TextBox control shows a CheckBox for MultiLine option,
for example. (See a TextBox control and its MultiLine option in VS.NET 2005
WinForm design mode)

Yongkee
Ulrich Sprick - 08 Jan 2005 18:13 GMT
Hi,
this one is easy (I hope):
1. Create an editor for such a property, and derive from UITypeEditor
2. Override GetEditStyle() and return UITypeEditorEditStyle.Dropdown I think
this should work.
3. Override EditValue() to dropdown a Listbox with the two strings, true and
false.
4. Override GetPaintValueSupported() and return true to indicate that you'd
like to paint a little checkbox.
5. Override PaintValue() to to the painting in the value cell of the
property. The Drawing namespace has static methods that paints buttons, I
think there should be one that paints a checkbox image. The PaintValue()
arguments provide everything needed for painting.
6. Decorate your bool property with the [Editor( typeof( yourEditorClass ),
typeof( UITypeEditor ))]. This associates the editor with your property.

There is a tutorial in the msdn documents, entitled "Enhancing Design-Time
Support" which has a link to a working sample.

HTH, ulrich

> Hi all,
>
[quoted text clipped - 5 lines]
>
> Yongkee

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.