WinForms Customization - c#

we can change the background of buttons and menu items n other UI components etc but is there a way to also change the background image for hover, pressed and other states

I do not think that is a good idea as a standard guideline for user interfaces has been adopted. Think what would happen if the user made a system setting change for the width of a window frame, or the border for the icons, or even worse, apply a theme that makes your user interface pretty glarish as a result of the perception of the eyes of the user, this can have a knock-on effect - the user will end up not using your application as a result.
It would be prudence to just leave the natural colours of buttons etc as defined by the system settings such as gray buttons, white background on text boxes etc. Then later on, once the winform application is accomplished, then find out by asking the users for their feedback on the layout and colouring schemes.
The best advice is to leave it alone, because by chance, a user will have their customised settings for graphics display, larger fonts (instead of 96dpi, could have extra large fonts).
The place to look for this is in:
Right click on the desktop
A popup menu appears, select properties and click on it.
A dialog box will appear, now click on the settings tab page.
It is on that tab page the font sizes, themes, borders and a whole host of customizations can take place.
Be wisse and practice safe caution here as I wouldn't go too far in making the application interface a colour playground as I have mentioned above. If you stick to my opinion of it, the application will be 'neutral' on the grounds that it will work with many themes and user settings as possible.

Anything is possible.
Override OnMouseHover, OnMouseEnter/Leave, OnPaint on the custom buttons... ;)

Related

On Windows 10 Some FormBorderStyles has no borders

This is only an issue if you have Drop Shadows turned off in appearance settings.
I noticed some of our applications form windows had no borders. Specifically they have been missing the 1 pixel thick border for the left part, right part and bottom part of the form window. All of the forms had in common that they were using FormBorderStyle FixedToolWindow or SizableToolWindow. When it is like this it is hard to distinguish where one dialog stop and another one begins.
We find it plausible that some of our users will have their computers set up like this without the ability to change it.
Is there a way to get the dialog windows looking better without doing anything crazy like manually drawing all borders?
Quoting part of a comment by Hans Passant:
By design for Win10, the left/bottom/right borders are transparent. Still quite visible against the large drop-shadow, so visible that is hard to tell that the border is transparent...
Our application has its own grahpical style that made it especially hard to distinguish where one dialog stops and the other one begins.
The quick solution for us was to stop using FormBorderStyle FixedToolWindow or SizableToolWindow.
Long term we are going trough all our dialogs and the graphical style of our application to make the dialogs more easily distinguishable from each other with or without borders.

Windows phone minimal commandbar ellipsis interfering with my controls

If I try to hit the 'clear' button on my filter TextBox, the command bar thinks I'm trying to hit the ellipsis and opens, without letting my click through to the cross.
Is there anyway I can get around this?
ApplicationBar is a system control where we can't do much. We can change colors, opacity and that's all. There is no way to modify this behavior.
You have to consider changes in your design. For me as a user and graphics designer it's really strange that your search box is on the bottom. It's natural to put it on the top. It's on the top everywhere in Windows Phone, so I suggest you to be consistent with the OS.

WP8 change color of a Single application bar button

I've been reading through a few posts, and from as far as I can tell, it is possible to change to color of the entire application bar so it doesn't use the default light/dark themes.
However, I'm writing an app where it would be convenient for the color of a single app bar button to change, i.e. On press, colour = default magenta, and it remains like this untill it has been clicked again.
I have a feeling that this isn't possible, and I'll have to rely on using various images to describe what's going on.
So I'm wondering if there is a solution that doesn't involve doing this?
afaik, IconUri is your only way of doing it. The background/foreground color of the whole app bar can be changed as a whole, not the individual buttons.
p.s. it is not recommended to change the colors of app bar buttons without a compelling reason. (for UI design guidelines, UX, power consumption reasons etc.)

How to develop an application like Google Chrome browser in WPF using C#

I am trying to develop an windows application like Google chrome Browser in WPF
using C#.I am facing problem in making my own Custom Window and Placing Tabs at the Place of the Title Position of that window.
Please suggest me how to go for it, is there any tool for this ?
Guide me please..........
Updated:
Hi Friends Thanks for your active responses and I also followed the links you gave and the way you told, but still I have doubts in developing the application please give me some more ideas where I can develop this application by using Google Chrome like controls. I want to give my application Google Chrome like look and feel.....
Google Chrome essentially custom-draws the non-client area of its window to remove things that it considers superfluous like the title bar. That's how it gets the tabs to replace the title bar of the window, just like how Microsoft Office places its "pearl" and quick access toolbar in the title area of document windows.
To do something similar in WPF, you may find this article useful: Link
Remember that any time you re-implement the standard windows chrome, you're going to have to handle a bunch of stuff that Windows normally makes transparent to you, like resizing, minimizing, maximizing, moving, and closing a window.
It is worth considering that both Google Chrome and Microsoft Office applications (among others) behave differently depending on whether Aero Glass and the Desktop Window Manager (DWM) are present/enabled. You're going to have to make sure that your application degrades gracefully when these things are missing. I would advise being sure that you can really make a convincing case for the necessity and benefit to the users before you invest all the time and energy it takes to do things like this in your application.
I just finished a Google Chrome-like Tab Control for WPF. You can find the project at https://github.com/realistschuckle/wpfchrometabs and blog posts describing it at
Google Chrome-Like WPF Tab Control
ChromeTabControl and Visual Children in WPF
WPF Chrome Tabs Functioning
Hope that helps!
It appears that Chrome draws its tabs within a limited region of the title bar area. When enough tabs are open, the width of existing tab controls is reduced to make room for a new tab.
I would suggest that you adopt a similar strategy by drawing your tabs in a suitably sized Rectangle which does not intersect with the caption buttons (Minimize, Maximize Close) and reducing the width of existing tab headers when the region becomes full
[Update 1]
While I haven't seen your code, I would suggest this happens because the tab header (the part displayed in the title bar area) and the tab page (the part covering most of the screen) are a part of the same control and are drawn as a unit, so when you try and draw the header in the region the tab content is redrawn too.
If this is the case, then you need to draw the tab header and the content page as separate controls and maintain some state in the tab that indicates which tab page should become visible when the tab is selected.

Change the icon of the window of the minimize, close and maximize

Simple question. How can I change the icons of the close, minimize, maximize buttons. Can I do this in Winforms and WPF?
These Icons, the caption, and the border on your window are all drawn while processing the WM_NCPAINT message. So, the way you take over drawing this is by handling this message.
But you don't have access to the state information about the icons (i.e. which button you should draw in it's pressed state because the user is currently clicking on it.). You dont even know where exactly the mouse handling code thinks these icons are.
So to take over non-client paint, you also need to take over non-client mouse handling, and the whole problem just snowballs until you've written thousands of lines of code and your window still doesn't behave quite right when the user tries to drag it, etc.
And that's in unmanaged code, in managed code (C#/.Net) this is even harder because you also have to do interop to get to some of the APIs you need to use.
So the answer is: Yes its possible, but its harder in WinForms and WPF than it is in C++, and those that have attempted it are all bald now.
The real answer is that you shouldn't do this. Users expect all applications to work and look the same. Making them try an figure out what spiffy new icon you use means minimize is likely to make them unhappy.
Doing this isn't difficult but it is a lot of work - you have to basically replace the window frame and handle everything yourself, there is a lot of functionality in the default window frame you have to rewrite - you also have to write different code for Vista/7 with Aero enabled.
In WPF you use the various techniques in http://blogs.msdn.com/wpfsdk/archive/2008/09/08/custom-window-chrome-in-wpf.aspx
In WinForms you use the same basic techniques but I don't know of a page that summarizes all the details like the link above.
In wpf, you can set WindowStyle="None" for your Window and then set a custom TitleBar for that, with minimize, maximize and close button. I have done this earlier. You need to do some event handling to perform minimize, maximize, close, drag etc.
Yes, you have to create your own window style. Refer to FluidKit, GlassWindows for example.
If you want to control the look of those buttons, you'll have to create your own. This is one value of using Windows features to write windows applications (they come with a standard look and feel).

Categories

Resources