本文整理汇总了C#中IViewContent.SetParentForm方法的典型用法代码示例。如果您正苦于以下问题:C# IViewContent.SetParentForm方法的具体用法?C# IViewContent.SetParentForm怎么用?C# IViewContent.SetParentForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IViewContent
的用法示例。
在下文中一共展示了IViewContent.SetParentForm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowContent
/// <summary>
/// Shows the content.
/// </summary>
/// <param name="vc">The vc.</param>
internal void ShowContent(IViewContent vc)
{
DockContent content = new DockContent();
content.TabText = vc.Title;
content.Text = vc.Title;
content.ToolTipText = vc.Description;
content.CloseButton = vc.AllowUserClose;
content.CloseButtonVisible = vc.AllowUserClose;
content.Tag = vc;
var icon = vc.ViewIcon;
if (icon != null)
{
content.Icon = icon;
content.ShowIcon = true;
}
if (vc.IsExclusiveToDocumentRegion)
{
content.DockAreas = DockAreas.Document;
}
else
{
content.DockAreas = (DockAreas)(vc.DefaultRegion);
}
vc.SetParentForm(content);
vc.ViewContentActivating += (sender, e) =>
{
content.Activate();
};
vc.TitleChanged += (sender, e) =>
{
content.TabText = vc.Title;
content.Text = vc.Title;
};
vc.DescriptionChanged += (sender, e) =>
{
content.ToolTipText = vc.Description;
};
if (vc.AllowUserClose && vc.IsExclusiveToDocumentRegion)
content.TabPageContextMenuStrip = documentTabContextMenu;
content.ClientSize = vc.ContentControl.Size;
vc.ContentControl.Dock = DockStyle.Fill;
content.Controls.Add(vc.ContentControl);
if (vc.IsModalWindow && vc.DefaultRegion == ViewRegion.Floating)
{
content.StartPosition = FormStartPosition.CenterParent;
content.ShowDialog();
}
else
{
content.Show(contentPanel);
}
}