Click here to Skip to main content
16,013,082 members
Home / Discussions / C#
   

C#

 
GeneralRe: WebBrowser in .NET Applications Pin
Richard Deeming11-Jun-02 4:25
mveRichard Deeming11-Jun-02 4:25 
GeneralDisplaying sub Properties in PropertyGrid Pin
leppie10-Jun-02 0:51
leppie10-Jun-02 0:51 
GeneralRe: Displaying sub Properties in PropertyGrid Pin
Mazdak10-Jun-02 1:06
Mazdak10-Jun-02 1:06 
GeneralRe: Displaying sub Properties in PropertyGrid Pin
leppie10-Jun-02 1:14
leppie10-Jun-02 1:14 
GeneralRe: Displaying sub Properties in PropertyGrid Pin
Rama Krishna Vavilala10-Jun-02 1:48
Rama Krishna Vavilala10-Jun-02 1:48 
GeneralRe: Displaying sub Properties in PropertyGrid Pin
leppie10-Jun-02 1:48
leppie10-Jun-02 1:48 
GeneralRe: Displaying sub Properties in PropertyGrid Pin
James T. Johnson10-Jun-02 2:21
James T. Johnson10-Jun-02 2:21 
GeneralRe: Displaying sub Properties in PropertyGrid Pin
leppie10-Jun-02 3:43
leppie10-Jun-02 3:43 
Hi, no need to go thru all that for 2 properties Smile | :)

Code snippet of how i did it:

UPDATE: add the following line whereever u add the typeconvertor else properties wont be saved by the designer.

<br />
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]<br />


My Custom Control Class
...
<br />
[TypeConverter("System.ComponentModel.ExpandableObjectConverter")]<br />
public Borders Borders <br />
{<br />
	get {return this.borders;}<br />
	set <br />
	{<br />
		this.borders = value;<br />
	}<br />
}<br />
<br />
...<br />


Then for each public Property in my class (iow Left, Right, etc) i added:
<br />
<br />
[TypeConverter("System.ComponentModel.ExpandableObjectConverter")]<br />


Use this till you get to primitive types or have Editors for the Property.

Hope this helps Smile | :)

Cool | :cool:

PS: If you do not want the class name to appear, just override the ToString() function to something better like this:
<br />
public override string ToString()<br />
{<br />
	return "Click to expand...";<br />
}<br />

or
<br />
public override string ToString()<br />
{<br />
	return "Width: " + width + " Style: " + style.ToString() + " Margin: " + margin;<br />
}<br />

GeneralRe: Displaying sub Properties in PropertyGrid Pin
James T. Johnson10-Jun-02 11:15
James T. Johnson10-Jun-02 11:15 
GeneralRe: Displaying sub Properties in PropertyGrid Pin
leppie10-Jun-02 11:44
leppie10-Jun-02 11:44 
Generaldetecting a key press... Pin
8-Jun-02 16:28
suss8-Jun-02 16:28 
GeneralRe: detecting a key press... Pin
Nick Parker8-Jun-02 18:55
protectorNick Parker8-Jun-02 18:55 
GeneralRe: detecting a key press... Pin
Nish Nishant8-Jun-02 19:25
sitebuilderNish Nishant8-Jun-02 19:25 
GeneralRe: detecting a key press... Pin
Nick Parker8-Jun-02 19:34
protectorNick Parker8-Jun-02 19:34 
GeneralRe: detecting a key press... Pin
Rama Krishna Vavilala9-Jun-02 1:03
Rama Krishna Vavilala9-Jun-02 1:03 
GeneralRe: detecting a key press... Pin
9-Jun-02 5:11
suss9-Jun-02 5:11 
GeneralRe: detecting a key press... Pin
Humpo9-Jun-02 7:24
Humpo9-Jun-02 7:24 
GeneralRe: detecting a key press... Pin
Rama Krishna Vavilala9-Jun-02 9:58
Rama Krishna Vavilala9-Jun-02 9:58 
GeneralRe: detecting a key press... Pin
Rama Krishna Vavilala9-Jun-02 10:01
Rama Krishna Vavilala9-Jun-02 10:01 
GeneralRe: detecting a key press... Pin
9-Jun-02 11:49
suss9-Jun-02 11:49 
GeneralRe: detecting a key press... Pin
Humpo9-Jun-02 12:04
Humpo9-Jun-02 12:04 
QuestionUse \ in string? Pin
Brian Olej8-Jun-02 12:37
Brian Olej8-Jun-02 12:37 
AnswerRe: Use \ in string? Pin
James T. Johnson8-Jun-02 13:05
James T. Johnson8-Jun-02 13:05 
GeneralRe: Use \ in string? Pin
Brian Olej8-Jun-02 14:22
Brian Olej8-Jun-02 14:22 
AnswerRe: Use \ in string? Pin
Nick Parker8-Jun-02 18:43
protectorNick Parker8-Jun-02 18:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.