i am using normal Form2.Show() and From1.Hide() to navigate the Form1 to Form2.
Application button is disappearing and appearing on the task bar while navigating just like flickering.
How to avoid this flickering?
Your approach is wrong. You should have one main form which will be showing in taskbar. And all child forms should be set ShowInTaskBar = false. When ever, button on taskbar is clicked, application should activate / minimize the current visible child. This way you wont see button changing in taskbar. But personally I dont see any issue with current flickering, it is by default and there is nothing wrong with it.
Related
I need to move focus from popup window to parent window without closing popup window. For example Find and replace dialog-box behavior in Excel.
how to achieve this in WPF C# coding.
Call .Show() instead of .ShowDialog() when you displaying your popup. If you want to keep it on top - set popup window 'TopMost' property to true.
I have a Form control named MyForm, which is the parent of some WPF BaseWindow, named MyWindow.
I'm setting their relationship as follows:
new WindowInteropHelper(myWindowInstance).Owner = myFormInstance.Handle;
And am showing the window using
myWindowInstance.ShowDialog();
The window is set with
ResizeMode="CanResize"
Therefor, it has a minimize button. On minimizing the window, its not minimized as expected, but rather minimized to the bottom of the form.
What I would like to experience is that the parent would be minimized as well. Meaning that minimizing the window, will be translated to minimizing the form.
You probably want to create event handlers to control their behavior relationship when events (minimize) occurred.
For WPF, you could use Window_StateChanged event with checking if this.WindowState == WindowState.Minimized
Then for the WinForm you could do the trick by Resize event and checking if WindowState == FormWindowState.Minimized
If any of these is true, then you could minimize both.
I currently have a problem with forms here.
Whenever some process is ongoing, I have a progress dialog that should popup, but when I click the "X" button of the window/form behind my progress dialog, it will be dismissed and the ongoing operation is cancelled.
How can I prevent that from happening? Should I have to disable my whole form behind my progress bar? and how can I do it?
p.s.
I have tried this and this and this but NONE of them seems to work in my application. T__T
Start the form using Form.ShowDialog() instead of Form.Show(). That will disable the background form (actually any other form in the process) until the form you are showing closes. As an added benefit you can have the form return a value (e.g. Cancel, OK, Yes, No, etc.) in case any action needs to be taken as a result.
Not actually the answer you might be expecting, but you could handle the Form.FormClosing event, setting e.Cancel = True
This won't disable the Close button, but will make your form remain open in this case.
See more at: http://msdn.microsoft.com/en-us/library/system.windows.forms.form.formclosing.aspx
You should show the progress bar as modal dialog, please check whether this answer work for you javasript like model window on winform
HTH.
I have a form that requires a long operation (expansion of a treeview node searches the network for additional items to create more tree nodes) - so I plan on using a BackgroundWorker for this task. During the long operation I want the cursor to be the wait cursor and I want the entire form to be unclickable except for the Cancel button. I know I could use Enabled=false but this turns the treeview grey which looks pretty lame imo.
I could just NOT use a BW but that means I have to use DoEvents to get the cursor to change and that possibly "Not Responding" would show up, which I hate.
I thought of handling all the mouse click events and keyboard events so that they are cancelled if the BW is busy... so that is my current plan. I just wondered if I am missing something, if there is another way.
Thanks.
There is no easy way to do that. It is better to fix your treeview and use Enabled property. You can also show your progressbar in Modal dialog - that will block UI
You could use a Panel as an overlay over the form, wholly or partly transparent, which only propagates clicks when over the cancel button - similar to the way browsers simulate modal windows by 'graying' the background with an overlay.
When you are in processing mode, set the Z-Order of the mask to be in front of all other controls, and when that finishes set it behind them.
You could use Background worker and pop up another dialog with progressbar and that shows current progress and a cancel button. Where you can user
popup = new ProgressWindow();
popup.Owner=this;
popup.show();
And the cancel button will cancel the background worker. In this way your back form will not be clickable and popup will remain on top with cancel button.
I want to set focus to an MDI Parent Form when I click on the background of the form. However, the only way I can get it to set focus is when I resize the form.
I have tried using mouse click event, click event, key press event etc to manually set the focus when you click on the MDI Parent but none of these events fire. Is there ANY way to set the focus to the MDI Parent when you click on the background of the form?
That background is a separate control, try to find it in MainForm.Controls and assign it's click event.
You may want to look at the Win32 WM_MDIACTIVATE message. Now that we've discussed a possible solution, the real question can begin:
I think you should look long and hard at what your trying to accomplish. You risk (not necessarily will, but risk) creating a behavior that is abnormal and confusing to users. Why do you want to move the focus? What will you once it gets moved? How will you indicate to the user that this has been done? How will then get out of this state?