How to make something similar to Visual C# 2008 properties window? - c#

What interests me is everything below the bar with buttons that determine how the properties are displayed. All I can figure out is there is a splitter and a status strip.
What I'm after is how there are 2 sections which I want to add the titles Property and Value, the sections can be resized with a splitter (I assume a splitter is used in this case), each property can be selected and the corresponding description appears on the status strip, and each value can either be text or a dropdown box.
The coding part I can probably do by myself, what I need to know is what controls the window is made up of and how it's put together.

You are referring to the PropertyGrid control. It's in the ToolBox.
See Getting the Most Out of the .NET Framework PropertyGrid Control

This is the PropertyGrid, and can be used directly. There is no need to reinvent the wheel here...

Related

How to alter between to different fields with a checkbox?

I am designing a windows form in C# and there is a checkbox called "electronic delivery". Under it is a field for "email address". Now I would like to add the option that the email field is only visible if checkbox is checked.
If checkbox is not checked, I would like to have a different field there.
I know how to handle this on the code side, to make things visible/hidden, but how do I place the fields in the form? Should I place one on top of another? Then I won't be able to access the one below to change it's properties.
Or should I keep only one filed and change it's name inside the code?
You could place your controls in FlowLayoutPanel control. The FlowLayoutPanel control arranges its contents dynamically in a horizontal or vertical flow direction.
You could just place them one on top of the other as you suggested. You said you did not want to do this because it would make selecting the properties of the controls difficult.
You can select a control from the combobox drop down menu on the properties section of Visual Studio.
You should create two Different Panels and Add Objects based on the Requirement. After Put visible and Hide Code in the Check Box Checked Event.
Try Panels it Will Work.
You can Simple Move Panel Along with all you objects which make it super Easy.

How to make message entry/list/view in C#

He I am a beginner to C# and I am working on a reaction manager plug-in for some bigger project. (Yes I am a intern)
Now I just can't find a way to create a view similar to this:
My full design:
How to realize this design? I cant find any default templates in the devexpress which are suitable for this. I come from php and in php I can use html. I am a beginner to C# and I don't have any clue on how t do this. Do I have to use canvas to literally draw this? OR is there a standard template I can use for this purpose.
You have many comment boxes that contain the same layout - a label comment text, author name, date, etc. There is no control that lays things out like that, you will have to make your own custom control (Project->Add User Control). This control will be a composite control - ie made up of other controls. Probably a label for each text field (comment, author, date, etc) laid out in the right places. Maybe call it CommentBox or something.
Then in the main form you now have available CommentBox controls which you can add to the form. Create a panel to put them in so you have many CommentBox controls in the panel, one for each comment (or maybe add them at runtime).
Now in WPF it's slightly easier because there is a StackPanel control that you can simply add controls to and it automatically arranges them vertically one beneath another in a stacked list. In fact your use case is exactly fitting what a StackPanel is for.
In WinForms there is no StackPanel, but you can use a normal Panel control*. It's just you'll have to position the CommentBox controls manually one beneath another. You will also need to set the AutoScroll property to true to turn on the vertical scroll bar if the content doesn't fit the view.
*or there's apparently an alternative How can I get a StackPanel-like layout in WinForms

What WPF control should i use for my window?

So im making a WPF project where one of my windows has to let the user see a text. Select parts of this text for being put into an array of strings and no more than that. So he/she musnt be able to edit anything in the text only highlight parts and then click on a button. What WPF control would be smart to use for this?
I'd probably just use TextBox with IsReadOnly set. The various selection properties are all you need after that.

Change C# user control layout in windows forms development

I have a user control that contains multiple controls (CheckBox, Button, Label...).
I want to change the layout of this user control to support right to left languages but i can't find how to do it.
Currently i can change the controls alignement using the RightToLeft property. But how can i change their positions?
Thank you for your time.
Thank you guys for your answers but there is a better way to do it.
First we go to the user control properties and select the language property.
After changing it to another language a new resource file will be created for the user control.
After that, using the designer we can change the controls positions in the user control as we like.
The new values will be saved in the created resource file.
When the language has changed, the corresponding resource file will be loaded and the positions will be changed.
If the language is a right to left one, don't forget to specify the right to left property for the controls.
Hope this helps.
Use the layout controls with the RightToLeft property and follow the following links for implementation:
RightToLeft property in Form in C#
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.righttoleftlayout(vs.80).aspx:
Developing Arabic applications should be easy!
Implementing Mirror-Aware Controls for Windows Application with Visual Studio .NET
Try to use FlowLayoutPanel or TableLayoutPanel to hold your controls and change panels RightToLeft property
User control mirroring is not supported for user controls, see this connect article: http://connect.microsoft.com/VisualStudio/feedback/details/121202/usercontrol-mirroring-is-not-inherited-from-the-form
Their suggested workaround is to use a table layout panel which will mirror the controls in right to left.

Dynamic top down list of controls in WindowsForms and C#?

In our project, SharpWired, we're trying to create a download component similar to the download windows in Firefox or Safari. That is, one single top down list of downloads which are custom controls containing progress bars, buttons and what not.
The requirements are that there should be one single list, with one element on each row. Each element must be a custom control. The whole list should be dynamically re-sizable, so that when you make it longer / shorter the list adds a scroll bar when needed and when you make it thinner / wider the custom controls should resize to the width of the list.
We've tried using a FlowLayoutPanel but haven't gotten resizing to work the way we want to. Preferably we should only have to set anchoring of the custom controls to Left & Right. We've also thought about using a TableLayoutPanel but found adding rows dynamically to be a too big overhead so far.
This must be quite a common use case, and it seems a bit weird to me that the FlowLayoutPanel has no intuitive way of doing this. Has anyone done something similar or have tips or tricks to get us under way?
Cheers!
/Adam
If you don't want to use databinding (via the DataRepeater control, as mentioned above), you could use a regular Panel control and set its AutoScroll property to true (to enable scrollbars).
Then, you could manually add your custom controls, and set the Dock property of each one to Top.
.NET 3.5 SP1 introduced a DataRepeater Windows Forms control which sounds like it'd do what you want. Bind it to the list of "downloads" (or whatever your list represents) and customize each item panel to include the controls you need.

Categories

Resources