Hi guys, i'm pretty new to this forum and i need help about this:
i just moved from windows c# to mono, i'm trying to create a gui
for my scanning program, i have a canon fb620p and the scan software is
only for console. My problem is:
i would like to draw a selection rectangle box over an image.
Pratically i wil scan for that image once, then the user will
select a portion of that image with the mouse and then i will cut out the bounds
of that image.
I've been able to draw a rubber selection rectangle in windows c#.
A selection tool like gimp, but not with gtk or even cairo. The problem is always the same
if i draw a rectangle with cr.Rectangle method while moving the mouse, the drawingarea
doesn't update the rectangle so i got the "old" rectangles drawn. I got a cleaner solution
using cr.lineto method but the results is that i always get the "old" lines drawn.
I tried the queuedraw method but i just had the drawn rectangle flashing but not drawn.
In windows i use the drawreversibleframe method but i don't want to use windows forms in linux!
so please help me! Here some pieces of code:
protected virtual void OnEventbox1ButtonPressEvent (object o, Gtk.ButtonPressEventArgs args)
{
//To get the origin point
drawingarea1.GetPointer(out OrigmouseX, out OrigmouseY);
}
protected virtual void OnEventbox1MotionNotifyEvent (object o, Gtk.MotionNotifyEventArgs args)
{
//mouse movement
drawingarea1.GetPointer(out NowmouseX, out NowmouseY);
cr = Gdk.CairoHelper.Create(drawingarea3.GdkWindow);
cr.LineWidth = 5;
cr.SetSourceRGBA(1, 0.5, 0.0,0.5);
//Vertical line
cr.MoveTo(OrigmouseX, OrigmouseY);
cr.LineTo(OrigmouseX,NowmouseY);
//Horizzontal line
cr.MoveTo(OrigmouseX, OrigmouseY);
cr.LineTo(NowmouseX,OrigmouseY);
//Opposite Horizzontal
cr.MoveTo(NowmouseX, NowmouseY);
cr.LineTo(OrigmouseX,NowmouseY);
//Opposite Vertical
cr.MoveTo(NowmouseX, NowmouseY);
cr.LineTo(NowmouseX,OrigmouseY);
cr.Stroke();
}
Thank you very much in advance, CIAO!
PS.: Sorry, for my english errors if any...