Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, June 13, 2012 9:48:26 PM(UTC)
rajknoida

Groups: Registered
Posts: 20


Hi,

I am using Leadtolos 17.5 with C# in WPF.

I want functionality to create Fullscreen CrossHair Cursor. I  have used following code in Winforms but not able do the same in WPF.
=======================================================

 Region r = new Region();
                    r.Union(new Rectangle(0, lastY, _view.ControlWidth, 1));
                    r.Union(new Rectangle(lastX, 0, 1, _view.ControlHeight));
                    _view.PrpRasterImageViewer.Invalidate(r);
                    _view.PrpRasterImageViewer.Update();
                    Graphics g = _view.PrpRasterImageViewer.CreateGraphics();
                    Pen p = new Pen(Color.Black, 1);
                    p.DashStyle = DashStyle.Dash;

                    g.DrawLine(p, 0, e.Y, _view.ControlWidth, e.Y);
                    g.DrawLine(p, e.X, 0, e.X, _view.ControlHeight);
                    lastX = e.X;
                    lastY = e.Y;

===============================================

Please help me . Thanks in advance


 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, June 14, 2012 5:31:11 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

Can you send me a small working WinForms project (not your full application) that shows how exactly you are creating the cross hair cursor?

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Friday, June 15, 2012 12:43:57 AM(UTC)
rajknoida

Groups: Registered
Posts: 20


Hi Maen,

WinForm project is attached, Please have a look. I have used mouse move event to to display cursor. you just need to change the "rasterImagePath" value to see the cursor.

Please let me know if you have any question.

Thanks
File Attachment(s):
FullscrennCrossCursor.zip (1,722kb) downloaded 104 time(s).
 
#4 Posted : Sunday, June 17, 2012 4:32:14 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

You can draw the cross hair cursor in WPF by using the following code:

- XAML:
+-----------------+
<Grid Name="myGrid">
<Leadtools_Windows_Controls:ImageViewer x:Name="imageViewer1" Width="NaN" Height="NaN" MouseMove="imageViewer1_MouseMove" />
</Grid>
+-----------------+

- Drawing the cross hair cursor:
+-----------------+
Line myLine = new Line();
myLine.Stroke = System.Windows.Media.Brushes.LightSteelBlue;
myLine.X1 = imageViewer1.PhysicalSize.Width / 2;
myLine.X2 = imageViewer1.PhysicalSize.Width / 2;
myLine.Y1 = 0;
myLine.Y2 = imageViewer1.PhysicalSize.Height;                
myLine.Stroke = Brushes.LightSteelBlue;
DoubleCollection dashes = new DoubleCollection();
dashes.Add(2);
dashes.Add(2);
myLine.StrokeDashArray = dashes;
myLine.StrokeDashCap = PenLineCap.Round;
                 
Line myLine2 = new Line();
myLine2.Stroke = System.Windows.Media.Brushes.LightSteelBlue;
myLine2.X1 = 0;
myLine2.X2 = imageViewer1.PhysicalSize.Width;
myLine2.Y1 = imageViewer1.PhysicalSize.Height / 2;
myLine2.Y2 = imageViewer1.PhysicalSize.Height / 2;
myLine2.Stroke = Brushes.LightSteelBlue;
DoubleCollection dashes2 = new DoubleCollection();
dashes2.Add(2);
dashes2.Add(2);
myLine2.StrokeDashArray = dashes2;
myLine2.StrokeDashCap = PenLineCap.Round;

myGrid.Children.Add(myLine);
myGrid.Children.Add(myLine2);
+-----------------+

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#5 Posted : Sunday, June 17, 2012 11:50:01 PM(UTC)
rajknoida

Groups: Registered
Posts: 20


Hi Maen,

Thanks it is working great.

Regards,
Rajesh
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.477 seconds.