title: ZedGraph - How to make a horizontal line drag-able?
body: <p>I have some straight horizontal lines that I want the user be able to drag vertically. How would this be possible?  I think the best parameter for line selection would be a fixed number of pixels near the line. So if mouse is +/- 2 pixels, I should change the mouse cursor and make the line drag-able..   I see the CurveItem class has properties IsSelectable and IsSelected. Will these have any function in solving this issue? I can’t really understand what they are for from reading the class documentation..  </p>
  
  <hr>
  
  <p><em><strong>EDIT:</em></strong> </p>
  
  <p>It seems that the <strong>FindNearestPoint</strong> (and <strong>FindNearestObject</strong>) only search actual points. How would I make selection to work along the whole section of a straight line? I guess I would need to make make my own custom "Find" routine that loops through all the lines I want to check, and for each calculate it's imaginary Y-point based on the mouse X position (<strong>?</strong>)  I'm also thinking about sloped lines for this purpose, for horizontal/vertical lines it will be slightly simpler.  At least it seems this is needed for a curveItem, but I assume the same must be done for selecting (at mid-section of) a LineObj? </p>
  
  <p>I actually didn't know about the <strong>LineObj</strong> existed. It seems the LineObj is not possible to change the <strong>X2/Y2</strong> coordinates, as they are <strong>ReadOnly</strong>. So is it at all possible to drag the X2/Y2 point of a LineObj? </p>
  
  <hr>
  
  <p><em><strong>EDIT 2:</em></strong> </p>
  
  <p>It seems to be an issue with the FindNearestPoint on a JapaneseCandleStick graph; When I click in the graph pane, it does <strong>not</strong> return the index of the nearest bar, but I believe it instead selects the index with the closest Y-value, no matter how far away on the x axis it is. Sometimes it's a bar to the right of the mouse, sometimes to the left of the mouse. Is this the way it's meant to work? </p>
  
  <p>I made this custom function myself, so I guess it's ok.. Still it would be nice to understand why the FindNearestPoint acts this way.</p>
  
  <p>This is the code on mouseDown:</p>
  
  <pre><code>   ' Find nearest curve point:
     Dim ciNearestCurve As CurveItem
     Dim iNearestCurve As Integer
     Dim b As Boolean = zgc.GraphPane.FindNearestPoint(mousePt, zgc.GraphPane.CurveList, ciNearestCurve, iNearestCurve)
     If b Then
         With ciNearestCurve(iNearestCurve)
             Debug.Print(Date.FromOADate(.X) &amp; " " &amp; .Y &amp; " " &amp; .Z)
         End With
  </code></pre>