How to include help '?' in title bar of winform - c#

I am trying to add a help '?' button to the title bar (along with minimize, maximize, and close buttons) of my winforms application (C#.NET 2.0). I have tried using the Help Button property of Form, but it does not work. Any suggestions?

The Help icon is only there when HelpButton = True and MaximizeBox and MimizeBox are both set to False. This is the windows standard. If you really want to go beyond and add a button anyway, you'll have to customize the titlebar.
This is not an easy task, it either involves many hooks, or a complete redesign of the title bar.
Are you sure you want to depart from the Windows standard? Wouldn't it be better to have Help available in the menu or on a toolbar somewhere?

In addition to the solution you must change FormBorderStyle to FixedDialog. To benefit help functionality use _HelpButtonClicked event in form.

Related

Is there a way to avoid the taskbar getting focus when running a form?

I am building a small program I want to hover over the other programs, and I use TopMost to handle this quite well.
Now my issue is that once I work in my tool, it also brings the Windows Taskbar forward, whereas I would like not to pull it to the top.
Is there a way to address this?
An acceptable workaround would be to "restore focus" on previous active program, is there an easy way to do this? (like Alt + Tab)
Have you tried just setting the ShowInTaskbar property for your form to False? That'll cause your form to not show up in the Windows taskbar.
For the 'restore focus' part of your question, you can use the form.activate method easily enough.

Leave parent window active when child opens

How can I open a child window and keep the parent window active. I am using Silverlight 5 with the latest version of the toolkit.
I understand that playing with the brushes can help to have the background look normal but the parent window is still disabled.
I am trying to implement a find feature similar to a control F. I want the user to search in a child window and the matches would be displayed on the main display.
Thank you for your help,
ChildWindow is made for modal (disables the parent) use.
It uses a overlay window to make the background appear disabled as you've discovered, however it also marks the Application.Current.RootVisual's IsEnabled to false, which it then restores when the ChildWindow is closed.
This prevents any interaction to the controls of the 'parent' window. The only way around this to make your own style ChildWindow control but leave out this behavior.
FloatableWindow is a codeplex project from Tim Heuer's work, which is a nice quick way to solve your problem. Altho it appears as tho the project hasn't been updated in a while so compatibilty with the latest silverlight version might be in questionable.
DevExpress has a DXDialog control which includes Show and ShowDialog functions for modal and non-modal behavior. I'm sure other silverlight toolkit companies provide similar alternatives, this is just one I'm familar with.
If you don't mind making a custom control you could follow something like Tim Heuer's blog post on the subject to adapt your own control or use a tool like Reflector to reverse engineer the ChildWindow from silverlight itself and remove the parts you don't want.

what are controls .NET equivalent to this image?

in this picture,I can see: MenuStrip,??,TextBox
how do I an bar like this that have the enumeration?
I hope this clear. Thanks in advance.
If you're talking about the menu bar at the top of the window (just below the caption/title bar, which you should get for free from any Form object), then that is not a MenuStrip control.
The MenuStrip control doesn't use the native Windows menu bar, which means it's going to look very different on Windows Vista and later where the appearance of the standard menu bar was altered to be blue and plasticky. Since MenuStrip is drawn entirely in C# code, it's going to look permanently cheesy and stick out like a sore thumb.
If you want the standard Windows menu bar, you need to use the old MainMenu control. This is what everyone used back in the early days of .NET, but it's still available for backwards-compatibility and for people who care about what their apps look like. You'll probably have to add it to the toolbox manually because it's not there by default. Right-click on your toolbox and click "Choose Items", then find MainMenu in the list of available controls and ensure that it is checked.
As Blorgbeard suggested in the comments, if you're talking about the line numbers and the text editing control, they're not the standard TextBox control, either. In fact, they're not a standard Windows control at all. That's a custom control designed specifically for editing code, probably Scintilla.
You can find a .NET implementation here: http://scintillanet.codeplex.com/

Change default arrangement of Save and Cancel buttons in SaveFileDialog

I m coding in c# and I want to change the default arrangement of 'Save' and 'Cancel' buttons in SaveFileDialog. The default arrangement is that the 'Save' button is above the 'Cancel' button.
What I want is to place 'Cancel' button on the right hand side of the 'Save' button.
I searched over the web and found that the text on these buttons can be changed(to which the answer was on stackoverflow itself) and nothing found on changing their arrangements (locations).
Please give me a solution if any of you have experienced this so far....
thank you
Please don't do this.
The user is used to where these buttons appear. If you try to change their layout then you will just make you app feel wrong.
If you have to do this then should make sure you use the legacy file dialogs (which will make your dialogs look even more odd on Vista/7). Use the lpfnHook field in the OPENFILENAME struct to obtain hooks in to the dialog procedure. Respond to the CDN_INITDONE notification and move the buttons around with MoveWindow or SetWindowPos. You'll have to hunt for the button window handles.
But really, please don't do this, you'll just make your app worse.
That rings a bell. When you have the code to change the text of the button then you have the handle of the button window. Which you can then use when you pinvoke GetWindowRect and MoveWindow to move the button somewhere else. Visit pinvoke.net for the declarations.
Beware that the dialog changed in every Windows version. The next one might well break your program. Your customer is not going to be disappointed when you don't do this.

How do I create a Popup Dialog box in Silverlight?

I'd like to create a popup dialog box in silverlight in which i can manipulate controls, enter data, and return a value. I want it to be modal, so that when it is open, the page "Below" is inaccessible. I havent found an easy way to do this yet. Any suggestions?
I know the question asked for a Silverlight 2 solution but in Silverlight 3 (Beta now, RTW in July 2009) there is a built-in ChildWindow that can do everything you're looking for.
I haven't found a perfect solution either. The closest I have seen is this:
Using Popup to create a Dialog class
If it is ok to be non-modal, you can try this tip using HtmlPage.PopupWindow().
How to Popup a Browser Window
I'm new to the Sliverlight framework and am just starting to figure it out, but I have a similar need for a popup modal dialog box. I just tried an idea that looks promising:
I created a Rectangle (named "Shield") that covers my entire application area. It exists on top of everything in the main app. I set the fill-brush to White, and the opacity-brush to 81% so that the main app contents show through, but lightly (as in disabled). Then make sure the "Shield" is hit-testable. Now, when the "Shield" is visible, it will also, in effect, block all input to the controls below (at least from the mouse, haven't tried keyboard yet). When the app initializes, set the "Shield" visibility to Collapsed. In that state it won't block input to the main app.
The dialog box is then constructed on another canvas element that exists in the z-order on top of the shield. Normally the dialog box will be invisible, but when I need it, I just set the "Shield" to visible, and the dialog to visible. Since the dialog is on top of the "Shield" I get a very modal-like behavior. When the dialog box is closed, make both the dialog canvas and "Shield" canvas invisible again and the main app is again active.
I'm sure this the most brute-force way of doing it and that I will eventually zero in on a more elegant construct, but it works for now.
A more elegant solution is here:
http://community.devexpress.com/blogs/theonewith/archive/2008/08/06/custom-silverlight-controls-creating-a-reusable-messagebox-dialog-part-i.aspx
I had the same requirement and ScottGu's Building a Basic Modal Dialog Using a User Control was the best solution that fit my requirement.
Here's a free library that provides one: http://www.vectorlight.net/demos/popup_dialogs.aspx

Categories

Resources