I am building an application based on the ImageViewer Control where you can add several selections using the MultiRectangularSelectionTool. To manage extra information for each selection I created a derived class of RectangularSelection. This part works fine.
I want to draw some text (later a small icon as well) when the RectangularSelection is drawn. I am overriding Draw(). But I got stuck, even with looking into the examples I cannot find any solution to draw into selection. Some text is drawn, but left in the top left corner of the ImageViewer or just moving some pixels when the SelectionTool is moved. Even though the ClipBound of the Graphics objects from the overridden Draw-Method are looking weird.
I have no control of where the text in drawn. Here is the latest piece of code I have tried:
Code: Select all
var rect = ((RectangularObjectTransformer) base.Transformer).InteractiveObject.GetBoundingBox();
var x = rect.X;
var y = rect.Y;
g.DrawString(base.SelectedRect.ToString(), new Font("Arial", 8), new SolidBrush(Color.Red), x,y);
Thanks for your help!
Sebastian