本文整理汇总了C#中Template.CreateFromTemplate方法的典型用法代码示例。如果您正苦于以下问题:C# Template.CreateFromTemplate方法的具体用法?C# Template.CreateFromTemplate怎么用?C# Template.CreateFromTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template.CreateFromTemplate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: projectTree_DragDrop
void projectTree_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
{
if (sender is TreeView)
{
Point pt = new Point(e.X, e.Y);
pt = ((TreeView)sender).PointToClient(pt);
dropOnNode = ((TreeView)sender).GetNodeAt(pt);
if (e.Data.GetData("DraggedPageNode") != null)
{
if (dropOnNode != null && dropOnNode.Parent != null && dropOnNode is PageNode)
{
if (dropOnNode != draggedPageNode)
{
draggedPageNode.Remove();
int mouseOverIndex = dropOnNode.Index;
if (dropOnNode.Parent != null)
{
dropOnNode.Parent.Nodes.Insert(mouseOverIndex, draggedPageNode);
foreach (TreeNode pageNode in dropOnNode.Parent.Nodes)
{
if (pageNode is PageNode)
{
((PageNode)pageNode).Page.Position = pageNode.Index;
((PageNode)pageNode).Page.SaveToDb();
}
}
}
}
}
}
if (e.Data.GetData("DraggedTemplateNode") != null)
{
if (dropOnNode != null && dropOnNode is PageNode)
{
int dropOnNodePosition = ((PageNode)dropOnNode).Page.Position;
SelectView(((PageNode)dropOnNode).Page.view.Name);
Template template = new Template(this.mainForm.mediator);
template.CreateFromTemplate((TemplateNode)draggedTemplateNode, dropOnNodePosition);
int mouseOverIndex = dropOnNodePosition;
if (dropOnNode != null && dropOnNode.Parent != null)
{
foreach (TreeNode pageNode in dropOnNode.Parent.Nodes)
{
if (pageNode is PageNode)
{
((PageNode)pageNode).Page.Position = pageNode.Index;
((PageNode)pageNode).Page.SaveToDb();
}
}
}
Page selectedPage = this.mainForm.mediator.ProjectExplorer.SelectedPage;
this.mainForm.mediator.projectExplorer_PageSelected(selectedPage);
}
else if (dropOnNode != null && dropOnNode is ViewNode)
{
if (draggedTemplateNode.FullPath.Contains(@"Templates\Pages\"))
{
int dropOnNodePosition = ((ViewNode)dropOnNode).Nodes.Count;
SelectView(((ViewNode)dropOnNode).Text);
Template template = new Template(this.mainForm.mediator);
template.CreateFromTemplate((TemplateNode)draggedTemplateNode, dropOnNodePosition);
int mouseOverIndex = dropOnNodePosition;
if (dropOnNode != null && dropOnNode.Parent != null)
{
foreach (TreeNode pageNode in dropOnNode.Parent.Nodes)
{
if (pageNode is PageNode)
{
((PageNode)pageNode).Page.Position = pageNode.Index;
((PageNode)pageNode).Page.SaveToDb();
}
}
}
Page selectedPage = this.mainForm.mediator.ProjectExplorer.SelectedPage;
this.mainForm.mediator.projectExplorer_PageSelected(selectedPage);
}
else
new Template(this.mainForm.mediator).CreateFromTemplate((TemplateNode)draggedTemplateNode, new Point(0, 0));
}
}
}
dropOnNode = null;
}