drag

Click and drag selection box in WPF

六眼飞鱼酱① 提交于 2019-11-26 15:24:38
问题 Is it possible to implement mouse click and drag selection box in WPF. Should it be done through simply drawing a rectangle, calculating coordinates of its points and evaluating position of other objects inside this box? Or are there some other ways? Could you give a bit of sample code or a link? 回答1: Here is sample code for a simple technique that I have used in the past to draw a drag selection box. XAML: <Window x:Class="DragSelectionBox.Window1" xmlns="http://schemas.microsoft.com/winfx

Drag borderless windows form by mouse [duplicate]

前提是你 提交于 2019-11-26 14:34:54
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: C# - Make a borderless form movable? I have made a form without border in C#, by setting this.FormBorderStyle = FormBorderStyle.None; Now, problem is how can I drag it by mouse? 回答1: This should be what you are looking for "Enhanced: Drag and move WinForms" public partial class MyDraggableForm : Form { private const int WM_NCHITTEST = 0x84; private const int HTCLIENT = 0x1; private const int HTCAPTION = 0x2; ///

Drag and Drop from JButton to JComponent in Java

ぐ巨炮叔叔 提交于 2019-11-26 14:31:42
问题 I searched on the internet for examples how to Drag and Drop JButtons to an Object but I could not make it work. What my program does, is that when I click on a button, the object updated a field (with a selectedobject.setField()). I want to be able to do this not by clicking, but by dragging the JButton. How can I do this ? I found this, and I tried to put in my code: btn.setTransferHandler(new ImageHandler()); btn.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e)

chrome sets cursor to text while dragging, why?

纵然是瞬间 提交于 2019-11-26 08:15:26
问题 My application has many drag and drop features. While dragging I want the cursor to change to some grab cursor. Internet Explorer and Firefox work fine for this, but Chrome always changes the cursor to the text cursor. 回答1: None of these solutions worked for me because it's too much code. I use a custom jQuery implementation to do the drag, and adding this line in the mousedown handler did the trick for me in Chrome. e.originalEvent.preventDefault(); 回答2: Try turning off text selection event.

How to drag a UserControl inside a Canvas

半世苍凉 提交于 2019-11-26 08:09:46
问题 I\'m writing my first WPF application. I have a Canvas in which user can add UserControl subclasses containing a form. User should be able to drag these UserControl around the Canvas. What\'s the best practice to do this with WPF? Thanks. 回答1: This is done in silverlight and not in WPF, but it should work the same. Create two private properties on the control: protected bool isDragging; private Point clickPosition; Then attatch some event handlers in the constructor of the control: this

Touch and drag image in android

*爱你&永不变心* 提交于 2019-11-26 07:35:39
问题 I am working on some example in which i want to drag the image corresponding to touch in Android. Does anybody have an idea about how I can do it? 回答1: public class TouchBall extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); int w=getWindowManager().getDefaultDisplay().getWidth()-25; int h=getWindowManager().getDefaultDisplay().getHeight()-25; BallView ballView=new BallView(this,w,h); setContentView(ballView); } } public

How to use UIPanGestureRecognizer to move object? iPhone/iPad

…衆ロ難τιáo~ 提交于 2019-11-26 04:36:28
问题 There are several examples of the UIPanGestureRecognizer class. For example I have read this and I am still not able to use it... On the nib file that I am working on I have a UIView (white rectangle on image) that I wish to drag with that class: and in my .m file I have placed: - (void)setTranslation:(CGPoint)translation inView:(UIView *)view { NSLog(@\"Test to see if this method gets executed\"); } and that method does not get executed when I drag the mouse across the UIView . I have also

JFreechart candlestick chart weird behaviour on drag

痴心易碎 提交于 2019-11-26 04:27:54
问题 This is a follow up question from this question. What happens is the following: When I launch the graph and I drag the graph around, something weird happens: at a certain interval, it seems every 7 periods, the candlesticks get smaller and smaller untill they are only a stripe. Then when I drag further, they become thicker again until they are normal size again. This seems to happen for every 7 periods. An example of this phenomenon is displayed on to the following 3 pictures: The following