close
這個問題,好像很多人都有遇到,我今天找到答案,改了程式,內容如下:
//_Grd 是一個DataGridView物件。
DataGridViewCellStyle Dvcellstyle = new DataGridViewCellStyle();
//先定義一個DataGridViewCellStyle物件名為Dvcellstyle
Dvcellstyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
//拉出Dvcellstyle的Alignment屬性指定為DataGridViewContentAlignment.MiddleCenter
_Grd.ColumnHeadersDefaultCellStyle = Dvcellstyle ;
//把_Grd的ColumnHeadersDefaultCellStyle屬性指向Dvcellstyle物件即可。
//如果還不滿意,那麼再去作以下指定,X是欄位的位置。
_Grd.Columns[X].SortMode = DataGridViewColumnSortMode.NotSortable;
如果本文有幫到你的話,請不要吝嗇幫忙點一下旁邊或是上面的廣告,贊助一下個人,非常感謝您。
全站熱搜