摘要:
//获取鼠标在窗体中的当前位置 procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var str: string; begin str := Format('%d,%d',[X,Y]); ShowMessage(str)...
阅读全文
posted @ 2008-01-22 17:49
万一
阅读(7205)
推荐(0)
摘要:
//获取输入法列表 begin Memo1.Lines := Screen.Imes; end; //获取当前输入法 var kl: HKL; i: Integer; begin kl := GetKeyboardLayout(0); for i := 0 to Screen.Imes.Count - 1 do if HKL(Screen.Imes.Objects...
阅读全文
posted @ 2008-01-22 16:58
万一
阅读(6848)
推荐(0)
摘要:
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls; type TForm1 = class(TForm) Timer1: TTimer; Button1:...
阅读全文
posted @ 2008-01-22 16:50
万一
阅读(3988)
推荐(0)
摘要:
procedure TForm1.Timer1Timer(Sender: TObject); begin Text := Screen.ActiveControl.ClassName; end; {多放几个控件, 按 Tab 测试; 但并不是所有控件都有焦点}
阅读全文
posted @ 2008-01-22 16:39
万一
阅读(5372)
推荐(0)
摘要:
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Timer1: TTimer; {需要个定时器} ...
阅读全文
posted @ 2008-01-22 16:02
万一
阅读(3682)
推荐(0)
摘要:
//更换窗体或某个控件的光标可以不通过 Screen 对象, 譬如: begin Self.Cursor := crAppStart; Panel1.Cursor := crHandPoint; {光标可选值: crDefault = TCursor(0); crNone = TCursor(-1); crArrow = TCursor(-...
阅读全文
posted @ 2008-01-22 15:12
万一
阅读(4444)
推荐(0)
摘要:
//一个包含两个窗体的例子, 这是工程中的内容: program Project1; uses Forms, Unit1 in 'Unit1.pas' {Form1}, Unit2 in 'Unit2.pas' {Form2}; {$R *.res} begin Application.Initialize; Application.MainFormOnTaskbar ...
阅读全文
posted @ 2008-01-22 14:10
万一
阅读(3328)
推荐(0)
摘要:
Screen 对象是 TScreen 类的一个变量, 它声明在 Forms 单元的第 1323 行(Delphi 2007); 并且 TScreen 类也来自 Forms 单元. 也就是说, 只要 uses 了 Forms 单元, Screen 对象就可以使用了. 我们自己建立一个 TScreen 类的对象可以吗? 当然可以! var MyScreen: TScreen; begin ...
阅读全文
posted @ 2008-01-22 13:23
万一
阅读(4609)
推荐(0)
摘要:
var w,h: Integer; begin w := Screen.Width; h := Screen.Height; Text := Format('当前屏幕的分辨率是: %d*%d', [w,h]); end;
阅读全文
posted @ 2008-01-22 13:09
万一
阅读(4244)
推荐(0)