我在窗体上动态加载了一个frame,frame里有一个datagrid
请问在frame中如何触发form里的事件
或者在form里有什么办法得到frame里datagrid的单击事件

解决方案 »

  1.   

    procedure TfrmPicture.BitBtn3Click(Sender: TObject);//创建图像框
    var
        tmp:TImage;
        tmp1:Tpanel;
    begin    if OpenPictureDialog1.Execute then
        begin
           CurrObject:=2;  //0:=nil;1=Tedit;2=TImage
           tmp1:=Tpanel.Create(nil);
           tmp1.Parent:=panel2;
           tmp1.Color := clBlack; //黑色
           tmp1.Visible :=True;
           tmp1.PopupMenu:=PopupMenu3;
           tmp1.name:='P'+RandObjectName;
           ListBox2.Items.insert(0,tmp1.name);
           tmp:=TImage.Create(nil);
           tmp.Parent :=tmp1;
           tmp.AutoSize :=True;
           tmp.Picture.LoadFromFile(OpenPictureDialog1.FileName);
           tmp1.Hint:= OpenPictureDialog1.FileName;
           tmp.Visible :=True;
           tmp.OnMouseDown:=ImageMouseDown;
           tmp.ondragover:=Panel2DragOver;
           tmp1.Width :=tmp.Width ;
           tmp1.Height :=tmp.Height ;
           tmp.OnClick :=ImageClick;
           tmp.Align := alclient;
        end;
    end;//这是我程序里的一段垃圾代码,希望对您有帮助