How would you get a button to look and perform similar to that of the buttons in the volume mixer on Win7?
What I mean is that in the volume mixer there are icons that doesn't look like buttons until you hover them, they also haven't got the standard blueish color when hovered.
So far I haven't found a way to do this directly in visual studio.
I'm guessing that creating a custom user control is the only way to go, but I've had no luck so far, I would appreciate some examples.
In addition, there are also combo boxes in the volume mixer I would like to duplicate. They're hidden except for the text and arrow until they're hovered.
Is there a way to accomplish this?
(Here an image that might help explain what I mean:
http://i53.tinypic.com/2ij409u.png)
For windows application, (and also how they did win7), they used the technology called WPF. I am not specifically answering how you can do this, because in WPF, this is the fundamental that defining skin (via markup called XAML) without touching the implementation code. If you are serious in learning how to do that, I suggest you look for tutorials or good book about WPF.
Here's one of the markup looks like for a button. To modify the button's look, what you need is to define it's XAML, and you don't have to inherit it in the code. The example looks scary long, but Visual Studio could help you.
You could use a third party control library, for example Krypton Toolkit, its free!
There is quite a terrific solution for this button quest. You can paste pictureBoxes on form and handle MouseUp, MouseLeft and MouseDown events. When each of them fires, you need to set specific image (one of tree, in fact) - normal picture, picture of "highlighted" icon and picture of pressed icon. But that's really a hard and useless work, so better don't.
If you need several of such "buttons" in a panel, I remember, I once managed to get the same behaviour by using toolStrip with buttons.
Related
I have a NavBarControl which contains collection of NavBarGroups.
NavBarGroup have a header and container control. NavBarGroups can be collapsed/expanded.
The button to expand/collapse is on right side. By default it looks like double up/down arrow. I want to customize this button to change its look and feel to indicate collapsed/expanded state.
(using Devexpress in Windows Forms)
For future reference, the self-help and online support at DevExpress is exceptionally thorough, and they will answer questions like this for paid subscribers within 24 hours, usually with a code sample.
In this case there are two ways to achieve your goal (assuming you're on a relatively recent version of DevExpress) as described here.
The "right way" to do what you want is to make a custom skin with your own icons; you can use their skin editor to open your current skin, make changes, and save it. Nearly every aspect of the look & feel of their controls is skinned and you can make pretty significant changes to them.
Deploying custom skins isn't all that complex but it might be a bit overkill for the effect you're trying to achieve. The other option is to custom draw the group caption. There's a sample attached to that post that is a working example of doing so, but you basically implement the CustomDrawGroupCaption event and do your own painting, including whatever icons you want based on the group's state.
Is someone know any .NET Winform control which look like this button control?
QPushButton:
http://zetcode.com/gui/csharpqyoto/layoutmanagement/
You have several options here. You aren't specific about exactly which part of the platform you are using, but if using Winforms, you can certainly customize the buttons to some extent.
If you are using WPF, you can pretty much make it look exactly like you want in XAML. Check out Expression Blend.
As #Dimitri put it, the sky is the limit, but you may need to do the leg work.
You can create custom controls according your need and have its reference added to your project. you will have it added to your toolbox that you can use.
If you are refering to a button that is located on this example form:
We currently finishing our own application that has rather similar looking buttons. We did this by using a third party component. Steps are:
We purchased DevExpress.com's WinForms library.
We developed our own DevExpress Skin (with the help of an external screen design guy)
This was a bit of a work and some amount of money but the results look pretty neat.
I have an idea for a personal project. And I know one way of accomplishing it in Windows Forms (which I no longer wish to use). Basically I could (in WinForms) just draw everything onto the screen (Form) and then when I need to switch views/states of the application, just redraw the new stuff in the old stuff's place.
But how can we have different states in WPF? Is there a "right" or "proper" way of doing this? Is something like this covered somewhere in the docs?
I'd like to do my own searching, but I have no idea what exactly to look for, and current attempts at finding the right information, so far have yielded no helpful (or even relevant) results.
Any help at all will be greatly appreciated. I am new to WPF, but have been making a lot of progress this past week!
Thank you!
P.S.:
I just thouhght of something. If the solution was to draw what is needed for one screen, and when it is time to display the next screen, just dispose of/hide everything and create/display the new stuff, then how would we get around this? Because we can't/shouldn't change XAML markup at runtime, can/should we? :/
Not sure how you drawn your views/states in WinForms (direct painting on a Graphics object?).
The closest to what you're describing is the VisualStateManager. You can use it to statically define several visual states inside a single XAML and transit between them (using a smooth animation if you want).
If what you've done was show different Forms with Show/ShowDialog(), then the equivalent would be to use different Windows and Show/Hide them.
If you just cleared/added Controls to your form, then you can do just the same in WPF. Most Controls in WPF have a Content or Children property instead of Control.Controls in Forms.
I don't know if I understand what you really want. But here are my thoughts:
You can use several Windows and Show/Hide them accordingly
You can use the Frame/Page functionality in WP (MSDN)
if you really need to you could load your XAML and remove the topmost content in your Window and replace it with the loaded content
You could use the VisualStateGroup functionality to change the appearance of your current window
I think you will be happy with the second solution
My question is very general, I'm making a project and referenced two projects(graphsharp and wpfextensions). These are helping me to create graphs.
When I created my graph for example I can easily drag the vertexes or move the graph by clicking the empty space in screen etc..
But I do not know what is happening in background, for multitouch capabilities, I need to find what is going on when a mouse event raised.
Therefore my question is how to find these events and methods in a lot of source files ?
Thanks.
The question does really general and fuzzy but probably some tool like Snoop http://snoopwpf.codeplex.com/ will help you (here you can take a look how it works and looks http://blois.us/Snoop/). There is "Events" tab for selected part of UI of your application where you can investigate all the way of Event through a visual tree and see who (which control) has handled this event. Then you should check the control that handled this event and see if it's something you are looking for.
I'm currently learning WPF. I really am enjoying it so far. I love how easy it is to make great looking apps, and would like to create an app that has a custom window border. I would like for it to look something like this:
I know I could just easily change the Window type to not have a boarder and go from there, but that seems to much like WinForms. Wouldn't it be better to just create a class that derived from Window and styled it? If so how can I do this? Thanks!
Here's a great article on customizing Window "chrome" with WPF:
Custom Window Chrome in WPF
It is accompanied by a Code Gallery project from which you can download the code:
WPF Chrome
To show non-standard borders you have to set AllowsTransparency=True and no Border from the window. Whether you want to do this in the class is up to you. You basically have to realize WPF is really just a DirectX application hosted in a standard window. So you if you want non-standard Windows behavior, you have to drop the standard window border and start re-wiring it based on the standard window events you want to handle. Dragging, minimize/maximize/restore, Title bar.
Really, it shouldn't take you more than 30 minutes to an hour to come up with something close to what you want, and you could certainly put your custom window in a base class for re-use on down the road.
I have a feeling, for most cases, this is going to be the better and quicker option than trying override default Windows drawing.
There is a product called "Blendables" which contains a ChromelessWindow control in their "Essentials Mix" bundle which makes this very easy to do. I've never actually used it myself, I just know it exists and thought it might be of use. At bare minimum it shows that you can do what you ask about creating reusable, templatable chrome.