Delphi错误 uses后面 Buttons, StdCtrls, MyMask, ExtCtrls,previewbitbtn,mClientDataSet_erm 怎么解决

Delphi错误 uses后面 Buttons, StdCtrls, MyMask, ExtCtrls,previewbitbtn,mClientDataSet_erm 怎么解决,第1张

这些都是当前单元文件使用的其它单元文件名称,编译运行时,编译器在默认的路径中,找不到这些文件才出错。你大概打开的是别人的源码吧,多半是别人给你的系列单元文件中,不包含这些文件。现在唯一的办法是1,在本机上用系统搜索来搜一下,看看是不放在别的文件夹中了;2、在你下载这源码的网站找一下;3,丢了他们,没有用的。

Delphi设置鼠标信息,当鼠标静止无操作时会自动隐藏鼠标,锁定鼠标,切换左键和右键,交换鼠标,模拟鼠标左右键单击效果,以下是主要的代码。

001unit Unit1

002interface

003uses

004 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

005 Dialogs, StdCtrls, ImgList, ComCtrls, ExtCtrls

006type

007 TForm1 = class(TForm)

008Button1: TButton

009Edit1: TEdit

010Button2: TButton

011Button3: TButton

012Button4: TButton

013Timer1: TTimer

014Button6: TButton

015Label1: TLabel

016RadioButton1: TRadioButton

017RadioButton2: TRadioButton

018Button5: TButton

019procedure Button1Click(Sender: TObject)

020procedure Button2Click(Sender: TObject)

021procedure Button3Click(Sender: TObject)

022procedure FormMouseMove(Sender: TObjectShift: TShiftStateX,

023 Y: Integer)

024procedure Button4Click(Sender: TObject)

025procedure Timer1Timer(Sender: TObject)

026procedure Button6Click(Sender: TObject)

027procedure Button5Click(Sender: TObject)

028 private

029{ Private declarations }

030 public

031{ Public declarations }

032 end

033var

034 Form1: TForm1

035implementation

036{$R *.dfm}

037procedure TForm1.Button1Click(Sender: TObject)

038var pt: TPoint

039begin

040 //模拟左键单击

041 If RadioButton1.Checked Then

042 Begin

043pt:= Edit1.ClientToScreen( Point(4,4)) //鼠标定位

044SetCursorPos( pt.x, pt.y )

045mouse_event( MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0 )

046mouse_event( MOUSEEVENTF_LEFTUP, 0, 0, 0, 0 )

047 end

048 //模拟右键单击

049 If RadioButton2.Checked Then

050 Begin

051pt:= Edit1.ClientToScreen(Point(4,4)) //鼠标定位

052SetCursorPos( pt.x, pt.y )

053mouse_event( MOUSEEVENTF_RightDOWN, 0, 0, 0, 0 )

054mouse_event( MOUSEEVENTF_RightUP, 0, 0, 0, 0 )

055 end

056 end

057procedure TForm1.Button2Click(Sender: TObject)

058var btn3Rect: TRect

059begin

060 btn3Rect := Button3.BoundsRect

061 MapWindowPoints(handle,0, btn3Rect, 2) // 坐标换算

062 ClipCursor(@btn3Rect) // 限制鼠标移动区域

063end

064procedure TForm1.Button3Click(Sender: TObject)

065var btScreen: TRect

066begin

067 btScreen := Rect(0, 0, Screen.Width, Screen.Height)

068 ClipCursor(@btScreen) //解琐,使鼠标在整个屏幕有效

069end

070

071procedure TForm1.Timer1Timer(Sender: TObject)

072begin

073 cursor:=crNone //2秒钟没有移动鼠标就在当前窗体隐藏鼠标

074end

075

076procedure TForm1.FormMouseMove(Sender: TObjectShift: TShiftStateX,

077 Y: Integer)

078begin

079if Timer1.Enabled=True then //判断定时器是否打开

080begin//如打开,则重新开始计时

081 Timer1.Enabled:=False

082 Timer1.Enabled:=True

083 end

084 cursor:=crDefault //鼠标移动时,改变光标类型为缺省类型

085end

086

087procedure TForm1.Button6Click(Sender: TObject)

088var mouseinfo:string

089begin

090//检测是否安装了鼠标

091 If (GetSystemMetrics(SM_MOUSEPRESENT)<>0) Then

092 mouseinfo:='1.系统检测到鼠标;'

093 Else mouseinfo:='1.系统没有鼠标;'

094 //检测鼠标是否支持滑动

095 If (GetSystemMetrics(SM_MOUSEWHEELPRESENT)<>0) Then

096 mouseinfo:=mouseinfo+'2.系统支持滑动鼠标。'

097 Else mouseinfo:=mouseinfo+'2.系统不支持滑动鼠标。'

098Label1.Caption:=mouseinfo

099end

100procedure TForm1.Button4Click(Sender: TObject)

101begin

102 SwapMouseButton(True) //交换左右键

103end

104procedure TForm1.Button5Click(Sender: TObject)

105begin

106 SwapMouseButton(False)//复原左右键

107end

108end.

用时钟啊,定义一个全局变量,然后再时钟里面将变量递减。

unit Unit1

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, ExtCtrls

type

TForm1 = class(TForm)

Timer1: TTimer

Label1: TLabel

procedure Timer1Timer(Sender: TObject)

private

{ Private declarations }

public

{ Public declarations }

end

var

Form1: TForm1

Id:integer=10

implementation

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject)

begin

if Id >0 then

begin

Id := Id -1

Label1.Caption := IntToStr(Id)

end

else

begin

Timer1.Enabled := False

end

end

end.


欢迎分享,转载请注明来源:夏雨云

原文地址:https://www.xiayuyun.com/zonghe/744197.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-08-14
下一篇2023-08-14

发表评论

登录后才能评论

评论列表(0条)

    保存