The SampleCsDragData class
Inheritance: ISerializable
示例#1
0
        /// <summary>
        /// This method is called when the drag and drop operation is completed and
        /// the item being dragged was dropped on a valid, top level Rhino object.
        /// </summary>
        public override bool OnDropOnObject(IRhinoObjRef objRef, MRhinoView rhinoView, DataObject data, DragDropEffects dropEffect, Point point)
        {
            SampleCsDragData dragData = GetSampleCsDragData(data);

            if (null == dragData)
            {
                return(false);
            }

            MessageBox.Show(
                RhUtil.RhinoApp().MainWnd(),
                "String \"" + dragData.DragString + "\" Dropped on object",
                "SampleCsDragDrop",
                MessageBoxButtons.OK,
                MessageBoxIcon.Information
                );

            return(true);
        }
示例#2
0
        /// <summary>
        /// This method is called when the drag and drop operation is completed and
        /// the item being dragged was dropped on the Rhino layer list control.
        /// </summary>
        public override bool OnDropOnLayerListCtrl(IWin32Window layerListCtrl, int layerIndex, DataObject data, DragDropEffects dropEffect, Point point)
        {
            SampleCsDragData dragData = GetSampleCsDragData(data);

            if (null == dragData)
            {
                return(false);
            }

            if (layerIndex < 0)
            {
                MessageBox.Show(
                    RhUtil.RhinoApp().MainWnd(),
                    "String \"" + dragData.DragString + "\" Dropped on layer list control, not on a layer",
                    "SampleCsDragDrop",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information
                    );
            }
            else
            {
                MRhinoDoc doc = RhUtil.RhinoApp().ActiveDoc();
                if (null != doc && layerIndex < doc.m_layer_table.LayerCount())
                {
                    MessageBox.Show(
                        RhUtil.RhinoApp().MainWnd(),
                        "String \"" + dragData.DragString + "\" Dropped on layer \"" + doc.m_layer_table[layerIndex].m_name + "\"",
                        "SampleCsDragDrop",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information
                        );
                }
            }

            return(true);
        }