DataGridViewCellStyle.Padding プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataGridViewCellStyle.Padding プロパティの意味・解説 

DataGridViewCellStyle.Padding プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

DataGridViewCell の端とその内容との間隔取得または設定します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

解説解説

Padding プロパティ設定すると、DataGridViewCell編集コントロール描画する位置影響受けます。たとえば、LeftTopRight、および Bottom の各プロパティの値が 10設定されている System.Windows.Forms.Padding を DataGridViewTextBoxCell の Padding設定すると、セル内容セル中央描画されテキスト ボックスの端とセルの端との間隔10 ピクセルなります

使用例使用例

オーナー描画列を含む DataGridView コントロールで、このプロパティ使用するコード例次に示します各行には、行の幅全体にわたるテキストが、通常のセル内容隠れて表示されています。Padding プロパティ使用して、このテキスト表示するための追加領域作成します。この例では、追加する必要のある高さが CUSTOM_CONTENT_HEIGHT という定数格納されます。

ここに示すコード例は、より長い例の一部です。コード例全体については、「方法 : Windows フォームの DataGridView コントロールの行の外観カスタマイズする」を参照してください

' Set a cell padding to provide space for the top of the focus 
' rectangle and for the content that spans multiple columns. 
Dim newPadding As New Padding(0,
 1, 0, CUSTOM_CONTENT_HEIGHT)
Me.dataGridView1.RowTemplate.DefaultCellStyle.Padding = newPadding

' Set the selection background color to transparent so 
' the cell won't paint over the custom selection background.
Me.dataGridView1.RowTemplate.DefaultCellStyle.SelectionBackColor
 = _
    Color.Transparent

' Set the row height to accommodate the normal cell content and the
 
' content that spans multiple columns.
Me.dataGridView1.RowTemplate.Height += CUSTOM_CONTENT_HEIGHT
// Set a cell padding to provide space for the top of the focus 
// rectangle and for the content that spans multiple columns. 
Padding newPadding = new Padding(0, 1, 0, CUSTOM_CONTENT_HEIGHT);
this.dataGridView1.RowTemplate.DefaultCellStyle.Padding = newPadding;

// Set the selection background color to transparent so 
// the cell won't paint over the custom selection background.
this.dataGridView1.RowTemplate.DefaultCellStyle.SelectionBackColor
 =
    Color.Transparent;

// Set the row height to accommodate the content that 
// spans multiple columns.
this.dataGridView1.RowTemplate.Height += CUSTOM_CONTENT_HEIGHT;
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

DataGridViewCellStyle.Padding プロパティのお隣キーワード
検索ランキング

   

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



DataGridViewCellStyle.Padding プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS