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
 How to limit layer postion ?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

aftereffectniko

Ethiopia
23 Posts

Posted - May 08 2013 :  04:28:44  Show Profile  Reply
I want to limit the layer 1 postion? I mean i want to limit the layer postion only up to posX 30 and posY 60 ? Help please

w2m

USA
1990 Posts

Posted - May 08 2013 :  06:12:49  Show Profile  Reply
You can restrict the position of a layer to a specified XY value in the LayerNotify event:
procedure TForm1.ImageEnView1LayerNotify(Sender: TObject; layer: Integer; event: TIELayerEvent);
begin
  { Show the layer position when moving }
  if (event = ielMoving) then
    StatusBar1.Panels[6].Text := 'Layer Pos: ' + IntToStr(ImageEnView1.Layers[layer].PosX) + ' x '
      +
      IntToStr(ImageEnView1.Layers[layer].PosY);
  { Do not allow layer 1 to be moved to a point less than PosX=30 and PosY=60 }
  if (event = ielMoved) and (Layer = 1) then
  begin
    { if PosX < 20 show message }
    if (ImageEnView1.Layers[layer].PosX < 30) then
    begin
      ShowMessage('Can not move the layer');
      { Reset the layer PosX to acceptable position }
      ImageEnView1.Layers[layer].PosX := 31;
      ImageEnView1.Update;
      StatusBar1.Panels[6].Text := 'Layer Pos: ' + IntToStr(ImageEnView1.Layers[layer].PosX) + ' x '
        +
        IntToStr(ImageEnView1.Layers[layer].PosY);
      exit;
    end;
    { if PosY < 60 show message }
    if (ImageEnView1.Layers[layer].PosY < 60) then
    begin
      ShowMessage('Can not move the layer');
      { Reset the layer PosY to acceptable position }
      ImageEnView1.Layers[layer].PosY := 61;
      ImageEnView1.Update;
      StatusBar1.Panels[6].Text := 'Layer Pos: ' + IntToStr(ImageEnView1.Layers[layer].PosX) + ' x '
        +
        IntToStr(ImageEnView1.Layers[layer].PosY);
      exit;
    end;
  end;
end;

William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: