I want to extend an open/save dialog with a "drop-box" which should look like a TPanel (bevel). The code is already there - I use CreateWindowEx() with WNDCLASS name "Edit".
I have searched for a solution to draw a TPanel (resp. a beveled STATIC) with pure WinAPI, but did not found anything.
MS Spy++ tells me that a TPanel has the WNDCLASS name "TPanel" (which doesn't sound like pure WinAPI?)
I have now tried following code, but I get an AV as soon as I try class name "TPanel" instead of "EDIT" or "STATIC".
procedure TForm1.Button1Click(Sender: TObject);
begin
CreateWindowEx(
WS_EX_LEFT or WS_EX_LTRREADING or WS_EX_RIGHTSCROLLBAR or WS_EX_CONTROLPARENT,
'TPanel',
'Hello World',
WS_CHILDWINDOW or WS_VISIBLE or WS_CLIPSIBLINGS or WS_CLIPCHILDREN,
0, 0, 100, 100,
Handle, 0, hInstance, nil);
end;
Can you please help me?
Regards
Daniel MarschallPS: Can you please tell me how I write de开发者_如何转开发lphi-highlighted code in StackOverflow.com ?
TPanel is pure VCL control, which is not a wrapper over Win32 window class. Take a look at source code of TPanel (in VCL sources) to see how exactly it's painted. What you need is to fill internals with solid color and paint a border. If you want theme support, things become trickier, though.
Also why would you want to use pure WinAPI? You can embed VCL controls in open/save dialog. Take a look at TOpenPictureDialog in VCL source code -- it does exactly what you need.
精彩评论