private void treeView1_DragDrop(object sender, DragEventArgs e) { if (renderScene == null) { return; } TreeNode myNode = null; ControlDDData data = e.Data.GetData(typeof(ControlDDData)) as ControlDDData; if (data != null && data.extNode is TreeNode) { myNode = data.extNode as TreeNode; } else { return; } Point Position = Point.Empty; Position.X = e.X; Position.Y = e.Y; Position = treeView1.PointToClient(Position); TreeNode DropNode = this.treeView1.GetNodeAt(Position); if (DropNode == null || DropNode.Parent == myNode || DropNode == myNode) { return; } renderScene.changePosByUniQue(myNode.Tag as String, DropNode.Tag as String); reloadSceneInfo(); }
private void ImageText_MouseDown(object sender, MouseEventArgs e) { ControlDDData data = new ControlDDData(); data.controlType = (string)this.Tag; this.DoDragDrop(data, DragDropEffects.Copy); }
private void treeView1_DragDrop(object sender, DragEventArgs e) { TreeNode myNode = null; ControlDDData data = e.Data.GetData(typeof(ControlDDData)) as ControlDDData; if (data != null && data.extNode is TreeNode) { myNode = data.extNode as TreeNode; } else { return; } Point Position = Point.Empty; Position.X = e.X; Position.Y = e.Y; Position = treeView1.PointToClient(Position); TreeNode DropNode = this.treeView1.GetNodeAt(Position); if (DropNode == null || DropNode.Parent == myNode || DropNode == myNode) { return; } EventManager.RaiserEvent(Constant.PreViewImageChange, this, null); FileHelper.CutPathToAnother(myNode.Tag as String, DropNode.Tag as String); reloadTree(); }
protected override void Item_DragDrop(object sender, DragEventArgs e) { string[] formats = e.Data.GetFormats(); ControlDDData data = (ControlDDData)e.Data.GetData(e.Data.GetFormats()[0]); DragVoke voke = new DragVoke(addDragItemType); Point point = this.PointToClient(new Point(e.X, e.Y)); Invoke(voke, new Object[] { data.controlType, data.controlData, getFixPoint(point.X, point.Y) }); //IAsyncResult asyncResult = BeginInvoke(voke, new Object[] { data.controlType, data.controlData, this.PointToClient(new Point(e.X - DefaultOffsetPos.X, e.Y - DefaultOffsetPos.Y)) }); //EndInvoke(asyncResult); //addDragItemType(data.controlType, data.controlData, this.PointToClient(new Point(e.X - DefaultOffsetPos.X, e.Y - DefaultOffsetPos.Y))); }
private void treeView1_DragEnter(object sender, DragEventArgs e) { ControlDDData data = e.Data.GetData(typeof(ControlDDData)) as ControlDDData; if (data != null && data.extNode is TreeNode) { e.Effect = DragDropEffects.All; } else { e.Effect = DragDropEffects.None; } }
void propertyGrid1_DragEnter(object sender, DragEventArgs e) { ControlDDData data = e.Data.GetData(typeof(ControlDDData)) as ControlDDData; if (data != null && data.isImage) { e.Effect = e.AllowedEffect; } else { e.Effect = DragDropEffects.None; } }
void propertyGrid1_DragDrop(object sender, DragEventArgs e) { ControlDDData data = e.Data.GetData(typeof(ControlDDData)) as ControlDDData; object propertyGridView = GetPropertyGridView(this.propGrid); GridItemCollection allGridEntries = GetAllGridEntries(propertyGridView); int top = GetTop(propertyGridView); int itemHeight = GetCachedRowHeight(propertyGridView); VScrollBar scrollBar = GetVScrollBar(propertyGridView); GridItem item = GetItemAtPoint(allGridEntries, top, itemHeight, scrollBar.Value, this.propGrid.PointToClient(new Point(e.X, e.Y))); if (item != null && item.PropertyDescriptor != null && this.propGrid.SelectedObject is CustomProperty) { Attribute attr = item.PropertyDescriptor.Attributes[typeof(ImageAttribute)]; if (attr != null) { item.PropertyDescriptor.SetValue((this.propGrid.SelectedObject as CustomProperty).GetPropertyOwner(null), UIProject.Instance().GetRelativePath(data.controlData as String)); } } this.propGrid.Refresh(); }