吧oncreate的代码写到onshow事件中就应该没有问题了

解决方案 »

  1.   

    在ONMOUSEMOVE事件中你是怎么处理的?
    如下:
    if image.picture = image1 then
      image.picture := image2 
    else
      image.picture := image1
      

  2.   

    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 
      

  3.   

    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控件。
      

  4.   

    真正的问题应该是FormCreate执行时Datamodule1还未Create,所以有两种解决方法,
    一是 cobi(我是小新) 提供的方法;
    二是在工程文件种将创建Datamodule1的语句放于创建mainform的语句之前(也可通过菜单Project-Options-Forms来完成)。