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
 Naming / renaming a layer
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

DMC02766

USA
27 Posts

Posted - Feb 23 2016 :  11:51:19  Show Profile  Reply
Currently I am trying to name / rename a layer by clicking a button next to an imageenmview component showing all of the layers, then typing in a text box to put in a name for the current layer then click save to name the layer. The problem I have is that it all works except all of the layers within the imageenmview show the name instead of the selected one and it doesnt save the name with the layers when the image is saved. Is there something I am doing incorrect? Below is my code:


 i:= imgview1.LayersCurrent;
   imgview1.currentlayer.Name := layernametext.Text;
   imgview1.update;

/// this part is for loading or refreshing the layer viewer
 for i := 0 to Imgview1.LayersCount - 1 do
  begin
    idx := ImageEnMView1.AppendImage;
    ImageEnMView1.SetIEBitmap(idx, Imgview1.Layers[i].Bitmap);
    ImageEnMView1.ImageTopText[i] := inttostr(i) + ' '+ imgview1.CurrentLayer.name;
  end;
  ImageEnMView1.SelectedImage := Imgview1.LayersCurrent;

xequte

38610 Posts

Posted - Feb 23 2016 :  13:00:36  Show Profile  Reply
That line should read:

ImageEnMView1.ImageTopText[i] := inttostr(i) + ' '+ imgview1.Layers[i].name;

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

DMC02766

USA
27 Posts

Posted - Feb 23 2016 :  13:31:18  Show Profile  Reply
Thanks Nigel!
Go to Top of Page

w2m

USA
1990 Posts

Posted - Feb 23 2016 :  13:46:12  Show Profile  Reply
This is one way to load and save layers to a file:

procedure TForm1.OpenLayers1Click(Sender: TObject);
var
  i: Integer;
begin
  OpenPictureDialog1.Filter := 'Layer (*.lyr)| *.lyr';
  if OpenPictureDialog1.Execute then
  begin
    if ImageEnView1.LayersLoadFromFile(OpenPictureDialog1.FileName) then
    begin
      for i := 0 to ImageEnView1.LayersCount - 1 do
      begin
        ImageEnMView1.AppendImage;
        if ImageEnView1.Layers[i].Name = '' then
          ImageEnView1.Layers[i].Name :=
            AnsiString('Layer ' + IntToStr(i));
        ImageEnMView1.ImageTopText[i] :=
          string(ImageEnView1.Layers[i].Name);
        ImageEnMView1.SetIEBitmapEx(i, ImageEnView1.Layers[i].Bitmap);
       end;
       ImageEnMView1.Update;
    end;
end;

procedure TForm1.SaveLayers1Click(Sender: TObject);
begin
  SavePictureDialog1.Filter := 'Layer (*.lyr)| *.lyr';
  if SavePictureDialog1.Execute then
  begin
    ImageEnView1.LayersSaveToFile(SavePictureDialog1.FileName);
  end;
end;

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: