如何改变窗体的大小
- Delphi(Pascal) code
with Wnd do begin style := CS_HREDRAW or CS_VREDRAW; {改变大小时重绘} cbClsExtra := 0; {没有额外的窗口类信息} cbWndExtra := 0; {没有额外的窗口信息} hIcon := 0; {没指定图标} hCursor := LoadCursor(0, IDC_ARROW); {选用了系统提供的指针} lpszMenuName := nil; {不指定默认菜单} lpfnWndProc := @WndNewProc; hInstance := hInstance; lpszClassName := LayeredWndClass; hbrBackground :=CreateSolidBrush(RGB(0, 0,0)); end; Windows.RegisterClass(Wnd); Hnd:=CreateWindowEx(WS_EX_TOOLWINDOW , LayeredWndClass, PChar(form1.Caption), WS_VISIBLE or WS_POPUP , form1.Left, form1.Top, form1.Width, form1.Height, form1.Handle, 0, HInstance, nil);用这样的方式建立一个类似bsnone样式的窗口,怎么才能改变它大小就是像bsSizeable那种
[解决办法]
private
procedure WMNCHitTest(var Msg: TWMNCHitTest); message WM_NCHITTEST;
procedure TForm2.WmNcHitTest(var msg:TWmNcHitTest);
const cOffset=10;
var
vPoint: TPoint;
begin inherited;
vPoint:= ScreenToClient(Point(Msg.XPos, Msg.YPos));
if PtInRect(Rect(0, 0, cOffset, cOffset),vPoint) then Msg.Result := HTTOPLEFT
else if PtInRect(Rect(Width - cOffset, Height - cOffset, Width, Height), vPoint) then Msg.Result := HTBOTTOMRIGHT
else if PtInRect(Rect(Width - cOffset, 0, Width, cOffset), vPoint) then Msg.Result := HTTOPRIGHT
else if PtInRect(Rect(cOffset, 0, Width - cOffset, cOffset), vPoint) then Msg.Result := HTTOP
else if PtInRect(Rect(0, cOffset, cOffset, Height - cOffset), vPoint) then Msg.Result := HTLEFT
else if PtInRect(Rect(Width - cOffset, cOffset, Width, Height - cOffset), vPoint) then Msg.Result := HTRIGHT
else if PtInRect(Rect(cOffset, Height - cOffset, Width - cOffset, Height), vPoint) then Msg.Result := HTBOTTOM;
end;
[解决办法]
查下SDK不就出来了
[解决办法]
你想在什么时候改变窗体的大小?
楼上的朋友都是从API部分说起。
我就DELPHI自身来说吧。
你就在formReisize和FormPaint里面调整窗体大小就可以了。
[解决办法]
已经设置bsnone,鼠标是拖动不了的
界面上可以放2个按扭,一个放大一个缩小,用改变他们的width,heigth值就是了