本文整理汇总了C#中Slice.AboutToDiscard方法的典型用法代码示例。如果您正苦于以下问题:C# Slice.AboutToDiscard方法的具体用法?C# Slice.AboutToDiscard怎么用?C# Slice.AboutToDiscard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Slice
的用法示例。
在下文中一共展示了Slice.AboutToDiscard方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveSlice
private void RemoveSlice(Slice gonner, int index)
{
gonner.AboutToDiscard();
gonner.SplitCont.SplitterMoved -= new SplitterEventHandler(slice_SplitterMoved);
Controls.RemoveAt(index);
// Reset CurrentSlice, if appropriate.
if (gonner == m_currentSlice)
{
Slice newCurrent = null;
if (Controls.Count > index)
{
// Get the one at the same index (next one after the one being removed).
newCurrent = Controls[index] as Slice;
}
else if (Controls.Count > 0 && Controls.Count > index - 1)
{
// Get the one before index.
newCurrent = Controls[index - 1] as Slice;
}
if (newCurrent != null)
{
CurrentSlice = newCurrent;
}
else
{
m_currentSlice = null;
gonner.SetCurrentState(false);
}
}
// Since "gonner's" SliceTreeNode still is referenced by m_tooltip,
// (if it has one at all, that is),
// we have to also remove with ToolTip for gonner,
// Since the dumb MS ToolTip class can't just remove one,
// we have to remove them all and re-add the remaining ones
// in order to have it really turn loose of the SliceTreeNode.
// But, only do all of that, if it actually has a ToolTip.
bool gonnerHasToolTip = (gonner.ToolTip != null);
if (gonnerHasToolTip)
m_tooltip.RemoveAll();
gonner.Dispose();
// Now, we need to re-add all of the surviving tooltips.
if (gonnerHasToolTip)
{
foreach (Slice keeper in Controls)
SetToolTip(keeper);
}
ResetTabIndices(index);
}