VintaSoft Imaging .NET SDK and Plug-ins Discussions

Questions, comments and suggestions concerning VintaSoft Imaging .NET SDK.

Board index < VintaSoft Imaging < VintaSoft Imaging .NET SDK and Plug-ins Discussions

We are migrating to new forums engine, no new registration or posting currently available. TIA for your patience.

Custom draw on RectangularSelection



Custom draw on RectangularSelection

Post by SebastianB »

Hello,

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:
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);
I guess I am pretty close but I don't know in which direction I should proceed.

Thanks for your help!
Sebastian


Re: Custom draw on RectangularSelection

Post by SebastianB »

I found the solution by myself.
I called base.Draw() at the beginning of the overridden Draw-method. This is not correct.
After calling the base.Draw() after my custom draw operations it worked fine.


Re: Custom draw on RectangularSelection

Post by Alex »

Hello Sebastian,

Thank you for information.

Best regards, Alexander


Page 1 from 1: 1