delphi中的DBGRid鼠标滚动事件
Procedure OnMouseWheel(Var Msg :TMsg;var Handled:Boolean);
begin
if Msg.message = WM_MouseWheel then
begin
if Msg.wParam > 0 then
begin
if DBGrid.Focused then
begin
SendMessage(DBGrid1.Handle,WM_KEYDOWN,VK_UP,0);
end;
end
else
begin
if DBGrid.Focused then
SendMessage(DBGrid1.Handle,WM_KEYDOWN,VK_DOWN,0);
end;
Handled:= True;
end;
end;
需要在Form创建的时候写入
Application.OnMessage:=OnMouseWheel; // 截获鼠标滚动事件
相关文档:
好久没写BLOG了,送上一份原创的DELPHI版MP3切割,splitMp3为切割函数,支持按时间切割和按大小切割。望大家支持。
参考VC的资料编写的MP3切割DELPHI版单元.
unit UnitMp3DataUtil;
{
MP3 Cut Unit.
@author Jim Wu
2009-08
}
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, ......
Delphi 创建目录及写日志文件
var
TF: TextFile;
LogFile: string;
txt :string;
sysDir:string;
//创建按钮
procedure TForm1.Button1Click(Sender: TObject);
begin
sysDir:=extractfilepath(application.ExeName );
if not directoryexists(sysdir+'log\') then
createdir(sysdir+'log ......
原文参见: http://blog.csdn.net/ingener/archive/2007/12/22/1958535.aspx
关于Delphi中DLL封装对象的几种方法整理及体会
Delphi用DLL来封装对象的技术主要有三种:
用接口实现
用纯虚和抽象类方法实现
用类引用实现
前两种,都是在DLL中生成类实例;第3种通过在调用方生成实例。三种方法的共同局限如下: ......
在Delphi中,调用Showmessage后,如何使弹出的对话框在一秒钟后自动关闭,而不用手动去点确定
1:用timer控件的函数
procedure TForm1.Timer1Timer(Sender: TObject);
var
AHandle: THandle;
begin
AHandle := FindWindow('TMessageForm',
PChar(Application.Title));
if AHandle > 0 then
SendMessage( ......