I'm just curious how I get Windows to use the high quality cursor when dragging and dropping in my WPF application. What I mean by high quality is:
Rather than the regular arrow with a rectangle. I tried using e.Effect but that didn't do anything... Am I doing something wrong? Or is this just how it is in WPF.
you can't use the cursor to do this, cursors are MOUSE POINTERS.
want you are looking for are Adorners
here is the doc on this subject:
http://msdn.microsoft.com/en-us/library/ms743737.aspx
and here is a very complete tuto on how to use drag & drop in WPF:
http://blogs.msdn.com/b/jaimer/archive/2007/07/12/drag-drop-in-wpf-explained-end-to-end.aspx
Edit: just to be precise: to achieve exactly what is shown on your image, you would in this case need an Adorner that follows the mouse + a blank cursor: this.Cursor = Cursors.None;
Related
I have created a usercontrol that is essentially a text editor (using Graphics.Drawstring in OnPaint).
I have set AutoScroll = true, and AutoScrollMinSize values appropriately. Everything is working how it should...
EXCEPT, i would like the control to scroll itself WHILST I am currently scrolling (i.e. click and drag the scroll bar... and whilst it is being dragged the control should be scrolling the entire time). At the moment it only scrolls when the scroll bar is released (mouse up).
I have tried implementing _Scroll and invalidating the control, but that just makes it flicker uncontrollably.
I cannot find any examples online for this, due to it being difficult to describe!
Can anyone point me in the right direction please?
Control.Invalidate() will make something flicker badly. I faced this problem drawing cross-hairs over a mouse position on a PictureBox drawing a line chart before. The trick is to use (and I cant remember which one is best to come first)
Control.Update();
Control.Refresh();
in the Scroll event. Depending on what else you are drawing in the Control and how you are drawing it this may be better for you. Also this is tested on PictureBox, Control may be another matter.
I'm looking to imitate the following control, found in the zune software, in the quickplay tab. When you move the mouse from left to right the boxes new, pinned and history move to the opposite direction.
I'm thinking of applying a method to the mousemove handler which checks for the relative position of the cursor and then moves a grid containing panels accordingly but before I try to reinvent the wheel I'd like to ask around if there are people who have more experience with this, especially getting a fluid motion.
Please let me know
Do you mean something like this http://sachabarber.net/?p=829
I want to build some GUI where an image is presented, and the user should pick nd/or adjust some points (ellipses) according to the image. Basically, like a map control, when we want to mark some points or make a route, but instead of a map, a picture must be presented. The final locations will be used for image processing. Is there a built-in silverlight functionality to do this? How should be the best way?
regards
for the Drag & Drop part, there is no built-in functionality in Silverlight so far (at least not for UIElements). But there are many implementations out there that provide this functionality, e.g. the DragDropManager on Codeplex:
http://silverlightdragdrop.codeplex.com/
These "workarounds" usually use mouse events and CaptureMouse/ReleaseMouseCapture to implement Drag & Drop behavior on UIElements.
Once you have Drag & Drop in your app, the rest should not be too hard. I'd place the image inside a Canvas and then move the markers around on that Canvas using the functionality provided by e.g. the Codeplex Drag & Drop implementation. Basically, all you have to do is set Canvas.Top/Canvas.Left for a marker based on where the mouse is.
Cheers, Alex
Does anyone have code to make the mouse cursor a cross/plus sign in silverlight?
when I click on one draw button then I want cursor as cross/plus sign do how can I implement in the silver light ?
Its not actually possible to set the Cursor image to anything other than the set of images specified by the Cursors class. Its quite a limited set.
Silverlight Tip of the Day #28: How to Implement a Custom Mouse Cursor
http://blogs.silverlight.net/blogs/msnow/archive/2010/03/16/81607.aspx
I have an app with a bunch of controls in it and I want to place a set of cross hairs on top of it. My first attack used a PictureBox and ran into this problem. The solution that fellow proposes, seems a bit... verbose for what I need.
Is there a simple way draw on top of my form? Note that I don't even need the drawing to be part of a control as it doesn't need to do anything but just be there.
This eventually worked. I had to play some games though because most of the controls I wanted to draw on were not where it expected them to be.
Also, it ran into issues when controls were moved; it failed to redraw and stuff moved with the underlying control. This was fixed by forcing invalidation from the move event for anything that might move.
Does a PictureBox with a transparent image have the same problem as a Panel with BackColor set to Transparent? I'm thinking you could have a PictureBox with the crosshair image in it and move that around, instead of drawing it yourself...