Click here to Skip to main content
15,066,928 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I used the virtual grid control in Devage sourcegrid control, but I cann't find how to implement the Sourcegrid.Cells.Virtual.ColumnHeader cell. I want to set the columnheader of the datagrid middlecenter. Please help.
Posted

1 solution

Try this...

datagridview.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
   
Comments
Davey_guan 7-Mar-11 20:02pm
   
Thanks for the reply. But I can not find the "ColumnHeadersDefaultCellStyle". Could you give me more details?

Attach my code here:

DevAge.ComponentModel.BoundDataView bd = new DevAge.ComponentModel.BoundDataView(myDs.Tables["Rev"].DefaultView);
bd.AllowEdit = true;
bd.AllowNew = true;

dgRevHistory.DataSource = bd;
dgRevHistory.FixedColumns = 0;
dgRevHistory.FixedRows = 1;
dgRevHistory.Columns[0].AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize;
SourceGrid.Cells.Virtual.ColumnHeader colHeader = new SourceGrid.Cells.Virtual.ColumnHeader();
colHeader.View.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;

But I don't know how to implement the colHeader object into the dgRevHistroy virtual grid?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900