473,385 Members | 1,588 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to put a clickable button on a PropertyGrid ?

I'm using the PropertyGrid control, and I want it to show a button.
But I set the PropertyGrid.SelectedObject with a object that as a Button
property, the PropertyGrid shows the buttons properties, and I want the
button to be shown as drawn and clickable button.

How can I do that?

--
Thanks
Sharon
Sep 20 '06 #1
5 15252
IIRC, you can just do grid.Controls.Add(); [and be sure to bring your
control to the front afterwards]

Note that PropertyGrid.Controls doesn't show in the list, but it works just
fine. A better approach, however, may be to add a "tab"; these (bizarrely)
display as buttons; they are implemented differently, but give you more
control - simply inherit from PropertyTab and implement the necessary
methods (such as GetProperties if you want to filter the list).

Just type "PropertyTab Class" into MSDN2 (making sure you get
System.Windows.Forms.Design in 2.0) and you get a nice example. Note also
that the first tab seems to be always hidden, so you may need to add another
clone of PropertiesTab if you want to be able to swith back ;-p [just
subclass PropertiesTab and don't change anything (maybe the image) to
achieve this]

Marc
Sep 20 '06 #2
Thanks a lot for your help.
But I'm afraid that I did not explain my self as I should have.

When I implemented your suggestion, I got a button on the PropertyGrid frame
part on top, but I need the button to be shown on one of the cells at the
right column of the PropertyGrid.
I need the button to be shown instead of the value cell. The user should see
a clickable button that he'll be able to click on to perform some kind of
operation.

There may be some more buttons to be shown on another PropertyGrid cells.

Can you help me with that?
--------
Thanks
Sharon
Sep 20 '06 #3
Oh, that!

You need to implement a UITypeEditor, which can provide either a popup or a
drop-down (both drawing whatever you want). If fixed drop-down (text) lists
and text editing / parsing are what you want, then you also need to look at
TypeConverter.

See MSDN: http://msdn2.microsoft.com/en-us/library/ms171840.aspx

(note that although you can support painting a preview in the grid, you
can't really put a button there until the user selects the drop-down; think
of the Dock /Anchor propertes for forms and you'll get the picture).

Note that this aspect of the component model can take some time to
understand, but it is very powerful.

Marc
Sep 20 '06 #4
Note the example I cited uses the drop-down approach; actually, the pop-up
(form) approach can be easier... google will be your friend here... you are
looking for UITypeEditorEditStyle.Modal - perhaps:
http://www.awprofessional.com/articl...&seqNum=5&rl=1

Note also that there are base-classes like the collections-editor that you
can extend through inheritance.

Marc
Sep 20 '06 #5
Hello Sharon,

with the Microsoft PropertyGrid, there will be no way to have a button
that fills all the value cell space. If you want to look into
commercial product, this is something that Smart PropertyGrid.Net can
do by creating a custom inplace control. You can have a look at
http://www.visualhint.com

Best regards,

Nicolas Cadilhac
VisualHint - Home of Smart PropertyGrid.Net

Sharon wrote:
Thanks a lot for your help.
But I'm afraid that I did not explain my self as I should have.

When I implemented your suggestion, I got a button on the PropertyGrid frame
part on top, but I need the button to be shown on one of the cells at the
right column of the PropertyGrid.
I need the button to be shown instead of the value cell. The user should see
a clickable button that he'll be able to click on to perform some kind of
operation.

There may be some more buttons to be shown on another PropertyGrid cells.

Can you help me with that?
--------
Thanks
Sharon
Sep 21 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Matt | last post by:
I want to understand the difference between submit button and regular button: <input type="submit"> and <input type="button">. My understanding is that submit button will send the entire HTML form...
1
by: Roedy Green | last post by:
..button /* clickable button */ { background-color : #f1f391; color : #7b3e00; border : 3px outset #d2d2d2; margin : 0px 2px 0px 2px; font-family :Arial,Helvetica,sans-serif; font-size : 120%;...
3
by: Nicolas | last post by:
I want to display in my application a PropertyGrid showing only the "Appearance" of a control (ie. textBox) so the user can change it. Bare with me, I'm new in csharp. Where do I go from:...
2
by: Mevar81 | last post by:
Hi to everybody.I have a problem with the PropertyGrid control.I want to display not all the properties of a generic Control(Button,TextBox,ComboBox,ecc.).In general I don't want to display only...
3
by: Pol Bawin | last post by:
Hi All, One : I have a property that get/set a array of an abstract class A By default my array is null In the propertygrid, It is not works correctly when my array is null. (when my array...
1
by: Sharon | last post by:
I'm using the PropertyGrid control, and I want it to show a button. But I set the PropertyGrid.SelectedObject with a object that as a Button property, the PropertyGrid shows the buttons properties,...
3
by: crazychrisy54 | last post by:
Hi there I just wondered if there is any way using GD to insert a clickable button or some clickable text into a image? It is possible to create images for buttons but what if you want a...
3
by: zb42 | last post by:
I have a _mc that I've added to the stage. On it's layers first frame I have this code that spins the _mc around and has some great effects: import fl.transitions.*; import...
1
by: Alkdarf | last post by:
I monitor door cameras with a third party application that gives me multiple video windows for the various video inputs in the card. I want to create an application that will overlay the video...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.