|
-
Sep 13th, 2005, 12:38 PM
#1
Thread Starter
Hyperactive Member
Re: datagrid column color
I have a DateSet with three Column. The first 2 are boudned, and the last one is not. I want to add some color to the last unbounded column.
-
Sep 13th, 2005, 12:52 PM
#2
Re: datagrid column color
 Originally Posted by Palmtree
I have a DateSet with three Column. The first 2 are boudned, and the last one is not. I want to add some color to the last unbounded column.
Ok i thing there is something that you misunderstand here ..
The Code that you show me add a column to the DataSet, and if you bound this DataSet to the DataGrid then all the 3 columns will be considered "Bounded" to the Grid!
So you may handle the layout by using DataGridTableStyle and DataGridColumnStyle.
-
Sep 13th, 2005, 01:01 PM
#3
Thread Starter
Hyperactive Member
Re: datagrid column color
Oh, Great! Thanks for pulling me to the correct direction.
But I still do not see how to change the color of either that column or its column headtext or its border.
-
Sep 13th, 2005, 01:36 PM
#4
Re: datagrid column color
 Originally Posted by Palmtree
Oh, Great! Thanks for pulling me to the correct direction.
But I still do not see how to change the color of either that column or its column headtext or its border.
Good! now that we talk of the same thing it will be easier 
First you have to know that Each DataGrid have a TableStyles collection property that can hold several Table Layout, and for each TableStyles there is a GridColumnStyles collection property that can hold all Column layout style.
The basic DataGridColomnStyle are realy "basic" they don't have many formating methode/functon. So you will have to create your own DataGridColumnStyle for a CheckBox column type it could be something like
VB Code:
Public Class MyDataGridBoolColumn
Inherits DataGridBoolColumn
' Do stuff
End Class
Now instend of appening a Standart DataGridBoolColumn to the GridColumnStylesCollection of the TablesStyle from the DataGrid, append a new instance of MyDataGridBoolColumn
For example in the Load Event of a Form.
VB Code:
Private Sub frmCamionPlanif_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ColStyle As MyDataGridBoolColumn = New MyDataGridBoolColumn
Me.dtgSiloDisponible.TableStyles(0).GridColumnStyles.Add(ColStyle)
End Sub
For other detail look at the first link i've post there is many info about this or at the "George Shepherd's Windows Form FAQ" form my signature
-
Sep 13th, 2005, 01:43 PM
#5
Thread Starter
Hyperactive Member
Re: datagrid column color
Thanks again.
I have long and hard way to go, bcz the Inheritance is totally new to me.
-
Sep 13th, 2005, 01:48 PM
#6
Re: datagrid column color
 Originally Posted by Palmtree
Thanks again.
I have long and hard way to go, bcz the Inheritance is totally new to me.
Once you'll undertand Inheritance a huge will be open be you
-
Sep 13th, 2005, 01:53 PM
#7
Thread Starter
Hyperactive Member
Re: datagrid column color
I bet. Maybe that is why VB.net is hot nowadays.
If this column thing won't take you too much time, would you give me some code for me to study?
-
Sep 13th, 2005, 01:54 PM
#8
Re: datagrid column color
Here a little article about Inheritance it might help !!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|