Compartir a través de


TextPane.TryToShow Method

Adjusts the location of the view in the text buffer so that the indicated range of text is shown in the text pane, if possible. You can control where in the pane the text displays.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
Function TryToShow ( _
    Point As TextPoint, _
    How As vsPaneShowHow, _
    PointOrCount As Object _
) As Boolean
bool TryToShow(
    TextPoint Point,
    vsPaneShowHow How,
    Object PointOrCount
)
bool TryToShow(
    [InAttribute] TextPoint^ Point, 
    [InAttribute] vsPaneShowHow How, 
    [InAttribute] Object^ PointOrCount
)
abstract TryToShow : 
        Point:TextPoint * 
        How:vsPaneShowHow * 
        PointOrCount:Object -> bool
function TryToShow(
    Point : TextPoint, 
    How : vsPaneShowHow, 
    PointOrCount : Object
) : boolean

Parameters

  • PointOrCount
    Type: System.Object

    Optional. A variant representing the end of a range of text to show. If PointOrCount is a number of characters, the characters follow Point. If PointOrCount is a point before Point, then it will be at the top of the text pane if How is set to vsPaneShowTop.

    If How is set to vsPaneShowCentered, and the number of lines in the selected text is greater than the height of the pane, then the top line of the selected text is placed at the top of the pane.

Return Value

Type: System.Boolean
true if the text can be displayed; otherwise, false.

Examples

Sub TryToShowExample(ByVal dte As EnvDTE.DTE)
    Dim objTW As TextWindow
    Dim objPane As TextPane
    Dim objStart As TextPoint

    objTW = dte.ActiveWindow.Object
    objPane = objTW.ActivePane
    MsgBox("The active pane is " & Str(objPane.Height) & " lines high _
    and " & Str(objPane.Width) & " columns wide.")
    objStart = objPane.StartPoint
    MsgBox("It begins at line " & Str(objStart.Line) & ", column " & _
    Str(objStart.LineCharOffset) & ".")
    objPane.TryToShow(objStart, vsPaneShowHow.vsPaneShowCentered)
End Sub
public void TryToShowExample(_DTE dte)
{
    TextWindow tw;
    TextPane tpn;
    TextPoint tpt;

    tw = (TextWindow)dte.ActiveWindow.Object;
    tpn = tw.ActivePane;
    MessageBox.Show ("The active pane is " + tpn.Height.ToString () + " 
    lines high and " + tpn.Width.ToString () + " columns wide.");
    tpt = tpn.StartPoint;
    MessageBox.Show ("It begins at line " + tpt.Line.ToString () + ", 
    column " + tpt.LineCharOffset.ToString () + ".");
    tpn.TryToShow (tpt,vsPaneShowHow.vsPaneShowCentered,1);
}

.NET Framework Security

See Also

Reference

TextPane Interface

EnvDTE Namespace