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
 How to limit layer postion ?

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
aftereffectniko Posted - May 08 2013 : 04:28:44
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
1   L A T E S T    R E P L I E S    (Newest First)
w2m Posted - May 08 2013 : 06:12:49
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