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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Layers questions

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
jrpcguru Posted - Mar 11 2019 : 11:41:20
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.
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Mar 13 2019 : 18:31:45
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
jrpcguru Posted - Mar 13 2019 : 13:45:39
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.
xequte Posted - Mar 12 2019 : 23:14:46
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