本文整理汇总了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);
}
}
}
示例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);
}