loic.ploumen#1985
Hello,
I'm working on a medical application where I need to measure distances. For this purpose, I wanted to create (inherits) from a LineVObject, and add a text in the middle of the line which would be the distance (in pixels at first).
I though I would just inherit from LineVObjet and override the Draw method like this :
But the text is not printed in the middle (X) of the line and the value displayed doesn't seem to be ok (I can't get less than 50 even if the line is at its minimum). So can someone give me a hint about doing this ? I know this is maybe not the right way of doing it...
Thank you
Loïc
I'm working on a medical application where I need to measure distances. For this purpose, I wanted to create (inherits) from a LineVObject, and add a text in the middle of the line which would be the distance (in pixels at first).
I though I would just inherit from LineVObjet and override the Draw method like this :
public override void Draw(Rectangle renderingRect, Graphics g, ICoordinateMapper coordinateMapper)
{
m_text.Text = ((renderingRect.Width + renderingRect.Height)/2).ToString();
RectangleF rec = m_text.TextArea;
rec.X = renderingRect.Width/2 + renderingRect.X;
m_text.TextArea = rec;
m_text.Draw(renderingRect, g, coordinateMapper);
base.Draw(renderingRect, g, coordinateMapper);
}
But the text is not printed in the middle (X) of the line and the value displayed doesn't seem to be ok (I can't get less than 50 even if the line is at its minimum). So can someone give me a hint about doing this ? I know this is maybe not the right way of doing it...
Thank you
Loïc