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 move backgroud grid with image?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

winner

22 Posts

Posted - Oct 27 2012 :  06:39:27  Show Profile  Reply
I draw grid line in backgroud by DrawBackBuffer. then I draw some vectorial shapes such boxs /lines.I want to when the image move,for example ,I drag the scroll bar,the image can scroll,I want to the
backgroud can move together,how to do it ? thanks

winner

22 Posts

Posted - Oct 28 2012 :  00:09:09  Show Profile  Reply
I want to the grid with the rule,how do I draw the grid?


4.19 KB
Go to Top of Page

xequte

38922 Posts

Posted - Oct 29 2012 :  02:49:18  Show Profile  Reply
Hi

What is your code for drawing the grid?

Ensure that you do it relative to the scroll position using ViewX and ViewY:

http://www.imageen.com/help/TImageEnView.ViewX.html


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

winner

22 Posts

Posted - Oct 29 2012 :  14:30:08  Show Profile  Reply
I use follow code to draw grid


procedure TfrmMain.img1DrawBackBuffer(Sender: TObject);
var
  i,j: integer;
  pt: TPoint;
  z:Double;
  offx,offy:DOUBLE;
begin
  if not btnGridShow.down then
  begin
    z:=img1.Zoom / 100;

     if img1.Zoom<80 then
     begin

     end
     else
     begin
      with img1.BackBuffer.Canvas do
        begin
          if img1.ViewX =0 then
          begin
            offx:=0;
          end
          else
          begin
          offx:=((img1.ViewX mod 10)) ;
          end;
          if img1.ViewY = 0 then
          begin
            offy := 0 ;
          end
          else
          begin
           offy:=((img1.ViewY mod 10)) ;
          end;

          Pen.Color := clNavy;
          Pen.Mode := pmNotXor;
          MoveTo ( 0, 0 );
          for i := 0 to 120 do
          begin
            MoveTo ( 0,  Trunc(i*11.811*z) ); // draw rows
            LineTo ( Trunc(1200*Z),Trunc(i*11.811*z) ) ;
          end;
          MoveTo ( 0, 0 );
          for i := 0 to 100 do
          begin
            MoveTo ( Trunc(i*11.811*z),0   ); // draw rows
            LineTo ( Trunc(i*11.811*z),Trunc(1000*Z )) ;
          end;
        end;
     end;
  end;
end;

Go to Top of Page

w2m

USA
1990 Posts

Posted - Oct 29 2012 :  18:52:15  Show Profile  Reply
I do not see any supported way to not maintain the objects postion when ViewX or ViewY is changed because it is the default behavior of the component to move the object when the view changes.

You might try repositioning all of the objects ObjLeft and ObjTop in ImageEnVect1ViewChange or in ImageEnVect1BeforeDrawObject or in ImageEnVect1AfterDrawObject.

ImageEnVect1.ObjLeft[hobj] =
ImageEnVect1.ObjTop[hobj] =

I tied to do this for awhile but I could not get the objects to maintain position.

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

xequte

38922 Posts

Posted - Oct 30 2012 :  01:47:05  Show Profile  Reply
Hi

You are not using the values you assign to OffX and OffY to offset your grid drawing.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: