当前位置: 首页>>代码示例>>C#>>正文


C# DataObject.SetIColorData方法代码示例

本文整理汇总了C#中System.Windows.Forms.DataObject.SetIColorData方法的典型用法代码示例。如果您正苦于以下问题:C# DataObject.SetIColorData方法的具体用法?C# DataObject.SetIColorData怎么用?C# DataObject.SetIColorData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.DataObject的用法示例。


在下文中一共展示了DataObject.SetIColorData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnMouseMove

        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            bool lastCDiagButtonHovered = this.buttonCDiagHovered;
            bool lastCPickButtonHovered = this.buttonCPickHovered;
            bool lastPanelHovered = this.panelHovered;
            this.buttonCDiagHovered = !this.ReadOnly && this.rectCDiagButton.Contains(e.Location);
            this.buttonCPickHovered = !this.ReadOnly && this.rectCPickButton.Contains(e.Location);
            this.panelHovered = this.rectPanel.Contains(e.Location);

            if (lastCDiagButtonHovered != this.buttonCDiagHovered ||
                lastCPickButtonHovered != this.buttonCPickHovered ||
                lastPanelHovered != this.panelHovered)
                this.Invalidate();

            if (this.panelDragBegin != Point.Empty)
            {
                if (Math.Abs(this.panelDragBegin.X - e.X) > 5 || Math.Abs(this.panelDragBegin.Y - e.Y) > 5)
                {
                    DataObject dragDropData = new DataObject();
                    dragDropData.SetIColorData(new[] { this.value });
                    this.ParentGrid.DoDragDrop(dragDropData, DragDropEffects.All | DragDropEffects.Link);
                }
            }
        }
开发者ID:SirePi,项目名称:duality,代码行数:26,代码来源:IColorDataPropertyEditor.cs

示例2: OnKeyDown

        protected override void OnKeyDown(KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Return)
            {
                this.ShowColorDialog();
                e.Handled = true;
            }
            else if (e.KeyCode == Keys.C && e.Control)
            {
                DataObject data = new DataObject();
                data.SetIColorData(new[] { this.value ?? (IColorData)ColorRgba.TransparentBlack });
                Clipboard.SetDataObject(data);
                e.Handled = true;
            }
            else if (e.KeyCode == Keys.V && e.Control)
            {
                DataObject data = Clipboard.GetDataObject() as DataObject;
                if (data.ContainsIColorData())
                {
                    this.value = data.GetIColorData<IColorData>().FirstOrDefault();
                    this.PerformSetValue();
                    this.PerformGetValue();
                    this.OnEditingFinished(FinishReason.LeapValue);
                }
                else
                    System.Media.SystemSounds.Beep.Play();

                e.Handled = true;
            }
            base.OnKeyDown(e);
        }
开发者ID:SirePi,项目名称:duality,代码行数:31,代码来源:IColorDataPropertyEditor.cs


注:本文中的System.Windows.Forms.DataObject.SetIColorData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。