本文整理汇总了C#中System.Windows.DataObject.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# DataObject.ToString方法的具体用法?C# DataObject.ToString怎么用?C# DataObject.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.DataObject
的用法示例。
在下文中一共展示了DataObject.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMouseMove
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
if (e.LeftButton != MouseButtonState.Pressed)
{
this.dragStartPoint = null;
}
if (this.dragStartPoint.HasValue)
{
Point position = e.GetPosition(this);
if ((SystemParameters.MinimumHorizontalDragDistance <=
Math.Abs((double)(position.X - this.dragStartPoint.Value.X))) ||
(SystemParameters.MinimumVerticalDragDistance <=
Math.Abs((double)(position.Y - this.dragStartPoint.Value.Y))))
{
Image contentImg = this.Content as Image;
BitmapImage contentBitmapImg = contentImg.Source as BitmapImage;
DataObject dataObject = new DataObject("GRID_ITEM", contentImg);
dataObject.SetData("CLASS_ID", this.ClassId);
if (dataObject != null)
{
#if DEBUG
Console.WriteLine("ToolboxItem.OnMouseMove: GridItem sollte erstellt werden: " + dataObject.ToString());
Console.WriteLine("ToolboxItem.OnMouseMove: TBI.ClassID: " + this.ClassId.ToString());
Console.WriteLine("ToolboxItem.OnMouseMove: BitmapImage " + contentBitmapImg.ToString());
#endif
DragDrop.DoDragDrop(this, dataObject, DragDropEffects.Copy);
}
}
e.Handled = true;
}
}