ImageEn 新增图层叠加一个图片

2020-09-14

var

  iLayer: Integer;

  vLayer1, vLayer2: TIELayer;

  i: Integer;

begin

  { 添加一个新的层 }

  if OpenPictureDialog2.Execute then

  begin

    if ImageEnView1.LayersCount > 1 then

    begin

      i := 1;

      ImageEnView1.LayersSelectEx(i);

    end

    else

      iLayer := ImageEnView1.LayersAdd;

    vLayer1 := ImageEnView1.layers[0];

    ImageEnView1.IO.LoadFromFilePNG(OpenPictureDialog2.FileName);

    vLayer2 := ImageEnView1.layers[1];

    vLayer2.fPosX := vLayer1.fPosX + (vLayer1.Width - vLayer2.Width) div 2;

    vLayer2.fPosY := vLayer1.fPosY + (vLayer1.Height - vLayer2.Height) div 2;

    ImageEnView1.Update;

  end;


阅读141