kminear

Question about:

datagridview = DataGridViewSelectionMode.XXXX

I have datagridview (unbounded) where I modify the background color to indicate a date that someone is scheduled on. When they click on the (xx.SctionMode = DataGridViewSelectionMode.FullRowSelect) I don't really want a full row select (although that is what action I wan't to perform), I just don't want the row highligheted because it obscures the background colors, any suggestions

Thanks




Re: Windows Forms General datagridview SelectionMode Question

kminear

I posted this just a few minutes ago.. (Midnight at CST USA)... Already have had 3 views... very impressed... a wonderful community of support




Re: Windows Forms General datagridview SelectionMode Question

timvw

Simply set the DGV.DefaultCellStyle.SelectionForeColor and SelectionBackColor to colors that you prefer (eg: make them the same as ForeColor and BackColor).





Re: Windows Forms General datagridview SelectionMode Question

kminear

To clairify:

i have a datagridview with 32 columns:

Row 0: Key: integer and visible = false

Row 1: Empoyee Name = Visbie = True and can be highliethted

Row 2- 32: Days they are scheduled on: background colors changed: don't want these change when the user selects a row

How can I use the control to select a row that highlights only cell 1 not the other cells and still have the functionality of a full row select






Re: Windows Forms General datagridview SelectionMode Question

kminear

Thank you for your reply...

If functionally works just fine, it is just the selection of a row that is causing me a problem... I would be happy to send to a code fragment of how I am doing this...

Thanks for responding... Kenn






Re: Windows Forms General datagridview SelectionMode Question

kminear

I apologizie,

Instead of row I meant column.

What I really wan't to do is select a row without selecting any columns and still behave as a full row select.






Re: Windows Forms General datagridview SelectionMode Question

kminear

What I want:

An event that acts the same as a fullrowsellect without highlighting all the cells in the row. Is this possible with datagridivewcontol

I don't want to obscure the background color of any cell in the row (which happens upon a row select).






Re: Windows Forms General datagridview SelectionMode Question

kminear

Thank you so much for replying...

I can change the background color, my problem is when you select the row in the datagridview that the background colors are all highlighted ( which is OK but they remain highligleted).

I would really like to just highlight the select column (leave all other columns alone). Can this be done

Thanks for any reponse..

Kenn






Re: Windows Forms General datagridview SelectionMode Question

kminear

Tim,

By the way,

I'm working with fyiReporting and their RDL reportpint tool...

any experience with it ...

any interest in it ...

Just wondering






Re: Windows Forms General datagridview SelectionMode Question

timvw

Here are a couple of examples:

(1) No highlighting at all:

public Form1()
{
InitializeComponent();
this.dataGridView1.ColumnCount = 10;
this.dataGridView1.RowCount = 10;
this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

this.dataGridView1.DefaultCellStyle.SelectionForeColor = this.dataGridView1.DefaultCellStyle.ForeColor;
this.dataGridView1.DefaultCellStyle.SelectionBackColor = this.dataGridView1.DefaultCellStyle.BackColor;
}

(2) Only highlight the second row (if it's selected)

public Form1()
{
InitializeComponent();
this.dataGridView1.ColumnCount = 10;
this.dataGridView1.RowCount = 10;
this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

this.dataGridView1.Rows[1].DefaultCellStyle.SelectionForeColor = this.dataGridView1.DefaultCellStyle.SelectionForeColor;
this.dataGridView1.Rows[1].DefaultCellStyle.SelectionBackColor = this.dataGridView1.DefaultCellStyle.SelectionBackColor;

this.dataGridView1.DefaultCellStyle.SelectionForeColor = this.dataGridView1.DefaultCellStyle.ForeColor;
this.dataGridView1.DefaultCellStyle.SelectionBackColor = this.dataGridView1.DefaultCellStyle.BackColor;
}


(3) Only highlight the 4-th column of the selected row:

public Form1()
{
InitializeComponent();

this.dataGridView1.ColumnCount = 10;
this.dataGridView1.RowCount = 10;
this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

this.dataGridView1.Columns[3].DefaultCellStyle.SelectionForeColor = this.dataGridView1.DefaultCellStyle.SelectionForeColor;
this.dataGridView1.Columns[3].DefaultCellStyle.SelectionBackColor = this.dataGridView1.DefaultCellStyle.SelectionBackColor;

this.dataGridView1.DefaultCellStyle.SelectionForeColor = this.dataGridView1.DefaultCellStyle.ForeColor;
this.dataGridView1.DefaultCellStyle.SelectionBackColor = this.dataGridView1.DefaultCellStyle.BackColor;
}

(4) Combination of (2) and (3):

public Form1()
{
InitializeComponent();

this.dataGridView1.ColumnCount = 10;
this.dataGridView1.RowCount = 10;
this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

this.dataGridView1.Rows[1].DefaultCellStyle.SelectionForeColor = this.dataGridView1.DefaultCellStyle.SelectionForeColor;
this.dataGridView1.Rows[1].DefaultCellStyle.SelectionBackColor = this.dataGridView1.DefaultCellStyle.SelectionBackColor;

this.dataGridView1.Columns[3].DefaultCellStyle.SelectionForeColor = this.dataGridView1.DefaultCellStyle.SelectionForeColor;
this.dataGridView1.Columns[3].DefaultCellStyle.SelectionBackColor = this.dataGridView1.DefaultCellStyle.SelectionBackColor;

this.dataGridView1.DefaultCellStyle.SelectionForeColor = this.dataGridView1.DefaultCellStyle.ForeColor;
this.dataGridView1.DefaultCellStyle.SelectionBackColor = this.dataGridView1.DefaultCellStyle.BackColor;
}