vsoares 0 Report post Posted December 28, 2005 Galera, estou conectando um data grid ao data surce , ateh ai tudo bem . Mas eu gostaria de configurar o tamanho das colunas e não permitir o redimensionamento das memas!!!!!!VLW!!!! Quote Share this post Link to post Share on other sites
0 alexandremanowar 0 Report post Posted December 28, 2005 E ae cara beleza!A largura das colunas você faz assim:... dim tabela as datatable = ds.Tables(0) Dim estilo As New DataGridTableStyle(True) estilo.MappingName = tabela.TableName DataGrid1.TableStyles.Add(estilo) estilo.GridColumnStyles("endereco").HeaderText = "Endereço:" estilo.GridColumnStyles("enderco").Width = 100 ... Agora o não redimencionamento das colunas eu não sei no DataGrid, mas o amigo Graymlkin fez um exemplo para ListView vê se serve aí: Public Class MyListView Inherits ListView Private Const WM_NOTIFY = &H4E Private Const HDN_FIRST = -300& Private Const HDN_BEGINTRACK = (HDN_FIRST - 26) <StructLayout(LayoutKind.Sequential)> _ Private Structure NMHDR Public hWndFrom As Int32 Public idFrom As Int32 Public code As Int32 End Structure Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) Dim foi As Boolean = False If m.Msg = WM_NOTIFY Then Dim nm As NMHDR = CType(m.GetLParam(GetType(NMHDR)), NMHDR) If nm.code = HDN_BEGINTRACK Then m.Result = New IntPtr(1) foi = True End If End If If Not foi Then MyBase.WndProc(m) End If End Sub End Class Basta ir na região "Windows Form Designer generated code" e trocar todos os System.Windows.Forms.ListView por MyListView.Como eu falei usei isso no listview, não em datagrid mas derrepente a idéia serve, se você conseguir posta aí pra ver como ficouvaleu Quote Share this post Link to post Share on other sites
Galera,
estou conectando um data grid ao data surce , ateh ai tudo bem . Mas eu gostaria de configurar o tamanho das colunas e não permitir o redimensionamento das memas!!!!!!
VLW!!!!
Share this post
Link to post
Share on other sites