I'm creating a new winforms application.
I want to simulate MDI functionality with a flowlayoutpanel that will host "many" panels that will have a form embedded into it.
So the workflow would work like this:
User click on navigation menu to open a module (the module is a winform that will be embedded into a panel and this panel will expand to fill its container)
The user will se the module filled in order to work but has option to minimize it so he can work on other module.
When the user click on the minimize icon "custom icon added to the panel", the panel will minimize like a title into the flowcontainerpanel.
The user then can click on other module or double click the existing current opened modules "tiles" to open it again.
Here are some images so I can explain it better.
Once the "tile" is double clicked the panel should expand and fill:
How can I do this?
I've been all up and down this tutorial.
I can't for the life of me figure out how when my app loads to have 1 screen, then when a menu item is clicked to show another screen. I get the idea of having multiple forms, but is that the solution I need here?
From what I've read I understand new forms to be essentially new windows. If that's right, that doesn't sound like what I need.
My users start off with a blank window other than a menu (I'm gonna fill it in later), but I want for File -> Settings to load a settings form. Ideally not in a new window.
Its a MDI window. They are window containers of other windows.
You create a parent form, and then you change which child form is the active form on the menu item click events. This requires you make a parent MDI form, and a child MDI form for each of the different views you want of your document. The menu items then switch which child MDI form is the active one.
I couldn't find a right term to search about this in the feature.
I have a control that will load a very heavy data that embedding within a tab of of my MainWindow.
Test Case:
For testing I have a window, within this windows there are 2 tab. the first tab contain notthing. 2nd tab contain this user control.
In the 2nd tab I have a MessageBox.
Run this program and MessageBox popup right after the MainWindow was loaded.
How can I delay load this usercontrol/page until the tab is active?
Have you tried calling your load code only when the user control is visible?
The other suggestion would be to create you own tab control that only loads the content when the tab is visible. This would also allow you to create animations when a tab becomes hidden before the new tab is visible.
I'm trying to get my application to display a popup context menu when a user right-clicks on my notify icon in the system tray... but there's a twist.
I'm aware that the NotifyIcon class I'm using to get the icon in the system tray has a ContextMenu property. I don't want to use that to get a right-click popup menu, because it ALWAYS displays a right-click popup menu, and never does anything else. When my main form is displaying a modal dialog, I want right-click to activate the main form, NOT display a popup menu.
So, I'm guessing I need to use the NotifyIcon.MouseClick event, and manually pop up the menu in that event? Here's where I've got to so far:
private NotifyIcon trayIcon;
private ContextMenu iconMenu;
private void frmMain_Load(object sender, EventArgs e) {
// [...]
this.trayIcon.MouseClick += new MouseEventHandler(trayIcon_MouseClick);
iconMenu = new ContextMenu();
// [...]
}
private void trayIcon_MouseClick(object sender, MouseEventArgs ea) {
this.iconMenu.Show(Program.instanceFrmMain, new Point(System.Windows.Forms.Cursor.Position.X - Program.instanceFrmMain.Left, System.Windows.Forms.Cursor.Position.Y - Program.instanceFrmMain.Top));
}
Notice how in iconMenu.Show, because it takes popup co-ordinates relative to the parent control (my main form here), I'm annoyingly having to subtract the parent control's co-ordinates from popup co-ordinates, something I already don't want to have to do.
Apart from that, here are the problems I'm having:
Although the menu does popup on right-click, it doesn't close if I click somewhere else on the screen outside the menu - and it should.
The menu doesn't quite popup in the right location; for other system tray apps, it pops up so its bottom-right or bottom-left corner are at the tip of the mouse cursor. For mine, the popup menu is at the base of the screen, to the side of the mouse cursor.
Any ideas how I can get this to work better? I know it's possible, plenty of other apps manually handle the displaying of a popup menu manually instead of using some NotifyIcon.ContextMenu property.
Use the ContextMenuStrip property rather than ContextMenu. The ContextMenuStrip class has an Opening event, which you can cancel by setting e.Cancel = true. That way you don't have to worry about the location of the menu, since it is automatically handled
OK, well I didn't manage to get the functionality I wanted as I described in the original question, but I have managed to find a way to achieve the desired effect using a different method.
I DO attach a ContextMenu to the trayIcon.ContextMenu property, but I attach event handler code to the Popup property of the context menu itself. If, in that handler, I .Clear the ContextMenu, it actually doesn't appear at all, allowing my code to elect to effectively stop the trayicon's popup menu from showing if it wants to. This was the effect I was looking to achieve. If I populate the ContextMenu in the Popup event handler code instead, the menu pops up as usual containing what I populated it with.
Sooo, I managed to solve the problem a different way. :-)
In my wpf application, i try to drag the textblock from one window say (call screen) and drop it on another window say (contact window). now drop the text block on contact window's datagrid's context menu which gets opwn when drag enter event fires and as soon as the drop event fires on context menu then alert dialog (that is show dialog window with ok and cancel buttn) will gets open. This alert dialog gets hang means i can't be able tap on ok button of this alert dialog until i move my cursor around ok button.
Help is highly appreciated..!