Trouble with pixels

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jaap Bos

    #1

    Trouble with pixels

    In VB2005 I use a rectangle (50,50,910,600) into which to display my
    graphics.
    After graphing my X-Y data I want to do some measurements on that curve
    using a crosshair cursor.

    So I a made a MouseDoubleClic k event with the following code:

    Dim position as Point
    position=Contro l.MousePostion
    tijd=position.X
    height=position .Y

    Now it seems that the height is in screencoordinat es, not in
    graphicscoordin ates, e.g. if I doubleclick on the topline of my rectangle I
    get height=76 pixels, instead of 50 pixels (the difference of 26 pixels is
    the height of the forms titelbar). This difference of course becomes larger
    with a form that is not maximized.

    Now I can live with that by always using a maximized screen and substracting
    26 from the position.Y, but that does not seems not very elegant.

    Is there a better way to get the coordinates in a graphics window in
    graphicscoordin ates?


    --
    Groeten,


    Jaap Bos


  • Larry Lard

    #2
    Re: Trouble with pixels

    Jaap Bos wrote:
    Is there a better way to get the coordinates in a graphics window in
    graphicscoordin ates?
    Control.PointTo Client and Control.PointTo Screen will convert back and
    forth for you.


    --
    Larry Lard
    larrylard@googl email.com
    The address is real, but unread - please reply to the group
    For VB and C# questions - tell us which version

    Comment

    • Jaap Bos

      #3
      Re: Trouble with pixels


      "Larry Lard" <larrylard@goog lemail.com>
      Jaap Bos wrote:
      >Is there a better way to get the coordinates in a graphics window in
      >graphicscoordi nates?
      >
      Control.PointTo Client and Control.PointTo Screen will convert back and
      forth for you.
      >
      Thank you Larry, you solved my problem!

      As an afterthought, I find, as a newbie, that it is rather difficult to get
      a grasp of the possibilities of using graphics in VB2005.
      I read the Michael Halvorson Step by Step book and watched the Microsoft
      online video's.
      After this I have some knowledge about VB-programming, but I still know nil
      about graphics, apart from drawing a line or a rectangle.
      Befor I asked my question I looked into the Help-index of VB but really
      could not find the answer that you gave me.
      Can you point me to a (not to advanced :-) ) book or online material on
      VB-graphics?

      Thanks again,

      Jaap



      Comment

      • Larry Lard

        #4
        Re: Trouble with pixels

        Jaap Bos wrote:
        "Larry Lard" <larrylard@goog lemail.com>
        >Jaap Bos wrote:
        >>Is there a better way to get the coordinates in a graphics window in
        >>graphicscoord inates?
        >Control.PointT oClient and Control.PointTo Screen will convert back and
        >forth for you.
        >>
        >
        Thank you Larry, you solved my problem!
        >
        As an afterthought, I find, as a newbie, that it is rather difficult to get
        a grasp of the possibilities of using graphics in VB2005.
        I read the Michael Halvorson Step by Step book and watched the Microsoft
        online video's.
        After this I have some knowledge about VB-programming, but I still know nil
        about graphics, apart from drawing a line or a rectangle.
        Befor I asked my question I looked into the Help-index of VB but really
        could not find the answer that you gave me.
        Can you point me to a (not to advanced :-) ) book or online material on
        VB-graphics?
        Bob Powell's excellent website is my first port of call whenever I have
        a graphics issue:

        <http://www.bobpowell.n et/>

        --
        Larry Lard
        larrylard@googl email.com
        The address is real, but unread - please reply to the group
        For VB and C# questions - tell us which version

        Comment

        • Jaap Bos

          #5
          Re: Trouble with pixels


          "Larry Lard" <larrylard@goog lemail.comschre ef
          Jaap Bos wrote:
          >Can you point me to a (not to advanced :-) ) book or online material on
          >VB-graphics?
          >
          Bob Powell's excellent website is my first port of call whenever I have a
          graphics issue:
          >
          <http://www.bobpowell.n et/>
          >
          --
          Larry Lard
          Thanks Larry. Looks like that this site will keep me occupied for a while
          :-) .

          Jaap Bos


          Comment

          Working...