如何用WinAPI写类似于Panel控件的?(50分)

  • 主题发起人 主题发起人 erx
  • 开始时间 开始时间
E

erx

Unregistered / Unconfirmed
GUEST, unregistred user!
只是有一个外形就行了,是直接调用API就可以生成还是得自己画?<br><br>是否有全部是API些的程序的例子代码?<br><br>谢谢!
 
Create a subwindow,DrawEdge(subwindow.hdc)!
 
Example<br>var<br>&nbsp; R: TRect;<br>begin<br>&nbsp; R := ClientRect;<br>&nbsp; DrawEdge(Canvas.Handle, R, EDGE_RAISED, BF_RECT);<br>end;<br>
 
procedure buildAWindow;<br>begin<br>&nbsp; { ** Register Custom WndClass ** }<br>&nbsp; Inst := hInstance;<br>&nbsp; with WinClass do<br>&nbsp; begin<br>&nbsp; &nbsp; style &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:= CS_CLASSDC or CS_PARENTDC;<br>&nbsp; &nbsp; lpfnWndProc &nbsp; &nbsp; &nbsp; &nbsp;:= @WindowProc;<br>&nbsp; &nbsp; hInstance &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:= Inst;<br>&nbsp; &nbsp; hbrBackground &nbsp; &nbsp; &nbsp;:= color_btnface + 1;<br>&nbsp; &nbsp; lpszClassname &nbsp; &nbsp; &nbsp;:= 'className';<br>&nbsp; &nbsp; hCursor &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;:= LoadCursor(0, IDC_ARROW);<br>&nbsp; end; { with }<br>&nbsp; RegisterClass(WinClass);<br>&nbsp; { ** Create Main Window ** }<br>&nbsp; Handle := CreateWindowEx(WS_EX_APPWINDOW,'className', 'caption',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;WS_VISIBLE //可见<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;or WS_SYSMENU //系统按钮<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;or WS_MAXIMIZEBOX //最大化按钮许可<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;or WS_MINIMIZEBOX //最小化按钮许可<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;or WS_SIZEBOX, //尺寸可调窗口<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;10, 10, 500, 350, 0, 0, Inst, nil);<br>//R := ClientRect;<br>&nbsp; R.Left:=20;<br>&nbsp; R.Right:=40;<br>&nbsp; R.Top:=20;<br>&nbsp; R.Bottom:=60;<br>P.x:=20;<br>P.y:=30;<br>P1.X:=80;<br>P1.Y:=100;<br>//===========================================<br>DrawEdge(Handle, R, BDR_RAISEDINNER, BF_RECT);<br>// &nbsp;这两个都不好用啊?<br>FillRect(Handle, R, 12);<br>//===========================================<br>&nbsp; UpdateWindow(Handle);<br>end;
 
同意erx:)
 
我该怎么办?<br><br>救救~~
 
后退
顶部