Freigeben über


TextPane.TryToShow-Methode

Passt die Position der Ansicht im Textpuffer an, sodass der angegebene Text nach Möglichkeit im Textbereich angezeigt wird. Sie können bestimmen, an welcher Stelle im Bereich der Text angezeigt wird.

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

Parameter

  • PointOrCount
    Typ: System.Object
    Optional.Eine Variante, die das Ende eines anzuzeigenden Textbereichs darstellt.Wenn PointOrCount eine Anzahl von Zeichen ist, stehen die Zeichen nach Point.Wenn PointOrCount einem Punkt vor Point entspricht, befindet er sich am Anfang des Textbereichs, sofern How auf vsPaneShowTop festgelegt wurde.
    Wenn How auf vsPaneShowCentered festgelegt wurde und die Anzahl der Zeilen im markierten Text größer als die Höhe des Bereichs ist, wird die oberste Zeile des markierten Textes an den Anfang des Bereichs gesetzt.

Rückgabewert

Typ: System.Boolean
true, wenn der Text angezeigt werden kann, und andernfalls false.

Beispiele

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-Sicherheit

Siehe auch

Referenz

TextPane Schnittstelle

EnvDTE-Namespace