tags:

views:

56

answers:

1

I want to create a Window like when a context menu pops up or clicking the menubar. I want a Window that will be like this and that I can take over its paint event. Sort of like what is created when you select a sub tool in Photoshop.

EDIT:I want to know how to create controls like the one that comes when you select a sub tool in Photoshop, these do not seem to have a parent window. Those little description popups are a good example of this type of window, and menu items, those rectangles have no parent window. Thanks

EDIT2: see this: http://cdn-viper.demandvideo.com/media/CB3C805F-421E-45AE-8359-39D59D8F0165/jpeg/20412728-192C-462A-AF8E-1F30BA77AE05_2.jpg

You will notice the window for the sub tools, it is not constrained to a parent window.

+2  A: 

But how do they get a nice shadow around it, and how does it still stay with the main window without a parent?

That's your real question.

  1. There are several ways of getting the shadow. One is that the window is actually two windows, the "shadow" plus the "main" window.

  2. When you create the flyout window (that's what it's called), you position it near the toolbar. If the toolbar gets a WM_MOVE message, it's your responsibility to call MoveWindow() on the flyout to keep it lined up.

Edited to add

The dwExStyle parameter of CreateWindowEx() should include WS_EX_LAYERED and probably WS_EX_TRANSPARENT, because the 'shadow' will use alpha blending. The hWndParent parameter is the application's main window. The x and y parameters must be calculated as an offset of whatever button the window is to be associated with.

egrunin
I'm still not sure about the creation part though,what parameters do I pass to CreateWindowEx?
Milo