Atalasoft
Welcome to Atalasoft Community Sign in | Join | Help
in

Drawing grid lines

Last post 12 Aug 2008, 1:37 PM by DeveloperSupportKevin. 1 replies.
Sort Posts: Previous Next
  •  12 Jun 2008, 12:10 PM 14316

    Drawing grid lines

    Hi

     Anyone who can explain me how to draw gridlines over an image show in a WorkspaceViewer? The lines must have a width of 1px, independent of the zoom value of the viewer and the lines must be snapped to the pixels of the image.

    Thanks in advance

    Frans

  •  12 Aug 2008, 1:37 PM 15220 in reply to 14316

    Re: Drawing grid lines

    Hello Frans,

     To add lines to your image you should use our canvas class's DrawLine function. Simply store a copy of your original AtalaImage and add lines whenever the zoom level changes.

     

    AtalaImage origin = new AtalaImage("MyTiff.tif");

    AddLineToViewer(origin,myViewer, 10);

     

    public AddLineToViewer(AtalaImage origin, ImageViewer viewer, int x)

    {

     viewer.Image = origin.Clone();

    Canvas c = new Canvas(viewer.Image);

    c.DrawLine(new Point(x,0) ,new Point(x,viewer.Image.Height));

    }

     

    Then whenever you want to redraw the line simply recall AddLineToViewer to add one line to the viewer.

     

    Let me know if this helps.

    ~Kevin

View as RSS news feed in XML