限制窗体不能移动
1.声明。
procedure WMWindowPosChanging(var Msg: TWMWindowPosMsg); message WM_WINDOWPOSCHANGING;
2.函数实现
procedure TForm1.WMWindowPosChanging(var Msg: TWMWindowPosMsg);
var
WindowPos: PWindowPos;
begin
WindowPos := Windows.PWindowPos(Messages.TMessage(Msg).LParam);
WindowPos.flags := WindowPos.flags or Windows.SWP_NOMOVE or Windows.SWP_NOSIZE;
end;
按比例动态改变窗体和控件的大小
如: form1.ScaleBy(100,100);100%
btn1.ScaleBy(50,100); 按50%
scaleBy方法会改变窗体的width和heigth属性,但不会改变left和top.
本文转自鹅倌51CTO博客,原文链接: http://blog.51cto.com/kaixinbuliao/1010826,如需转载请自行联系原作者