문제

Steam window This is a screenshot of Steam's client window being resized.

Steam's client window has two cool features.

  1. Custom window which is very responsive.
  2. Cool glass resize effect, different from standard windows (Thought it might be a side effect strongly related to 1)

Let's say I wanna create similar window using winapi. How can I do it?

I don't ask about widget-management related stuff, but about technical winapi tricks.

도움이 되었습니까?

해결책

Basically, you can do almost anything with your window. But most of the tricks are to be implemented manually.

  1. What is 'very responsive' I don't know. If you mean that the window has no standart border, it is easy to implement: do not specify WS_BORDER and WS_CAPTION when creating a WS_POPUP window. After that you will have to draw a border and a caption yourself. Handle WM_ERASEBKGND and WM_PAINT messages, draw background, menus, all as usual.
  2. This effect seems to me more like a bug. It happens this way: the window is resized, it gets a WM_SIZE message, processes it, Windows sends a WM_ERASEBKGND message which the window ignores. Thus, the system draws a new shadow around new window frame which is not yet filled with new window image. And here we get this cool glass effect: old image of underlaying windows with a windows aero shadow. You can try to disable windows shadows and look at this effect.

In order to create a custom resizing border, you might find useful these functions: LoadCursor, SetCursor, MoveWindow.

In order to draw your custom borders, you can use standart GDI functions. Also you can create a handful of child windows and delegate drawing to them. This is basics of winapi.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top