-->

C++/WIN32 A professional looking application - is

2019-02-13 04:28发布

问题:

I've been looking everywhere to find a good solution / tip on how to release an application that has todays 'top-end' look.

As we all know, when coding with windows we normally get windows-style colors/buttons/lists etc. They just look and feel ugly.

When we decide we want to sell an application, people want it to look good - obviously because they have paid for it.

So the question is:

  • How is the good application look achieved today?
  • Owner drawing? ( really?? )
  • custom-controls ?
  • some good non-free libraries that do the 'dirty' work and 'skin' your application?

I don't believe programmers do those 'overdrawn' tips and tricks, it takes so long to have one control completely done.. Besides, i would rather spend that time coding the internal application stuff than playing around with per-control drawing..

I have no clue, but have a deadline and now after going through all those 'ownerdrawed' controls on google - i came up that this is not the thing.. There has to be something else that comes handy when a programmer needs to make his application look top-end!.

Please help, any tools ? any tips ? any-anything.. ?

Few examples, how do they achieve that look:

http://fooh.pl/pokaz/3198197337370da4cdfdebf0ae13933c_openfm.jpg

回答1:

You could have a look at Qt for example. In addition to its basic functionality, you can also style all Widgets to your liking (in a manner very similar to CSS) and as such create "themes" to your heart's content.

For the non-rectangular look of the window in the image you link to, you can use Qt's setMask() functionality.



回答2:

It sounds like you want a fully skinnable app, but for no more effort than typical Win32 controls. This is impossible. But skinning is not difficult in general, just more time consuming than you're willing to spend.

Your next problem is: Once you have a skinned app, you need a professional graphic designer to develop a good skin. Too many small-project developers think they can make their own skin but it almost always looks terrible. This sexy professional look you want is impossible without a design expert.

And finally, whatever fancy custom skin you end up with, the functionality will likely need to be custom. That is, if you want non-rectangular controls, or animations, these are things you must spend the time to develop.

Using a toolkit like Qt can be a nice investment. But this is the kind of detail that takes a lot of effort no matter how you slice it.

Somewhat beside the point: Designed correctly by a UI expert, the default windows controls tend to look very professional. There are so many benefits to using native windows controls, you should really think carefully before trying to re-invent the wheel:

  1. Accessibility features like keyboard navigation, screen readers, high contrast. Are you really going to try and re-invent all the accessibility features that Windows provides with the controls? Or is it worth excluding disabled people from using your app just so you can use a skin (not to mention the non-disabled people that use accessibility features)?
  2. Resizing. Does your skin mean disabling any resizing of your window? Again, is that worth it?
  3. Some things cannot be skinned very well. For example scroll bars and menus. Some developers re-invent them (scrollbars being especially difficult to reinvent), others just leave them unskinned.
  4. Windows theme. Windows theming is not just the color of your start menu; it's supposed to dictate the look of your whole OS. Using standard windows controls allows users to use a built-in mechanism for selecting the look and feel.


回答3:

There probably is not a single control in that application.

Instead, the whole thing is rendered as an image. There's a background image, along with some overlay images (mostly transparent) to provide mouseover-highlight, disabled controls, etc. The only thing that's not prerendered is the current track and playlist information, which is pure text with a particular font.

Hit-testing can be performed with yet another image.

The programmer does virtually no work to implement the fancy design, it's all done by an artist (and programs like Photoshop support layers in the editor, making it quite easy to construct all the overlays).

The downside, of course, is that buttons don't act exactly like normal Win32 buttons do. They don't support keyboard focus (although there probably are hotkeys) and simply activate on mouseup. And accessibility is horrendous, there's no information for a screenreader, and the application doesn't respect system font-size settings. In order to make the UI readable by people with poor eyesight, an entirely different skin is required.



回答4:

The C++ team put together a sample called Hilo (like the place in Hawaii) that uses no frameworks (no ATL, no MFC) and is all native code. It uses a number of Windows 7 capabilities and some delightful graphics and animations. All the code and design is available and documented. Take a look.



回答5:

If you want to dig under the covers of any specific app, you can fire up a Spy Utility and see how many controls an interface has been broken down into:

I want Spy++ but I don't have Visual Studio

Is there a Spy++ like utility for WPF?

For instance...spying into Windows Media Player in skinned mode finds that there is a window class called WMP Skin Host, and you can see that it has zero child windows. (The regular non-skinned mode is broken into some list boxes and buttons such.)

In my experience, "modern" skinning is generally a disaster when people re-implement too much to try and "look cool". It hampers both automation (through things like AutoIt) not to mention the accessibility features for the disabled. Also, what looks cool today will not stay current if you're not using an OS-based theming API.

(Note: Because I'm a fan of Qt in general, I would suggest looking into the QStyle and QStylePainter. But this is more "theming" than "skinning".)

I would be very wary of using skinning in an app, unless I found out that I was developing for a market that absolutely demanded it (like music players).



回答6:

Usually, you can render custom controls with GDI(+) rendering.



回答7:

If you don't mind getting into C++/CLI, there is WPF, it offers pretty extensive control over user defined styles and templates.



回答8:

You might want to take a good look at SkinCrafter. It's mature, stable, and very flexible. I no longer use it but my experience with it was quite enjoyable.



回答9:

You could use external layout engines, one such is HTMLayout from terra informatica, this one is also used some professional software.