回答編集履歴

1

見直しキャンペーン中

2023/07/23 07:02

投稿

TN8001
TN8001

スコア9326

test CHANGED
@@ -1,21 +1,11 @@
1
1
  > データグリッドビューにおいて、任意の列ヘッダーの文字列表示位置は中央、その列のセルの文字列表示位置は左寄せにしたい。
2
2
 
3
-
4
-
5
3
  こういうことですか?
6
-
7
- ```C#
4
+ ```cs
8
-
9
5
  TextFormatFlags flags = TextFormatFlags.Left | TextFormatFlags.VerticalCenter;
10
6
 
11
-
12
-
13
7
  if(e.RowIndex == -1)
14
-
15
8
  flags = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter;
16
-
17
9
  ```
18
10
 
19
-
20
-
21
11
  [DataGridViewCellPaintingEventArgs.RowIndex プロパティ (System.Windows.Forms) | Microsoft Docs](https://docs.microsoft.com/ja-jp/dotnet/api/system.windows.forms.datagridviewcellpaintingeventargs.rowindex?#--)