Beispiel #1
0
        private void treeView1_DragOver(object sender, DragEventArgs e)
        {
            e.Effect = DragDropEffects.None;

            ParticleEffectTreeDragDropPacket packet = (ParticleEffectTreeDragDropPacket)e.Data.GetData(typeof(ParticleEffectTreeDragDropPacket));

            if (packet == null)
            {
                return;
            }
            TreeView tree = (TreeView)packet.sender;

            Point pt = new Point(e.X, e.Y);

            pt = tree.PointToClient(pt);

            TreeNode node = tree.GetNodeAt(pt);

            if (node == null)
            {
                return;
            }

            if ((ParticleEditorPageEnum)node.Tag != ParticleEditorPageEnum.eEmitter)
            {
                return;
            }

            if (packet.emitterIndex == node.Index)
            {
                return;
            }

            e.Effect = DragDropEffects.Copy;
        }
Beispiel #2
0
        private void treeView1_DragDrop(object sender, DragEventArgs e)
        {
            ParticleEffectTreeDragDropPacket packet = (ParticleEffectTreeDragDropPacket)e.Data.GetData(typeof(ParticleEffectTreeDragDropPacket));

            if (packet == null)
            {
                return;
            }

            TreeView tree = (TreeView)sender;
            Point    pt   = new Point(e.X, e.Y);

            pt = tree.PointToClient(pt);

            TreeNode node  = tree.GetNodeAt(pt);
            int      index = node.Index;

            if (index < 0 || index >= mEffect.Emitters.Count)
            {
                return;
            }

            if (packet.emitterIndex < 0 || packet.emitterIndex >= mEffect.Emitters.Count)
            {
                return;
            }

            //-- clone the selected emitter
            ParticleEmitter clone = mEffect.Emitters[index].clone();

            mEffect.Emitters[index] = mEffect.Emitters[packet.emitterIndex];
            mEffect.Emitters[packet.emitterIndex] = clone;
            refreshTreeView(false);
        }
Beispiel #3
0
        private void treeView1_MouseDown(object sender, MouseEventArgs e)
        {
            TreeView tree = (TreeView)sender;
            TreeNode node = tree.GetNodeAt(e.X, e.Y);

            tree.SelectedNode = node;
            if (node == null)
            {
                return;
            }

            if ((ParticleEditorPageEnum)node.Tag != ParticleEditorPageEnum.eEmitter)
            {
                return;
            }

            if (e.Button != MouseButtons.Middle)
            {
                return;
            }

            if (node != null)
            {
                ParticleEffectTreeDragDropPacket packet = new ParticleEffectTreeDragDropPacket();
                packet.emitterIndex = node.Index;
                packet.sender       = treeView1;
                treeView1.DoDragDrop(packet, DragDropEffects.Copy);
            }
        }