I've some questions .. and I really need your help.
I have an application.
First I display a splash screen, a form, and this splash would call another form.
Problem: When the splash form is displayed, if I then open another application on the top of the splash, and then minimize this newly opened application window, the splash screen becomes white. How do I avoid this? I want my splash to be displayed clearly and not affected by any application.
I'm using a DropDownList but I realized that there is 2 types of it . I found "Dropdown" which makes the text inside the DDL editable, and "DropDownList" which doesn't.
Problem: when I tried to use DropDownList control it doesn't allow me to add a default text while DropDown does so I want a DropDownList control which prevent modifying on the text and allow a default text .. what property should I use?
Can I add "?" which denotes to Help button to the FormBorder (with the minimization, maximization, and close buttons )
Can I change the colour of the Formborder from its default colour (blue) ?
One of my application functionality is to copy files from server to phone into a certain folder in memory card.
Problem : can I determine the free size of the MMC to notify the user if it's full while copying.
3) You have to set the "HelpButton" property of the form to true. However the "?" button is only visible if you deactivate the maximize and minimize buttons by setting "MinimizeBox" and "MaximizeBox" to false.
Here are a few...
1) you need to launch the window in another thread so that your app can do what it needs to do to start. When the startup finishes, signal to the splash screen that it can close itself.
2)
dropDownList.SelectedIndex = 0;
4) I would not recommend doing so. It is based on the system color scheme, which the user sets. I would not like an app to decide for itself which scheme to use.
5) if the MMC shows up as a mapped drive you could use one of these techniques
Once again there is no answer to this guys question.
Yes, do as the other guy said and launch the splash screen in its own thread.
There is only one type of ComboBox in .Net, However there is a property called DropDownStyle which sets its functionality.
Yes, I am clueless on how this one works and never needed it.
Yes you betcha, Its called non-client painting. you can find more info on it here http://www.codeplex.com/CustomerBorderForm/Wiki/View.aspx?title=Painting%20NonClient%20Area&referringTitle=Home
I Need more details on this.
Related
I have made a custom MessageBox for my application and it launches as a UserControl. I have two buttons inside it and I would like to allow users to press Tab to switch between Buttons. However, since it's a UserControl overlaying the content, Pressing tab more than twice makes the focus go in the background on elements that aren't supposed to be tabbed at.
I can't figure out a good idea how to prevent this, I've thought of making a method that will select all elements and make their IsTabStop values to false and then restore them later, but I think that would be more of a problem then a solution.
Is there a way around this to limit tabbing only to the UserControl?
I would also appreciate advice on working with the message box.. the whole messagebox is an async function that has an infinitive loop until the answer is given. Is there another way to stop the application until one of the message box options was selected?
Crowcoder's reference has lead to correct MSDN page where I found my solution:
dialog = new UCMessageBox("Are you sure you want to exit the application?", MBType.YesNo);
AppMessageBox.Children.Add(dialog);
KeyboardNavigation.SetTabNavigation(dialog, KeyboardNavigationMode.Cycle);
The key was to call .SetTabNavigation function and direct it to my dialog (custom UserControl for the message box) and setting the KeyboardNavigationMode to Cycle.
After closing the UC rest of the application continued normally regarding navigation.
I want a form to be shown modal every time it is opend. Since I can not change the way it is created and opend. I wondered if it is possible to make the form stay on top from within the forms class.
One opportunity is the TopMost property. This works in general, but if I display the form while the main thread is waiting for it to close, the form will stay on top even if I change the application(to a browser for example). So no matter where I am, the form is still displayed.
Another issue which I came across is that in some cases it is adopted by the parent form which then might block other windows or popup messages.
I was thinking about a hook to the OnLostFocus event to get it on top again, once the focus is lost, but I'm not sure if that is a good idea ...
Any helpful thoughts about it?
Edit
Due to the comments I will extend my description, Here is the real use-case
We are using the Devexpress's SplashScreenManager which is able to show a certain form as a WaitForm. Since the WaitForm is not intended to be shown modal(see on the Support Center), we are looking for a way to do so.
We can not change the way the form is shown, because this is done through the SplashScreenManager. The WaitForm is shown both from the main thread, as well as from certain backgroundworker.
So this is only about an own form of ourselfs, displaying it within our own application.
Use:
TopLevel = true;
This will do exactly what you want; be topmost as long as the main form is shown and hide if the mainform is hidden by another window.
You can set the owner of your splash form to your main form explicitly without using .Show(owner).
splashForm.Owner=mainForm;
splashManager.Show(splashForm);
We did not want the TopMost property since it works on windows level and covers other windows too (for example the browser).
In the end I hooked up on the focus event of the window to make sure the window is always on top.
I have a WinForms application that, at some point, will do some calculations that take a couple of seconds. During this time, I disable the controls. Additionally I want to display a popup that kind of 'blocks' the application more visibly.
I tried placing a Panel on top of the Form in order to do so, but there I'm somehow not able to add any text to it. I.e. the Labels and ImageBoxes I put there are somehow not displayed or behind the Panel.
Any suggestions how I could achieve this in a quick and easy way? .. I mean, without redesigning the whole Form.
Your problem with the things not showing up in your additional panel is that everything is happening in the same thread, but your calculations are blocking everything from appearing because they are hogging up the thread. You should look into using a backgroundWorker, which is one of the tools in WinForms. You should throw the function call that performs the calculations into the DoWork method of the backgroundWorker, then the form itself can continue to function during the calculations.
See http://msdn.microsoft.com/en-us/library/cc221403%28v=vs.95%29.aspx for examples
Create a Dialog Box (windows form) to popup during the processing, then you can have the Dialog Box close once your processing is completed.
By using a Dialog Box not a Message Box, you can still have control over closing the window when your processing is done.
You could create a simple UserControl with just a Label and an ImageBox, maybe with public setter for their values. You can add it to your form setting its Visible property to false. Then you can make it visible during your calculations and go back top invisible in the end.
I was wondering if there are any gotchas for making a form completely transparent (as opposed to hiding it). For instance, I know that these are things that got my by surprise when hiding a form:
If a form is hidden, you cannot interact with its controls (can't add HTML to a webbrowser control, can't push a button, etc.)
Changing the WindowState (minimized, maximized, etc) of a window while it is hidden will cause the window to appear outside the scope of your work area when the form is shown again.
Has anybody run into similar problems (or completely different ones!) while using a form with opacity set to 0 (completely transparent)?
If you don't need the form anymore, hide it.
But if you still have a task or timers running in the form you want to keep, or you want to keep the user's input, then you'd do good to set the opacity to 0%.
This is what I do when I want a form to be hidden, but still active:
frmMain.Opacity = 0; // To make it invisible.
frmMain.VisibleInTaskbar = false; // To make the taskbar entry of the form disappear, and to make sure that the WindowState isn't changed.
frmMain.Enabled = false; // To make sure the user doesn't type something in the form, or presses a button (by pressing enter) by accident.
From the up votes for my comment, I guess I'll submit it as an answer. I would discourage using Form.Opacity = 0. Even though you can disable the form to prevent accidental interaction, I would think the transparent form would overlay other windows and confuse the user as to why he can't interact with windows behind your transparent one.
As for the gotcha's for Form.Hide(), I typically queue form responses so that when the form returns into view (or visibility), it goes through the queue to process actions (i.e. changing FormState). Changing the form while it's hidden can also really confuse the user.
Is it possible to modify NotifyIcon behavior to AlwaysShow in C#? A code snippet would be greatly appreciated:) Thanks in advance...
Cheers
---edited
One of our clients said quote "it seems necessary to customise icons to always show". What he meant was that he has to do it manually by r-clicking on task bar then click on Properties -> Task Bar -> Customize Notifications and then you can set behavior to Always Show / Always Hide / Hide when inactive for each taskbar icon on the list.
Can you do that programically in C#?
I want to ensure that my NotifyIcon is ALWAYS visible. I'm already setting icon.Visible = true but it looks like it doesn't work for him hence the complaint.
Is there any easy way of setting the behavior by altering [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\TrayNotify] IconsStream registry value?
NotifyIcon icon = ...;
icon.Visible = true;
Edit for updated information: There shouldn't be, and if for some reason it exists, don't use it. That's the user's preference, not yours.
I'm sure it's possible with enough Registry hacking, but not at all recommended. They added the collapsing-notification-area behavior in XP because so many applications were shoving themselves in that space. Much like Start Menu pinning behavior in XP/Vista/7, the lack of a public API means you're supposed to let the user decide that sort of thing.