StringFormat.GetTabStops メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > StringFormat.GetTabStops メソッドの意味・解説 

StringFormat.GetTabStops メソッド

この StringFormat オブジェクトタブ ストップ取得します

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Public Function GetTabStops ( _
    <OutAttribute> ByRef firstTabOffset As
 Single _
) As Single()
Dim instance As StringFormat
Dim firstTabOffset As Single
Dim returnValue As Single()

returnValue = instance.GetTabStops(firstTabOffset)
public float[] GetTabStops (
    out float firstTabOffset
)
public:
array<float>^ GetTabStops (
    [OutAttribute] float% firstTabOffset
)
public float[] GetTabStops (
    /** @attribute OutAttribute() */ /** @ref */ float firstTabOffset
)
JScript では、値型引数参照渡しされません。

パラメータ

firstTabOffset

テキスト行の先頭最初タブ ストップ間の空白の数。

戻り値
タブ ストップ間隔 (空白の数) の配列

使用例使用例

次の例は、Windows フォームでの使用意図してデザインされており、Paint イベント ハンドラパラメータである PaintEventArgse が必要です。このコード次のアクション実行します

Public Sub GetSetTabStopsExample1(ByVal
 e As PaintEventArgs)
    Dim g As Graphics = e.Graphics

    ' Tools used for drawing, painting.
    Dim redPen As New Pen(Color.FromArgb(255,
 255, 0, 0))
    Dim blueBrush As New
 SolidBrush(Color.FromArgb(255, 0, 0, 255))

    ' Layout and format for text.
    Dim myFont As New Font("Times
 New Roman", 12)
    Dim myStringFormat As New
 StringFormat
    Dim enclosingRectangle As New
 Rectangle(20, 20, 500, 100)
    Dim tabStops As Single()
 = {150.0F, 100.0F, 100.0F}

    ' Text with tabbed columns.
    Dim myString As String
 = "Name" & ControlChars.Tab & "Tab
 1" _
    & ControlChars.Tab & "Tab 2" & ControlChars.Tab
 & "Tab 3" _
    & ControlChars.Cr & "George Brown" &
 ControlChars.Tab & "One" _
    & ControlChars.Tab & "Two" & ControlChars.Tab
 & "Three"

    ' Set the tab stops, paint the text specified by myString,the

    '  and draw rectangle that encloses the text.
    myStringFormat.SetTabStops(0.0F, tabStops)
    g.DrawString(myString, myFont, blueBrush, _
    RectangleF.op_Implicit(enclosingRectangle), myStringFormat)
    g.DrawRectangle(redPen, enclosingRectangle)

    ' Get the tab stops.
    Dim firstTabOffset As Single
    Dim tabStopsObtained As Single()
 = _
    myStringFormat.GetTabStops(firstTabOffset)
    Dim j As Integer
    For j = 0 To tabStopsObtained.Length -
 1

        ' Inspect or use the value in tabStopsObtained[j].
        Console.WriteLine(ControlChars.Cr & "  Tab stop {0}
 = {1}", _
        j, tabStopsObtained(j))
    Next j
End Sub
public void GetSetTabStopsExample1(PaintEventArgs
 e)
{
    Graphics     g = e.Graphics;
             
    // Tools used for drawing, painting.
    Pen          redPen = new Pen(Color.FromArgb(255, 255, 0,
 0));
    SolidBrush   blueBrush = new SolidBrush(Color.FromArgb(255,
 0, 0, 255));
             
    // Layout and format for text.
    Font         myFont = new Font("Times New Roman",
 12);
    StringFormat myStringFormat = new StringFormat();
    Rectangle    enclosingRectangle = new Rectangle(20, 20, 500,
 100);
    float[]      tabStops = {150.0f, 100.0f, 100.0f};
             
    // Text with tabbed columns.
    string       myString =
        "Name\tTab 1\tTab 2\tTab 3\nGeorge Brown\tOne\tTwo\tThree";
             
    // Set the tab stops, paint the text specified by myString, and
 draw the
             
    // rectangle that encloses the text.
    myStringFormat.SetTabStops(0.0f, tabStops);
    g.DrawString(myString, myFont, blueBrush,
        enclosingRectangle, myStringFormat);
    g.DrawRectangle(redPen, enclosingRectangle);
             
    // Get the tab stops.
    float   firstTabOffset;
    float[] tabStopsObtained = myStringFormat.GetTabStops(out
 firstTabOffset);
    for(int j = 0; j < tabStopsObtained.Length;
 j++)
    {
             
        // Inspect or use the value in tabStopsObtained[j].
        Console.WriteLine("\n  Tab stop {0} = {1}", j, tabStopsObtained[j]);
    }
}
public:
   void GetSetTabStopsExample1( PaintEventArgs^ e )
   {
      Graphics^ g = e->Graphics;

      // Tools used for drawing, painting.
      Pen^ redPen = gcnew Pen( Color::FromArgb( 255, 255, 0, 0 ) );
      SolidBrush^ blueBrush = gcnew SolidBrush( Color::FromArgb( 255, 0, 0, 255 )
 );

      // Layout and format for text.
      System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Times New
 Roman",12 );
      StringFormat^ myStringFormat = gcnew StringFormat;
      Rectangle enclosingRectangle = Rectangle(20,20,500,100);
      array<Single>^tabStops = {150.0f,100.0f,100.0f};

      // Text with tabbed columns.
      String^ myString = "Name\tTab 1\tTab 2\tTab 3\nGeorge Brown\tOne\tTwo\tThree";

      // Set the tab stops, paint the text specified by myString, and
 draw the
      // rectangle that encloses the text.
      myStringFormat->SetTabStops( 0.0f, tabStops );
      g->DrawString( myString, myFont, blueBrush, enclosingRectangle, myStringFormat
 );
      g->DrawRectangle( redPen, enclosingRectangle );

      // Get the tab stops.
      float firstTabOffset;
      array<Single>^tabStopsObtained = myStringFormat->GetTabStops( firstTabOffset
 );
      for ( int j = 0; j < tabStopsObtained->Length;
 j++ )
      {
         // Inspect or use the value in tabStopsObtained[j].
         Console::WriteLine( "\n  Tab stop {0} = {1}", j, tabStopsObtained[
 j ] );
      }
   }
public void GetSetTabStopsExample1(PaintEventArgs
 e)
{
    Graphics g = e.get_Graphics();

    // Tools used for drawing, painting.
    Pen redPen = new Pen(Color.FromArgb(255, 255, 0, 0));
    SolidBrush blueBrush = new SolidBrush(Color.FromArgb(255,
 0, 0, 255));

    // Layout and format for text.
    Font myFont = new Font("Times New Roman", 12);
    StringFormat myStringFormat = new StringFormat();
    Rectangle enclosingRectangle = new Rectangle(20, 20, 500,
 100);
    float tabStops[] =  { 150, 100, 100 };

    // Text with tabbed columns.
    String myString = "Name\tTab 1\tTab 2\tTab 3\nGeorge Brown\tOne\tTwo"
 
                    + "\tThree";

    // Set the tab stops, paint the text specified by myString, and
 draw 
    // the rectangle that encloses the text.
    myStringFormat.SetTabStops(0, tabStops);
    g.DrawString(myString, myFont, blueBrush, 
        RectangleF.op_Implicit(enclosingRectangle), myStringFormat);
    g.DrawRectangle(redPen, enclosingRectangle);

    // Get the tab stops.
    float firstTabOffset = 0.0F;
    float tabStopsObtained[] = myStringFormat.GetTabStops(firstTabOffset);

    for (int j = 0; j < tabStopsObtained.length;
 j++) {
        // Inspect or use the value in tabStopsObtained[j].
        Console.WriteLine("\n  Tab stop {0} = {1}", 
            System.Convert.ToString(j), 
            System.Convert.ToString(tabStopsObtained.get_Item(j)));
    }
} //GetSetTabStopsExample1
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からStringFormat.GetTabStops メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からStringFormat.GetTabStops メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からStringFormat.GetTabStops メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

StringFormat.GetTabStops メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



StringFormat.GetTabStops メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS