How to create moving toolbars in windows form C#? - c#

Backgound :
I want to create moveable toolbars just like paint.NET or any other Designing application. A Toolbar which can be moved, closed and shown from the menubar.
i know how a toolstrip works but its permanent sort of thing. There is another way explained in some articles which uses panels to make toolbars.
While doing experiments on the toolstrip, idea came up in my mind to make two forms(one big size form and other small form) and run them simultaneously , one will act as main form and the other small form will act as a toolbar but it also didnot work. I am only able to run one form.
Requirement:
I just want to make an application look like Paint.net having different tools in a toolbar which can be used on drawing area.and when application starts, toolbar and drawing area both should be running just like in all graphics editing softwares.
Questions:
How to make a moveable toolbar that can be closed and viewed again?
How to run two forms of different sizes run simultaneously at the same time when application starts?
Note:
Need Guidance as well if i am not in the right direction, u can set my direction towards the right side.
Thanks

Related

Dynamic form with resizing in C# .net

As a learning project in C# .net I am re-creating a Gnome 3 plugin for seeing who of the streamers you follow on Twitch is live. I have the settings form done, I am now working on the interface that is viewed from a click on the taskbar.
This is a rough image of what I want the interface to look like. When two or more streamers are live the interface would add another block and resize the form vertically similar to the menu for selecting a Wifi network in Windows.
What would be the best way for me to complete this?
My current thought is to maybe create a custom control and just place those inside a FlowLayoutPanel with some kind of code to change the vertical size of the form to match the added entries. Maybe this can be done without a custom control and be done with code inside a FlowLayoutPanel? I'm not too sure.
Ideally I would also have a click event in the panel for each streamer so I could then open a browser to their channel. A slight highlight would also be a plus (maybe change the background colour based on mouse hover).
Thanks in advance for any suggestions!

Get a Windows Form to behave similar to a taskbar

I've got a problem (well, rather no clue how to do something) about my Windows Form.
I have set up a windows form that, much like the task bar, goes from the left to the right of the screen. Now I would like it to, instead of being "above" other windows, "push" them down / make them smaller so they fit between a sort of "top-task-bar" and the normal taskbar - here you have a screenshot of what it looks like right now:
As you can see, it's in the way of other programs' controls etc.. Since I would like it to stay TopMost, I have to do what the task bar does - decrease the working area so programs have no problems but it's still there. I'm using Windows Forms.
Any advice on how to achieve this?
Thanks!

How to keep a window inside your application only?

I'm writing a WPF application which has a main canvas area, where the user can open a number of windows, drag and drop them and generally move them around the application as he or she pleases.
What I've done so far basically opens windows using the Show() method, and I have hidden them from the taskbar. However, when the main application is minimised, the small windows which have been opened all appear on the desktop. What I am lookign for is basically a way to keep the windows contained within the application.
Is this possible?
Yes but you need to design some infrastructure to replace what MDI used to do ( though often quite badly)
So when you open a new window in your app, add it to a list.
When it closes, take it out
When your main app is minimised, minimise all the windows in the list as well.
You can also trap child window move events and keep them in bounds, take the children with you when the main app moves. Docking, cascade, tiling...
Key bit it to get this list of managed child windows going.
What you want to do is called MDI.
WPF MDI

User control in avalon dock and separate window

I'm developing a bunch of user controls which do different things - like a maintenance screen, enquiry screen, report screen that sort of thing. Each screen has a dedicated purpose and a single user control holds all the functionality for the one screen.
I'm using avalondock and can place these user controls into LayoutDocuments. This creates a separate tab for each screen/user control. I've got a menu system setup so users can choose which screens they need access to. For each new screen I create a new LayoutDocument, add the appropriate control to it, then add the LayoutDocument to the Docking panel's children.
This is all working fine.
Avalon dock also has the feature of being able to drag out the layout document and make it float - you can also dock it somewhere else in the app if you wish.
I'd like to take this concept one step further: Being able to say right click on a layout document and choose "Make external window" (i'll work out the exact wording later). The effect of this action would be to create a new application with it's own icon in the task bar; being able to alt-tab between it and other apps;
Kind of like when you're in say Excel editing a document and you then open up a second instance of excel. In Windows 7 you get two excel icons in the task bar (one behind the other), and you can alt-tab between them.
This is nearly the behaviour that i'm after. However the second app isn't a full blown copy of the first; it has only the one user control that the user selected.
This is where i'm stuck and would like a bit of guidance.
I'm thinking that i'll probably need some kind of shell app where I can pass in the user control that I want. The shell would act as a window with title, X, minimising etc; the user control would then be the sole content of that shell. Use process.start to create new process and launch ?
Ideally i'd be able to pass in the same control in the same state as the user is currently viewing - so if for example they are part way through editing some customer record in a maintenance screen, then choose the "external window" option, that same customer record would appear in the new window.
Has anyone done something similar or offer advice if i'm on the right track ?
I think I know how to create a shell app but not sure on passing a user control to it dynamically. I'd like to avoid creating different shell apps for each user control.
No need to start a new process for that scenario.
Just create a new Window add your UserControl at runtime and remove the UserControl from the DockingManager. Make sure the Window has ShowInTaskbar set if you want it to show up there.
To get the command to undock the UserControl as a seperate Window you just have to restyle the ContextMenu to incorporate your command (take a look at the VS2010 theme and how the ContextMenu is styled there VS2010 theme.xaml).

WPF Group Windows

I have a WPF application that loads a realtime live chart in a window,
But I end up having 10+ windows open on my desktop (as many windows as there are charts).
So my need is basically to group/embed all these WPF windows in a single window.
I tried WPF MDI but I had serious trouble since it requires the windows to be usercontrols instead, and in that case, my live chart displays but stays empty and does not refresh nor plots realtime data. Same behavior when I put my chart controls inside a Page instead of a Window (chart does not update). This is why I guess I really need to stick with windows at this point.
I welcome any simple & straight solution
Are you sure you want to have a last century MDI in your WPF application? I'd recommend to switch to other, less expensive and more flexible content arrangement. I'd organize the charts in some kind of scrollable or swipeable container, maybe with some kind of navigation or tabbing facility... If your users really want to have one or some charts in a separate window(s), let them drag the charts out of the main container and create separate window on demand (something like dragging a tab out of Interent Explorer).

Categories