本文整理匯總了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);
}
}
}
}