VCL 中的 Windows API 函数(6): BeginDeferWindowPos
下面先用常规方法实现对 Panel1 中的一组 Button 进行调整, 然后再用上面三个函数重新实现.
本例效果图:

代码文件:
unit Unit1; interface uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls; type
TForm1 = class(TForm)
Panel1: TPanel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
procedure RadioButton1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
end; var
Form1: TForm1; implementation {$R *.dfm} procedure TForm1.RadioButton1Click(Sender: TObject);
var
num,i: Integer;
btn: TButton;
L,T,W,H: Integer;
begin
num := Panel1.ControlCount; L := ;
T := ;
W := (Panel1.ClientWidth - L * (num+)) div num;
H := (Panel1.ClientHeight - T * (num+)) div num; for i := to num - do
begin
if Panel1.Controls[i] is TButton then
begin
btn := TButton(Panel1.Controls[i]);
btn.Left := L;
btn.Top := (H + T) * i + T;
btn.Width := W;
btn.Height := H;
end;
end;
end; procedure TForm1.RadioButton2Click(Sender: TObject);
var
num,i: Integer;
btn: TButton;
L,T,W,H: Integer;
begin
num := Panel1.ControlCount; L := ;
T := ;
W := (Panel1.ClientWidth - L * (num+)) div num;
H := (Panel1.ClientHeight - T * (num+)) div num; for i := to num - do
begin
if Panel1.Controls[i] is TButton then
begin
btn := TButton(Panel1.Controls[i]);
btn.Left := (W + L) * i + L;
btn.Top := T;
btn.Width := W;
btn.Height := H;
end;
end;
end; end.
VCL 中的 Windows API 函数(6): BeginDeferWindowPos的更多相关文章
- VCL 中的 Windows API 函数(5): AlphaBlend
AlphaBlend 是指定图像混合透明的函数, 在 Graphics.GraphUtil.RibbonStyleActnCtrls 单元用到. 下面的测试是把一张图片显示在窗体, 并可以调整透明度. ...
- VCL 中的 Windows API 函数(2): ActivateKeyboardLayout
ActivateKeyboardLayout 分别在 Controls.DBGrids.Grids 单元用到, 基本都是如下语句: ActivateKeyboardLayout(Screen.Defa ...
- VCL 中的 Windows API 函数(1): AbortDoc
AbortDoc: 该函数终止当前打印作业并删除最好一次调用 StartDoc 函数写入的所有信息. 该函数在 Printers 单元的应用:AbortDoc(Canvas.Handle);
- VCL 中的 Windows API 函数(4): AdjustWindowRectEx
AdjustWindowRectEx 用在了 Forms.DBCtrls 单元. AdjustWindowRectEx 可以根据窗口样式获取的边缘尺寸. 测试: var R: TRect; beg ...
- MFC中调用Windows API函数的方式
windows aoi 函数的调用前面加::
- 在VBA中使用Windows API
VBA是一种强大的编程语言,可用于自定义Microsoft Office解决方案.通过使用VBA处理一个或多个Office应用程序对象模型,可以容易地修改Office应用程序的功能或者能够使两个或多个 ...
- Windows API 函数列表 附帮助手册
所有Windows API函数列表,为了方便查询,也为了大家查找,所以整理一下贡献出来了. 帮助手册:700多个Windows API的函数手册 免费下载 API之网络函数 API之消息函数 API之 ...
- Windows API函数大全(完整)
Windows API函数大全,从事软件开发的朋友可以参考下 1. API之网络函数 WNetAddConnection 创建同一个网络资源的永久性连接 WNetAddConnection2 创建同一 ...
- [windows菜鸟]Windows API函数大全(完整)
Windows API函数大全,从事软件开发的朋友可以参考下 1. API之网络函数 WNetAddConnection 创建同一个网络资源的永久性连接 WNetAddConnection2 创建同一 ...
随机推荐
- 【Android】第21章 2D图形和动画
分类:C#.Android.VS2015: 创建日期:2016-03-19 一.简介 Android系统定义了一系列独立的图形处理类,其中,2D图形处理类分别位于以下命名空间: Android.Gra ...
- Socket相关函数(2)- sendto(), recvfrom() UDP模型
udp_server.c #include <sys/types.h> #include <sys/socket.h> #include <stdio.h> #in ...
- linux io architecture
http://www.cs.columbia.edu/~krj/os/lectures/L24-IO.pdf http://events.linuxfoundation.org/sites/event ...
- 每日英语:Mooncake Austerity Hits China's Mid-Autumn Festival
First baijiu, then red carpets, and now mooncakes. For Chinese government officials, the list of tab ...
- ny523 亡命逃串 hdoj 1253胜利大逃亡
亡命逃窜 时间限制:1000 ms | 内存限制:65535 KB 难度:4 描述 从前有个叫hck的骑士,为了救我们美丽的公主,潜入魔王的老巢,够英雄吧.不过英雄不是这么好当的.这个可怜的娃被魔 ...
- xml相关术语说明
<project xmlns="http://maven.apache.org/POM/4.0.0" --命名空间,类似包名,因为xml的标签可自定义,需要命名空间来区分x ...
- SharePoint自动化系列——Upload files to SharePoint library using PowerShell.
转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 日常的SharePoint站点测试中,我们经常要做各种各样的数据,今天又写了几个脚本,发现自己写的 ...
- 面试-存储过程与Insert的性能比较
相关资料: 1.http://blog.itpub.net/28713356/viewspace-1220826/2.http://www.west.cn/www/info/28183-1.htm 1 ...
- matlab与MFC
混合编程其实不难,关键是没有一个规范的,真正可以解决设置过程中出现的小问题的方法.我在设置的过程中,遇到了不少问题,花了多半天的时间,终于解决了,顺利地在vc中调用matlab 生成的dll文件中的函 ...
- Linux 修改mac 地址方法记录
Linux 修改MAC 记录: sudo ifconfig eth0 hw ether 70B3D5106F90