Bình Nguyên
Bình Nguyên

Reputation: 2352

WinAPI create metro style application issues

I'm trying to implement simple metro style window using WinAPI (basicly like Visual Studio 2012 style) to run on Windows 7 and Windows 8, I know it a hard work and at begin, I have those problems:

1. Create a squared window
I can achieve this by create a borderless window (mean no border, no titlebar, only client area) but by this way, I can't resize this window and titlebar was lost of course. Are these any ways to create a squared corner window and still keep titlebar (including close, max, min, ... buttons)?

2. Owner draw close, maximize, minimize buttons
I can owner draw whole titlebar by catching WM_NCPAINT event but this way I see these buttons (close, maximize, minimize) go to the hell. How can I show these button in my way (I mean draw it by my ideas)?

3. Create shadow
You can see that if Visual Studio 2012's window do not maximized, it show a shadow, it look great and I want apply that effect to my simple window. How can I do that?

Upvotes: 0

Views: 414

Answers (2)

SLaks
SLaks

Reputation: 887449

You need to write your own code that draws basic window elements, and handle mouse events by hand to make them interactive. (hooking WM_NCHITTEST may help for interactivity)

To make a shadow, make your window layered, then set a background image with an alpha-transparent shadow.

Upvotes: 1

Nik Bougalis
Nik Bougalis

Reputation: 10613

In addition to what SLaks said, which will work but is a lot of effort and will take time, you may want to consider whether you can use a framework in developing your program. If you can, then you may be able to use a framework toolkit to implement the "window chrome" leaving you free to work on the the important part of your application: the logic.

If you can use MFC, then I would recommend CodeJock's Toolkit Pro 2013; I am not affiliated with them in any way, but have used their product in the past and it's quite good.

I'm sure that there are other toolkits, some of which might target different frameworks, but I have no experience with them and no basis to recommend them.

Upvotes: 1

Related Questions