Click here to Skip to main content
15,900,258 members
Home / Discussions / C#
   

C#

 
GeneralRe: handling unicode Pin
cshivaprasad22-Feb-06 2:19
cshivaprasad22-Feb-06 2:19 
AnswerRe: handling unicode Pin
Christian Graus21-Feb-06 17:56
protectorChristian Graus21-Feb-06 17:56 
GeneralRe: handling unicode Pin
Le centriste22-Feb-06 1:22
Le centriste22-Feb-06 1:22 
Questionwhy do i get "object reference not set to an instance of an object" Pin
aqui_i21-Feb-06 16:07
aqui_i21-Feb-06 16:07 
AnswerRe: why do i get "object reference not set to an instance of an object" Pin
Christian Graus21-Feb-06 16:15
protectorChristian Graus21-Feb-06 16:15 
QuestionAbout Windows Service. Pin
tianwei0221-Feb-06 16:04
tianwei0221-Feb-06 16:04 
Questiondeserialize to C# class from external config file? Pin
Tom Paluzzi21-Feb-06 15:50
Tom Paluzzi21-Feb-06 15:50 
QuestionUgh! Property Grid Pin
gantww21-Feb-06 14:01
gantww21-Feb-06 14:01 
Hello all,
Does anyone know how to add commands to the bottom of a property grid at runtime? Let me describe my situation.

I've created a class called PropertyGridProxy that implements ICustomTypeDescriptor and can be initialized with any object. At the moment, most things simply pass through to the default TypeDescriptor implementation. However, that's soon to change, as I will be creating some attributes that help me in working with the property grid. This ICustomTypeDescriptor implementation will read those attributes to produce the list of possible values for some of the properties exposed in the grid (instead of just using the default implementation).

Now, I've also created a designer that should (theoretically) wrap PropertyGridProxy for the property grid's consumption. It inherits from System.ComponentModel.Design.ComponentDesigner and overrides the Verbs property, which should return a DesignerVerb collection. I've applied the following attribute to the top of the PropertyGridProxy class:

[Designer(typeof(PropertyGridProxyDesigner))]

This should work according to the (rather useless) documentation I've found so far on MSDN, but it doesn't seem to be picking up the PropertyGridProxyDesigner class. I even had the designer throw an exception in its constructor, but nothing ever came of it. I therefore suspect that it isn't being called at all. Needless to say, the verbs property is never being used. Have I done something wrong?

Oh, the code in the Verbs property is as follows. ActionVerb is a custom attribute class that lets you tack a string name onto a method for calling it from a UI:

<br />
public override DesignerVerbCollection Verbs<br />
        {<br />
            get<br />
            {<br />
                System.Diagnostics.Debug.Write("Verbs collection accessed.");<br />
                DesignerVerbCollection ret = new DesignerVerbCollection();<br />
                PropertyGridProxy pGrid = this.Component as PropertyGridProxy;<br />
                if (pGrid != null)<br />
                {<br />
                    Type t = pGrid.TargetType;<br />
                    foreach (MethodInfo mi in t.GetMethods())<br />
                    {<br />
                        foreach (object o in mi.GetCustomAttributes(true))<br />
                        {<br />
                            ActionVerb attrib = o as ActionVerb;<br />
                            if (attrib != null)<br />
                            {<br />
                                Delegate handler = EventHandler.CreateDelegate(t, this.Component, mi);<br />
                                EventHandler eh = (EventHandler)handler;<br />
                                DesignerVerb verb = new DesignerVerb(attrib.VerbText, eh);<br />
                                ret.Add(verb);<br />
                            }<br />
                        }<br />
                    }<br />
                }<br />
<br />
                return ret;<br />
            }<br />
        }<br />


Thanks,
Will
QuestionNeed Help Creating Pop Up WinForm Pin
ilan_dalal21-Feb-06 11:55
ilan_dalal21-Feb-06 11:55 
AnswerRe: Need Help Creating Pop Up WinForm Pin
KaptinKrunch21-Feb-06 12:17
KaptinKrunch21-Feb-06 12:17 
QuestionRe: Need Help Creating Pop Up WinForm Pin
ilan_dalal21-Feb-06 23:49
ilan_dalal21-Feb-06 23:49 
AnswerRe: Need Help Creating Pop Up WinForm Pin
ilan_dalal22-Feb-06 2:25
ilan_dalal22-Feb-06 2:25 
QuestionVertical alignment of text WITHOUT rotating graphics object Pin
buelentc21-Feb-06 11:43
buelentc21-Feb-06 11:43 
AnswerRe: Vertical alignment of text WITHOUT rotating graphics object Pin
Judah Gabriel Himango21-Feb-06 13:32
sponsorJudah Gabriel Himango21-Feb-06 13:32 
QuestionHow to Print a Page in Visual Studio 2003 by using C# ? Pin
Abubakarsb21-Feb-06 11:42
Abubakarsb21-Feb-06 11:42 
QuestionHow to use OpenGL in c# ? Pin
hdv21221-Feb-06 11:38
hdv21221-Feb-06 11:38 
AnswerRe: How to use OpenGL in c# ? Pin
Judah Gabriel Himango21-Feb-06 11:55
sponsorJudah Gabriel Himango21-Feb-06 11:55 
QuestionHow to Check For Network Connection? Pin
cyrus_thevirus21-Feb-06 11:32
cyrus_thevirus21-Feb-06 11:32 
AnswerRe: How to Check For Network Connection? Pin
gnjunge21-Feb-06 23:36
gnjunge21-Feb-06 23:36 
QuestionObject Binding - RDLC report (nested obj's) Pin
Susan Hernandez21-Feb-06 9:59
Susan Hernandez21-Feb-06 9:59 
QuestionCompare 2 digits Pin
cppdotnet21-Feb-06 9:34
cppdotnet21-Feb-06 9:34 
AnswerRe: Compare 2 digits Pin
Guffa21-Feb-06 10:07
Guffa21-Feb-06 10:07 
GeneralRe: Compare 2 digits Pin
cppdotnet21-Feb-06 10:31
cppdotnet21-Feb-06 10:31 
QuestionTristate checkboxes in TreeView? Pin
Luis Alonso Ramos21-Feb-06 9:26
Luis Alonso Ramos21-Feb-06 9:26 
AnswerRe: Tristate checkboxes in TreeView? Pin
Joe Woodbury21-Feb-06 10:41
professionalJoe Woodbury21-Feb-06 10:41 

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.