随笔 - 2146  文章 - 19 评论 - 11846 阅读 - 1267万

随笔分类 -  其他常用控件

上一页 1 2
调整 TEdit 文本对齐
摘要:譬如让 Edit1 文本右对齐: SetWindowLong(Edit1.Handle, GWL_STYLE, GetWindowLong(Edit1.Handle, GWL_STYLE) or ES_RIGHT); 本例效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Gr... 阅读全文
posted @ 2008-05-02 12:59 万一 阅读(3940) 评论(23) 推荐(0) 编辑
获取窗口边框的宽度和标题栏的高度
摘要:方法一(通过 Width、ClientWidth 推算): var frame,caption: Integer; begin frame := (Width - ClientWidth) div 2; caption := Height - ClientHeight - frame * 2; ShowMessageFmt('边框宽: %d; 标题高: %d', [frame,c... 阅读全文
posted @ 2008-05-01 22:15 万一 阅读(12097) 评论(1) 推荐(0) 编辑
演示控件的 Anchors 属性
摘要:本例效果图: 准备工作: 新建工程后, 在窗体上添加一个 Panel 和四个 CheckBox; 双击它们产生默认事件, 然后全选代码, 用下面代码覆盖. unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Std... 阅读全文
posted @ 2008-04-29 21:26 万一 阅读(4697) 评论(4) 推荐(0) 编辑
动态列表
摘要:本例效果图: 代码文件: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Panel1: TPane... 阅读全文
posted @ 2008-04-29 14:28 万一 阅读(2442) 评论(8) 推荐(0) 编辑
如果提取网页中的变量 - 回复 lancernig 的问题
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/04/02/1131232.html#1133889 答案: WebBrowser1.OleObject.Document.ParentWindow.变量名; 譬如有这样一个页面(lancernig 举的例子), 如何提取其中的 pvs 呢: 测试页 ... 假定是把页面保存在 '... 阅读全文
posted @ 2008-04-02 10:54 万一 阅读(3132) 评论(6) 推荐(0) 编辑
快捷键设置控件: THotKey [2] - 自定义菜单快捷键
摘要:运行效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls; type TForm1 = class(TForm) HotKey1: THotKey; ... 阅读全文
posted @ 2008-03-20 10:45 万一 阅读(3184) 评论(8) 推荐(0) 编辑
快捷键设置控件: THotKey [1]
摘要:运行效果图: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls; type TForm1 = class(TForm) HotKey1: THotKey; ... 阅读全文
posted @ 2008-03-19 15:19 万一 阅读(5477) 评论(11) 推荐(2) 编辑
控件的 Owner 属性演示
摘要:unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Panel1: TPanel; Button1:... 阅读全文
posted @ 2008-03-02 22:40 万一 阅读(2866) 评论(2) 推荐(0) 编辑
控件的 Parent 属性演示
摘要:unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Panel1: TPanel; Button1:... 阅读全文
posted @ 2008-03-02 21:29 万一 阅读(3677) 评论(3) 推荐(0) 编辑
窗体图片背景
摘要:var Bitmap: TBitmap; procedure TForm1.FormCreate(Sender: TObject); begin Bitmap := TBitmap.Create; Bitmap.LoadFromFile('c:\temp\bg.bmp'); Self.Brush.Bitmap := Bitmap; end; procedure TForm1.... 阅读全文
posted @ 2008-02-10 15:48 万一 阅读(4578) 评论(3) 推荐(0) 编辑
RadioGroup 的使用
摘要://获取 RadioGroup 项目名称 procedure TForm1.RadioGroup1Click(Sender: TObject); begin Text := RadioGroup1.Items[RadioGroup1.ItemIndex]; end; //当点击 RadioGroup 中的第几个选项时... procedure TForm1.RadioGroup1Clic... 阅读全文
posted @ 2007-12-08 19:58 万一 阅读(8339) 评论(1) 推荐(1) 编辑
用消息实现窗体的 MouseDown 事件
摘要:unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) procedure FormMouseDown(Sender: TObject; Button:... 阅读全文
posted @ 2007-12-08 19:00 万一 阅读(3985) 评论(1) 推荐(0) 编辑
Memo 的当前行、当前列与当前字符
摘要:procedure TForm1.Memo1Click(Sender: TObject); begin Text := Format('当前列:%d, 当前行:%d', [Memo1.CaretPos.X, Memo1.CaretPos.Y]); end; //用 API 实现 procedure TForm1.Memo1Click(Sender: TObject); var Line... 阅读全文
posted @ 2007-11-24 23:04 万一 阅读(6830) 评论(11) 推荐(0) 编辑
Edit 的使用
摘要://让 Edit 只接受数字 //方法1: procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin if not (Key in ['0'..'9']) then Key := Chr(0); end; //方法2: procedure TForm1.Edit1KeyPress(Sender: T... 阅读全文
posted @ 2007-11-24 11:48 万一 阅读(6385) 评论(20) 推荐(0) 编辑
窗体相关操作
摘要://包含控件数: var num: Integer; begin num := Self.ControlCount; ShowMessage('窗体上共有控件: ' + IntToStr(num)); //没有包括不可视控件和panl内的控件 //ShowMessage('Panel1上共有控件: ' + IntToStr(Panel1.ControlCount)); end; ... 阅读全文
posted @ 2007-11-23 18:10 万一 阅读(3929) 评论(6) 推荐(0) 编辑

上一页 1 2


点击右上角即可分享
微信分享提示