本文整理汇总了C#中System.Windows.Forms.DataObject.SetComponentRefs方法的典型用法代码示例。如果您正苦于以下问题:C# DataObject.SetComponentRefs方法的具体用法?C# DataObject.SetComponentRefs怎么用?C# DataObject.SetComponentRefs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DataObject
的用法示例。
在下文中一共展示了DataObject.SetComponentRefs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializeToData
protected override void SerializeToData(DataObject data)
{
data.SetComponentRefs(new[] { this.component });
}
示例2: AppendNodesToData
protected void AppendNodesToData(DataObject data, IEnumerable<TreeNodeAdv> nodes, bool guardRequiredComponents)
{
if (!guardRequiredComponents)
{
data.SetData(nodes.ToArray());
data.SetComponentRefs(
from c in nodes
where c.Tag is ComponentNode
select (c.Tag as ComponentNode).Component);
data.SetGameObjectRefs(
from c in nodes
where c.Tag is GameObjectNode
select (c.Tag as GameObjectNode).Obj);
}
else
{
// Query selected objects and components
var nodeQuery =
from viewNode in this.objectView.SelectedNodes
select this.objectModel.FindNode(this.objectView.GetPath(viewNode)) as NodeBase;
var cmpQuery =
from cmpNode in nodeQuery
where cmpNode is ComponentNode
select (cmpNode as ComponentNode).Component;
var objQuery =
from objNode in nodeQuery
where objNode is GameObjectNode
select (objNode as GameObjectNode).Obj;
var cmpList = new List<Component>(cmpQuery);
var objList = new List<GameObject>(objQuery);
// Check which Components may be removed and which not
Component conflictComp = this.CheckComponentsRemovable(cmpList, objList);
if (conflictComp != null)
{
this.FlashNode(this.FindNode(conflictComp));
System.Media.SystemSounds.Beep.Play();
}
var viewNodeQuery =
cmpList.Select(c => this.objectView.FindNodeByTag(this.FindNode(c))).
Concat( objList.Select(o => this.objectView.FindNodeByTag(this.FindNode(o))));
this.AppendNodesToData(data, viewNodeQuery.ToArray(), false);
}
}