本文整理汇总了C#中System.Windows.Forms.ToolStripItem.SetOwner方法的典型用法代码示例。如果您正苦于以下问题:C# ToolStripItem.SetOwner方法的具体用法?C# ToolStripItem.SetOwner怎么用?C# ToolStripItem.SetOwner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ToolStripItem
的用法示例。
在下文中一共展示了ToolStripItem.SetOwner方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnAfterRemove
/// <devdoc>
/// Do proper cleanup of ownership, etc.
/// </devdoc>
private void OnAfterRemove(ToolStripItem item) {
if (itemsCollection) {
ToolStrip parent = null;
if (item != null) {
parent = item.ParentInternal;
item.SetOwner(null);
}
if (owner != null) {
if (!owner.IsDisposingItems) {
ToolStripItemEventArgs e = new ToolStripItemEventArgs(item);
owner.OnItemRemoved(e);
// VSWhidbey 505129
// dont fire the ItemRemoved event for Overflow
// it would fire constantly.... instead clear any state if the item
// is really being removed from the master collection.
if (parent != null && parent != owner) {
parent.OnItemVisibleChanged(e, /*performLayout*/false);
}
}
}
}
}
示例2: SetOwner
private void SetOwner(ToolStripItem item) {
if (itemsCollection) {
if (item != null) {
if (item.Owner != null) {
item.Owner.Items.Remove(item);
}
item.SetOwner(owner);
if (item.Renderer != null) {
item.Renderer.InitializeItem(item);
}
}
}
}
示例3: OnAfterRemove
private void OnAfterRemove(ToolStripItem item)
{
if (this.itemsCollection)
{
ToolStrip parentInternal = null;
if (item != null)
{
parentInternal = item.ParentInternal;
item.SetOwner(null);
}
if ((this.owner != null) && !this.owner.IsDisposingItems)
{
ToolStripItemEventArgs e = new ToolStripItemEventArgs(item);
this.owner.OnItemRemoved(e);
if ((parentInternal != null) && (parentInternal != this.owner))
{
parentInternal.OnItemVisibleChanged(e, false);
}
}
}
}