ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Layers questions
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

jrpcguru

USA
254 Posts

Posted - Mar 11 2019 :  11:41:20  Show Profile  Reply
Is there a way to set a default image for an image layer? For instance, from an ImageList? The only way I have found so far is to use the ImageEnView1NewLayer event.

Can ExecuteOpenDialog for selecting an image for an image layer be given a default folder to view?

I find I can use the same layer name for multiple layers. Is this unintended or can I count on this being a continuing feature?


J.R.

xequte

38128 Posts

Posted - Mar 12 2019 :  23:14:46  Show Profile  Reply
Hi JR

> Is there a way to set a default image for an image layer?

Please assign it in the OnNewLayer event.


> Can ExecuteOpenDialog for selecting an image for an image layer be given a default folder to view?

No, please use ImageEnView1.IO.ExecuteOpenDialog in the OnNewLayer event.


> I find I can use the same layer name for multiple layers. Is this unintended or can I count on this being a continuing feature?

ImageEn does not guarantee the name is unique. I don't see a good reason to enforce uniqueness.



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jrpcguru

USA
254 Posts

Posted - Mar 13 2019 :  13:45:39  Show Profile  Reply
I'm glad you don't feel unique names are important. I'm thinking of assigning my own names to several different layers and storing/restoring the defaults for those layers. Since they may be the same type of layer, but different purposes, I don't want the defaults to overwrite each other.

I have figured out how to use OnNewLayer to specify the image. And your drag and drop sample program gave me enough ideas to use an imagelist. But I'm not at all clear how to use OnNewLayer to set a default image folder?

procedure TfrmImagePopUp.ImageEnView1NewLayer(Sender: TObject;
  LayerIdx: Integer; LayerKind: TIELayerKind);
var
  MyDefaultBitMap : TBitMap;
begin
  if (ImageEnView1.Layers[LayerIDX].Kind = ielkImage) and (InsertCheckBox1.Checked = true) then
    begin
      MyDefaultBitMap := TBitmap.Create;
      MainForm.ImageList1.GetBitmap(0,MyDefaultBitMap);
      TIEImageLayer(ImageEnView1.CurrentLayer).Bitmap.Assign(MyDefaultBitMap);
      MyDefaultBitMap.Free;
    end;
end;


J.R.
Go to Top of Page

xequte

38128 Posts

Posted - Mar 13 2019 :  18:31:45  Show Profile  Reply
Actually it works better with OnLayerNotifyEx:


procedure Tfmain.ImageEnView1LayerNotifyEx(Sender: TObject; layer: Integer; event: TIELayerEvent);
var
  fileName: string;
begin
  if ( event = ielCreated) and ( ImageEnView1.Layers[ layer ].Kind = ielkImage ) then
  begin
    fileName := ImageEnView1.IO.ExecuteOpenDialog( 'D:\Some Folder\' );
    if fileName = '' then
      ImageEnView1.LayersRemove( layer )
    else
    begin
      TIEImageLayer( ImageEnView1.Layers[ layer ]).Bitmap.Read( fileName );
      TIEImageLayer( ImageEnView1.Layers[ layer ]).RestoreAspectRatio();
    end;
  end;
end;


Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: