OpenPictureDialog有两个Filter , *.bmp 和 *.jpg  , 现在我想实现选择*.bmp 时MutilSelect := true , 选择 *.jpg 时 MutilSelect := False ; 请问如何实现??

解决方案 »

  1.   

    procedure TForm1.OpenPictureDialog1TypeChange(Sender: TObject);
    begin
      if OpenPictureDialog1.FilterIndex=1 then //*.bmp
        //[MutilSelect := true]
      else                                     //其它的 
        //[MutilSelect := False] 
    end;
      

  2.   


    procedure TForm1.OpenPictureDialog1TypeChange(Sender: TObject);
    begin
      if OpenPictureDialog1.FilterIndex=1 then
        self.OpenPictureDialog1.Options:=[ofAllowMultiSelect]//[ofAllowMultiSelect,...]添加你的选项
      else
        self.OpenPictureDialog1.Options:=[];  //[...]添加你的选项
    end;
      

  3.   

    to  Iamfish(呆鱼):
      谢谢~ 
      你的方法只有下次OpenPictureDialog.Execute时才生效, 我想实现的是实时改变Options的值 .
      

  4.   

    幸好TOpenPictureDialog是delphi自己写的,有源代码,你可以从TOpenPictureDialog派生自己的类,然后重载 DoTypeChange 函数就可以了,在那个函数里写MutilSelect的属性.