C sharp - header en datagridview

 
Vista:
sin imagen de perfil
Val: 36
Ha disminuido su posición en 4 puestos en C sharp (en relación al último mes)
Gráfica de C sharp

header en datagridview

Publicado por sergio (45 intervenciones) el 19/06/2020 00:41:40
Hola
Lo que quiero hacer es no permitir que haga click en la header de cada columna, r
como prodria hacer esto
logro hacerlo pero sobre toda la columna

gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Wilfredo Patricio Castillo
Val: 707
Oro
Ha mantenido su posición en C sharp (en relación al último mes)
Gráfica de C sharp

header en datagridview

Publicado por Wilfredo Patricio Castillo (416 intervenciones) el 19/06/2020 18:36:12
Podrías verificar si están en el row.HeaderCell, alternativas han de haber muchas.

Saludos cordiales,
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 36
Ha disminuido su posición en 4 puestos en C sharp (en relación al último mes)
Gráfica de C sharp

header en datagridview

Publicado por sergio (45 intervenciones) el 19/06/2020 19:00:44
esta es la line a que me acepta

this.dataGridViewturnos.Rows[0].HeaderCell.Value= false;

lo que pasa es que toda el datagridview lo pone en falso y yo necesito solamente el header de cada columna que no pueda realizar el click

Gracias por la ayuda
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de Wilfredo Patricio Castillo
Val: 707
Oro
Ha mantenido su posición en C sharp (en relación al último mes)
Gráfica de C sharp

header en datagridview

Publicado por Wilfredo Patricio Castillo (416 intervenciones) el 19/06/2020 19:10:09
Solo dime algo.

Cómo formas el grid?, desde un origen de datos?, o tu creas manualmente las columnas?, con eso te podré ayudar mejor.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 36
Ha disminuido su posición en 4 puestos en C sharp (en relación al último mes)
Gráfica de C sharp

header en datagridview

Publicado por sergio (45 intervenciones) el 19/06/2020 19:14:05
LO armo desde el código

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
private void ColumnasGrilla(string paramfecha)
{
 
    //this.dataGridViewturnos.Rows[0].DefaultCellStyle.ForeColor = SystemColors.GrayText;
    //Fhorathis.dataGridViewturnos.CurrentCell = dataGridViewturnos.Rows[dataGridViewturnos.CurrentRow.Index].Cells[0];
    //Procedemos a desactivar la fila seleccionada
   // this.dataGridViewturnos.Rows[dataGridViewturnos.SelectedRows[0].Index].Selected = false;
 
    //this.dataGridViewturnos += new DataGridViewCellMouseEventHandler(OnRowHeaderMouseClick);
 
    //this.dataGridViewturnos.Columns["].Selected = false;
 
 
    dataGridViewturnos.Rows[0].HeaderCell.Value= false;
    this.dataGridViewturnos.RowHeadersVisible = false;
    this.dataGridViewturnos.Rows.RemoveAt(0);
    string miFecha = paramfecha;
    DateTime dt = Convert.ToDateTime(miFecha);
    this.dataGridViewturnos.Columns["column1"].SortMode = DataGridViewColumnSortMode.NotSortable;
    this.dataGridViewturnos.Columns["column1"].Frozen = true;
    this.dataGridViewturnos.Columns["column1"].HeaderText = "Hora";
    this.dataGridViewturnos.Columns["column1"].Width = 60;
 
    DateTime dt1 = dt.AddDays(0);
    string mifecha = dt1.ToString("dd/MM/yyyy");
    this.dataGridViewturnos.Columns["column2"].SortMode = DataGridViewColumnSortMode.NotSortable;
    this.dataGridViewturnos.Columns["column2"].HeaderText = mifecha;
    this.dataGridViewturnos.Columns["column2"].Width = 160;
 
    DateTime dt2 = dt.AddDays(1);
    string mifecha1 = dt2.ToString("dd/MM/yyyy");
    this.dataGridViewturnos.Columns["column3"].SortMode = DataGridViewColumnSortMode.NotSortable;
    this.dataGridViewturnos.Columns["column3"].HeaderText = mifecha1;
    this.dataGridViewturnos.Columns["column3"].Width = 160;
 
    DateTime dt3 = dt.AddDays(2);
    string mifecha2 = dt3.ToString("dd/MM/yyyy");
    this.dataGridViewturnos.Columns["column4"].SortMode = DataGridViewColumnSortMode.NotSortable;
    this.dataGridViewturnos.Columns["column4"].HeaderText = mifecha2;
    this.dataGridViewturnos.Columns["column4"].Width = 160;
 
    DateTime dt4 = dt.AddDays(3);
    string mifecha3 = dt4.ToString("dd/MM/yyyy");
    this.dataGridViewturnos.Columns["column5"].SortMode = DataGridViewColumnSortMode.NotSortable;
    this.dataGridViewturnos.Columns["column5"].HeaderText = mifecha3;
    this.dataGridViewturnos.Columns["column5"].Width = 160;
 
    DateTime dt5 = dt.AddDays(4);
    string mifecha4 = dt5.ToString("dd/MM/yyyy");
    this.dataGridViewturnos.Columns["column6"].SortMode = DataGridViewColumnSortMode.NotSortable;
    this.dataGridViewturnos.Columns["column6"].HeaderText = mifecha4;
    this.dataGridViewturnos.Columns["column6"].Width = 160;
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar