Delphi 我的代码之窗体移动
技术交流,DH讲解. 这个工具是好早好早以前写的,我这个喜欢在家边看电影边写写代码或者看电子书,所以经常会将网页移到屏幕的左上角或者右上角,而且要置顶.所以就写了这样一个工具,这个工具主要是对句柄的操作,还有就是窗体样式以及几个API的例子,比较基础. 整个文件在 here(Can't Input Chinese:() 下面把代码贴出来,希望有什么不懂的,结合MSDN,OK? Var
Form2: TForm2;
H: Cardinal = 0;
Implementation
{$R *.dfm}
//------------------------------------------------------------------------------
// 取得鼠标所在处窗体的句柄
//------------------------------------------------------------------------------
Procedure TForm2.BtnGetHandleClick(Sender: TObject);
Var
Pt: TPoint;
Begin
If GetCursorPos(Pt) Then
H := WindowfromPoint(Pt)
Else
H := 0;
End;
//------------------------------------------------------------------------------
// 将窗体置顶
//------------------------------------------------------------------------------
Procedure TForm2.BtnTopMostClick(Sender: TObject);
Var
Rc: TRect;
Begin
If H = 0 Then
Exit;
If GetWindowRect(H, Rc) Then
SetWindowPos(H, HWND_TOPMOST, Rc.Left, Rc.Top, Rc.Right - Rc.Left,
Rc.Bottom - Rc.Top, SWP_SHOWWINDOW)
End;
//------------------------------------------------------------------------------
// 去掉窗体的边框
//------------------------------------------------------------------------------
Procedure TForm2.BtnNoBorderClick(Sender: TObject);
Var
WsStyle: Cardinal;
Begin
If H = 0 Then
Exit;
WsStyle := GetWindowLong(H, GWL_STYLE);
WsStyle := WsStyle And (Not WS_BORDER) And (Not WS_CAPTION);
SetWindowLong(H, GWL_STYLE, WsStyle);
End;
//------------------------------------------------------------------------------
// 移动窗体
//------------------------------------------------------------------------------
Procedure TForm2.BtnMoveClick(Sender: TObject);
Var
Dx, Dy: Integer;
Rc: TRect;
Begin
If H = 0 Then
Exit;
Dx := StrToIntDef(TxtDx.Text, 0);
Dy := StrToInt
相关文档:
一、Delphi中流的基本概念及函数声明
在Delphi中,所有流对象的基类为TStream类,其中定义了所有流的共同属性和方法。 TStream类中定义的属性介绍如下: 1、Size:此属性以字节返回流中数据大小。 2、Position:此属性控制流中存取指针的位置。 Tstream中定义的虚方法有四个: 1、Read:此方法实现将数据从流中读出。函数原形为: ......
名称 类型 说明
--------------------------------------------------------- ......
结合Delphi
客户端桌面开发的优势和Java的稳健强壮特性,采用Delphi
Client + Java Server的系统架构应该是很有市场的,经过一段时间的实际项目实践,实现架构是这么实现的,供讨论:
1.后台应用服务层可采用基于Spring+Hibernate的轻量级J2EE实现,并使用Apache XML-RPC
提供客户端调用接口;
2.前台采用 Delphi
......
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
......
类的事件
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TMyEvent = procedure of object; //不带参数的过程
TMyEventExt = procedure(AName: string) of object; //带参数的过程
TForm1 = class(TForm)
......