drag

Drag PictureBox

与世无争的帅哥 提交于 2020-08-10 22:12:13
问题 I want to drag a PictureBox, and I have managed to do so. But my application doesn't do it as smoothly as Windows photo viewer. I mean the difference isn't huge or anything, but it's noticeable. Is there something I could do to make it a little less choppy? This is my simple code: int MOUSE_X = 0; int MOUSE_Y = 0; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { picBox.Image = Image.FromFile(@"D:\test_big.png"); picBox.Width = 3300; picBox.Height

How to drag elements in Ionic 4/5

这一生的挚爱 提交于 2020-07-09 11:49:05
问题 I would like to create draggable (free) buttons in Ionic. In ionic 3 I used a directive to do this (link https://www.joshmorony.com/building-an-absolute-drag-directive-in-ionic-2/) but this directive don't works in ionic 5 and it does not give any errors. What do you think is the best library (supported from some tutorial) for ionic 5 to do this? Thanks in advance. 回答1: This does not have to be Ionic specific. If you are using angular you can just use an NPM component such as https://www

Drag component within a JPanel using Gridbag layout manager

主宰稳场 提交于 2020-07-09 05:42:05
问题 I am trying to implement dragging of a J component within a JPanel. The JPanel has to use Gridbag layout manager. I reviewed many dragging codes, including Moving Windows. They all use component.setLocation(x, y); which has no effect when using Gridbag layout manager. I need help with alternative approach. 回答1: if the JComponent is the only component in the JPanel, the task is not that complicated. Here is a small demo program that does it (with a bonus of re-sizing the component in response

Changing cursor while dragging

梦想与她 提交于 2020-06-25 17:21:16
问题 Is it possible to change the cursor while dragging? I have been searching and trying to do it for a while now. I want to change the 'not-allowed' cursor which shows up while you drag an object to another cursor. I tried creating an event and assigning it to the image I wanted to drag:- <img id="drag1" class="drag" src="http://www.surfixe.com/img/tick2.png" draggable="true" ondragstart="drag(event)" /> java:- function drag(ev) { $('#drag1').css('cursor', 'pointer'); } jsfiddle Edit: Note: My

Changing cursor while dragging

亡梦爱人 提交于 2020-06-25 17:20:48
问题 Is it possible to change the cursor while dragging? I have been searching and trying to do it for a while now. I want to change the 'not-allowed' cursor which shows up while you drag an object to another cursor. I tried creating an event and assigning it to the image I wanted to drag:- <img id="drag1" class="drag" src="http://www.surfixe.com/img/tick2.png" draggable="true" ondragstart="drag(event)" /> java:- function drag(ev) { $('#drag1').css('cursor', 'pointer'); } jsfiddle Edit: Note: My

Changing cursor while dragging

老子叫甜甜 提交于 2020-06-25 17:20:18
问题 Is it possible to change the cursor while dragging? I have been searching and trying to do it for a while now. I want to change the 'not-allowed' cursor which shows up while you drag an object to another cursor. I tried creating an event and assigning it to the image I wanted to drag:- <img id="drag1" class="drag" src="http://www.surfixe.com/img/tick2.png" draggable="true" ondragstart="drag(event)" /> java:- function drag(ev) { $('#drag1').css('cursor', 'pointer'); } jsfiddle Edit: Note: My

javafx实现拖人文件到node,将node里面的内容为文件保存

假装没事ソ 提交于 2020-03-02 03:08:13
最近研究了下javafx客户端人性化方面的,拖来拖去什么的最爱了,接下来给大家讲解下javafx怎么获取拖入的文件和将node里面的内容拖出为文件 1.获取拖入的文件 //build drag txtAreaChangePane.setOnDragOver(new EventHandler<DragEvent>() { //node添加拖入文件事件 public void handle(DragEvent event) { Dragboard dragboard = event.getDragboard(); if (dragboard.hasFiles()) { File file = dragboard.getFiles().get(0); if (file.getAbsolutePath().endsWith(".java")) { //用来过滤拖入类型 event.acceptTransferModes(TransferMode.COPY);//接受拖入文件 } } } }); txtAreaChangePane.setOnDragDropped(new EventHandler<DragEvent>() { //拖入后松开鼠标触发的事件 public void handle(DragEvent event) { // get drag enter file

Simple drag and drop code

拜拜、爱过 提交于 2020-01-22 09:30:10
问题 Im struggling with seemingly a simple javascript exercise, writing a vanilla drag and drop. I think Im making a mistake with my 'addeventlisteners', here is the code: var ele = document.getElementsByClassName ("target")[0]; var stateMouseDown = false; //ele.onmousedown = eleMouseDown; ele.addEventListener ("onmousedown" , eleMouseDown , false); function eleMouseDown () { stateMouseDown = true; document.addEventListener ("onmousemove" , eleMouseMove , false); } function eleMouseMove (ev) { do

Xcode iOS push down button and drag then up on a second button

你离开我真会死。 提交于 2020-01-21 10:01:25
问题 Lets say I wan't to add 1 to an integer. This will only be done when I push down on a UIButton and then release my finger on another UIButton . A drag combo. Whats the easiest way I can make an IBAction occur out of a combo? This could be done with touch coordinates or maybe just UIButtons and IBActions . How do I create a 2-button combo with IBActions 回答1: Try implementing the button you wish to touch down on as a "Touch Down", "Touch Up Inside", and "Touch Up Outside" button. UIButtons can

Dragging and dropping a <li> id to a text input

两盒软妹~` 提交于 2020-01-15 12:19:07
问题 I've searched the interwebs, and I'm not working out how to do that. I would like to have something like a file list, and the drag and drop a file (a <li> element) and write it's id to a text field. Would it be possible ? 回答1: Yes it is possible using jQuery UI draggable and droppable plugins. You need to include jQuery UI script reference into your page. jQuery UI CDN - http://code.jquery.com/ui/1.11.4/jquery-ui.min.js Html <ul> <li id="li1">Li 1</li> <li id="li2">Li 2</li> <li id="li3">Li 3