在ONMOUSEMOVE事件中你是怎么处理的? 如下: if image.picture = image1 then image.picture := image2 else image.picture := image1
procedure Tmainform.FormCreate(Sender: TObject); VAR i:integer; str:string; findresult:variant; begin if ActionList1.Count < 0 then Exit; ///////////////////// for i:=0 to ActionList1.ActionCount-1 do (这项有错误,我都不知有何错误,是那种内存读写的错误?) begin findresult:=Datamodule1.clientuserright.lookup('userid;actioncaption',vararrayof([usernameok,Taction(Actionlist1.Actions[i]).Caption]),'actionenable'); if not varisnull(findresult) then begin str:=vartostr(findresult); if str='1' then begin taction(actionlist1.actions[i]).Enabled:=true; end else begin taction(actionlist1.actions[i]).Enabled:=false; end end end; end;请看一下此段代码有没有什么错误? 2、IMAGE控件放入了图象2,当鼠标移到此图象时,变为另外一张图象1,可是移走时,它还是图象1,不是图象2,我用的是ONMOUSEMOVE,要达到我这种效果有什么办法? 用Form的MouseMove事件,判断移动点是否在Image里,是的话,调用Image2,不是就调用Image1
1、for i:=0 to actionlist2.ActionCount-1 do begin if Locate('menutag',Taction(actionlist2.Actions[i]).Tag,[]) then Taction(actionlist2.Actions[i]).Enabled:=FieldByName('browseright').AsBoolean; end;2、我是小新的做法或用GIFY控件。
如下:
if image.picture = image1 then
image.picture := image2
else
image.picture := image1
VAR
i:integer;
str:string;
findresult:variant;
begin
if ActionList1.Count < 0 then Exit; /////////////////////
for i:=0 to ActionList1.ActionCount-1 do (这项有错误,我都不知有何错误,是那种内存读写的错误?)
begin
findresult:=Datamodule1.clientuserright.lookup('userid;actioncaption',vararrayof([usernameok,Taction(Actionlist1.Actions[i]).Caption]),'actionenable');
if not varisnull(findresult) then
begin
str:=vartostr(findresult);
if str='1' then
begin
taction(actionlist1.actions[i]).Enabled:=true;
end
else
begin
taction(actionlist1.actions[i]).Enabled:=false;
end
end
end;
end;请看一下此段代码有没有什么错误?
2、IMAGE控件放入了图象2,当鼠标移到此图象时,变为另外一张图象1,可是移走时,它还是图象1,不是图象2,我用的是ONMOUSEMOVE,要达到我这种效果有什么办法? 用Form的MouseMove事件,判断移动点是否在Image里,是的话,调用Image2,不是就调用Image1
begin
if Locate('menutag',Taction(actionlist2.Actions[i]).Tag,[]) then
Taction(actionlist2.Actions[i]).Enabled:=FieldByName('browseright').AsBoolean;
end;2、我是小新的做法或用GIFY控件。
一是 cobi(我是小新) 提供的方法;
二是在工程文件种将创建Datamodule1的语句放于创建mainform的语句之前(也可通过菜单Project-Options-Forms来完成)。