本文整理汇总了C#中IVwRootBox.MakeSelAt方法的典型用法代码示例。如果您正苦于以下问题:C# IVwRootBox.MakeSelAt方法的具体用法?C# IVwRootBox.MakeSelAt怎么用?C# IVwRootBox.MakeSelAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVwRootBox
的用法示例。
在下文中一共展示了IVwRootBox.MakeSelAt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnRightMouseDown
/// ------------------------------------------------------------------------------------
/// <summary>
/// Process right mouse button down
/// </summary>
/// <param name="pt">The point where the mouse was pressed.</param>
/// <param name="rootb">The root box.</param>
/// <param name="rcSrcRoot">The rc SRC root.</param>
/// <param name="rcDstRoot">The rc DST root.</param>
/// <returns>true if handled, false otherwise</returns>
/// ------------------------------------------------------------------------------------
protected virtual bool OnRightMouseDown(Point pt, IVwRootBox rootb, Rectangle rcSrcRoot,
Rectangle rcDstRoot)
{
InitScreenGraphics();
try
{
IVwSelection sel = (IVwSelection)rootb.Selection;
if (sel != null && sel.IsRange)
{
// TODO KenZ: We need a better way to determine if the cursor is in a selection
// when the selection spans partial lines.
// We don't want to destroy a range selection if we are within the range, since it
// is quite likely the user will want to do a right+click cut or paste.
Rect rcPrimary;
Rect rcSecondary;
bool fSplit;
bool fEndBeforeAnchor;
Debug.Assert(m_screenGraphics.VwGraphics != null);
sel.Location(m_screenGraphics.VwGraphics, rcSrcRoot, rcDstRoot,
out rcPrimary, out rcSecondary, out fSplit,
out fEndBeforeAnchor);
if (pt.X >= rcPrimary.left && pt.X < rcPrimary.right
&& pt.Y >= rcPrimary.top && pt.Y < rcPrimary.bottom)
{
return true;
}
}
try
{
// Make an invisible selection to see if we are in editable text.
sel = rootb.MakeSelAt(pt.X, pt.Y, rcSrcRoot, rcDstRoot, false);
if (sel != null && SelectionHelper.IsEditable(sel))
{
// Make a simple text selection without executing a mouse click. This is
// needed in order to not launch a hot link when we right+click.
rootb.MakeSelAt(pt.X, pt.Y, rcSrcRoot, rcDstRoot, true);
return true;
}
}
catch
{
}
}
finally
{
UninitScreenGraphics();
}
return false;
}