Layout placement/design of a WinForms Application - c#

I would like to create a GUI where the main panel expands him self only to the space available, and then if some of the tools 1 or 2 are activated they appear at the top right side and if other tool is started it would automatically displays below ht visible ones or at top of none is displayed...
And if possible the append function.
I think its possible to do this with a bunch of if statements to re-size the panels everytime something would change the window content but there must be an easy way to do this.
Is something similar to the workflow of visual Studio...
Right now im using Windows Forms but i think its possible to switch to WPF
So what I'm looking for is for tutorials,sites,guides or simple a call to pay attention to some options inside the visual studio himself to help me create what I'm trying to achieve.
Here is a mock up to a better understanding
http://i.stack.imgur.com/0vupi.jpg
P.S the only thing I managed to do is hide and make visible the tool panels, but the space is always occupied in blank, and they appear no at top or bottom but the place where i drop them even if i dock them.

If you're open to third party controls, Telerik makes a fantastic dock control that does exactly what you're looking for.

Another option would be Digital Rune Docking or Windows, which is free for non-commercial use.

Related

How does Chrome and other apps override the default windows forms borders?

There are some programs such as Google Chrome and this:
They have a windows forms border that is different than the default. How do these programs do this and still allow the user to drag the window around? Is it possible in C#?
There are plenty of component suites (DevExpress, Infragistics, Telerik, etc.) doing this but you can do it on your own as well. But prepare to get dirty - really dirty!
Basically you have to catch the windows messages (yes, native!) and handle them properly. To make the form draggable is the easiest thing in this chapter (you just have to tell windows that the mouse is over the titlebar area even if it is not >> see here on CodeProject).
Let me get back to the painting: Don't do it!
There are so many things to handle ...
is your form maximized, minimized, normal state
which of the buttons (min/max/close) are enabled?
is it a tool window or a sizeable one?
is there a help button?
is the form sizeable? if so, you have to draw that border as well ...
... and so many more.
In addition, painting in the non-client-area is not as easy as painting usercontrols with a Graphics object. And even if that does not scare you by now, you might probably find yourself breaking the layouting logic of your forms' controls because the forms' size is the same as its ClientSize.
So, please consider to use DevExpress or any other toolkit. Speaking of DevExpress - I knew there was a free set of their fantastic controls and I'm pretty sure that the XtraForm (which does all the titlebar painting) is included as well.
Save big parts of your life and skip that chapter.
(However, if you're brave enough, check this article to do it anyway).

Tab controls moving tabs between 2 monitors Winforms vs 2010

Advice on approach needed.
I would like to give the user the ability to move tabs between 2 monitors.
What is the best approach?
Idea being user first load the form.
TabControls shows with eg 5 tabs
User can drag 01 tab on another monitor.
Is it possible?
Any suggestions?
I would open two windows (one on each monitor) having a Tab-Control on each of them. The moving of a tab from one window to the other I would manage by using Drag'n'Drop.
You need to use some form of Docking container control. Most of the commercial WinForms widget libraries have one, I have worked with Infragistics. There are also free ones like this one DockPanelSuite (or at least free when I used it). These docking controls will handle the transition between docking and floating, similar to the various windows you can drag around in Visual Studio (Properties, ToolBox, etc.).

How to place a control over the task bar in windows using c#

i googled a lot and found out some info about the band object from which we can make the ad-in for the task bar, can i get some more tutorials from scratch & some sample programmes.
is there any other alternative way is there to place a control over the windows task bar apart from band objects?
Thanks in advance
If you want to place a textbox in the taskbar like the Google Desktop search bar, then you're not actually trying to place the control over the taskbar, you want to place it within the taskbar.
The proper solution here is a Desk Band. You can find an MSDN article explaining those here. I'm not really sure why you say that you want to avoid band objects. That's the right way to do this.
There's even a sample implementation in C# available on Code Project: Extending Explorer with Band Objects using .NET and Windows Forms
To make a window overlap the Taskbar you can set it's TopMost property to true. But then you will have to control the positioning yourself, and it will also overlap anything else beneath it, but it is a solution at least :)

In Visual C# 2010 Express, how do I add dots to the forms and see how big labels are?

I'm trying to learn how to make databases, using C# as the "master language". I've installed Microsoft Visual C# 2010 Express, created an application, etc. There's a bit of a problem though. The form on the GUI developer doesn't look normal. Usually on these things you'll see dots evenly-spaced all across the form. Also when you drag, let's say, labels on to the thing, it's pretty easy to gather exactly how big they are in both dimensions in most other IDEs. Lastly between the dots and the ease of visibility - and control - of the sizing of labels, you can usally line labels, textboxes, and other stuff up pretty easily.
In this IDE that's not quite the case. They've taken away the "coordinate dots", they've made the positioning of everything much more precise, you can't clearly see how big a label is after you put it down, etc. My question is this: How, if possible, could I switch the thing to the more traditional style in those regards?
I know my wording on this may be hard to follow. I don't know the exact terminology of some of this stuff.
Thanks!
In Visual Studio 2010 Professional, you can switch to grid mode instead of lines mode from the Options dialog box, by selecting Windows Forms Designer then setting the LayoutMode option to SnapToGrid.
Can you try that in Express?
I think you are writing off the IDE far too quickly - all this functionality is available in pro but can't vouch for express; perhaps you should try adding a bunch of controls to a form and dragging them round holding keys like [ctrl] - you will probably find most of what you need is right under your fingertips it just different to other IDEs
Like Frederic suggests the options panel contains some settings for the designer. Also ShowGrid can help with visual cues.
However I recommend using a LayoutManager like the TableLayoutPanel or FlowLayoutPanel and using the docking/anchoring techniques which eliminate boring pixel perfection problems you'll get by doing the alignments yourself. I am of course assuming you're doing a "normal" winforms Form here...
Have a look at this MSDN article: http://msdn.microsoft.com/en-us/library/ms171689.aspx

How can I create a button with an embedded close button

I am trying to create a panel which will have a set of "buttons" on it.
These buttons should have the following behaviour:
Appear similar to a tag (with
rounded edges)
Contain a red
cross to remove the filter/tag from
the panel, similar to the way internet
explorer tabs have an embedded cross to close the individual tab.
allow the user to click
on the tag and respond like a normal
button (as long as the click is not
in the red cross)
Number 1 is no problem, this is just appearance, however, regarding numbers 2 and 3, I am not sure if there is already code out there do to something similar...and I dont really want to reinvent the wheel if I can avoid it!
My question is: Does anyone know if there is something out there in infragistics which will do this simply, or will I need to write this myself by subclassing winform buttons?
Thanks in advance!
Is this new development or maintenance of an existing project?
If it is maintenance, you have a somewhat tougher time ahead. You'll implement a UserControl, probably segmented into two buttons. Use docking to get the behavior as correct as possible. The far right button would contain your cross image; the left (which would need to auto-expand as you resize the control) would contain your primary button behavior. Play with the visual styles until you get them right (EG, removing borders, etc).
If this is new development, and you haven't gotten too far into it, you might consider using Windows Presentation Framework (WPF) instead of WinForms. It will be easier to build the control and get it to look exactly how you want it. WPF includes an extremely powerful control compositing system which allows you to layer multiple controls on top of each other and have them work exactly as you'd expect, and it carries the added advantage of allowing full visual control out-of-the-box.
Either way, this is more work than dropping in an external component ... I've used Infragistics for years, and I can't think of anything they have which is comparable. The closest, but only if you're building an MDI application and these controls are for window navigation, is the Tabbed MDI window management tools -- and there, only the tabs (which replace window title bars) have this behavior.
I don't think that infragistics can do something like this. The UltraButton control can't.
Implementing a own control wouldn't be that hard.
your probably going to have to make a costume control for this type of work.

Categories