Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Show combobox list opening control only in current row
Message
De
27/05/2007 15:49:28
 
 
À
27/05/2007 07:35:07
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01228731
Message ID:
01228787
Vues:
13
>Thank you.
>It works.


You're welcome. =0)

>I found also that up and down arrow keys does not move to previous and next row if combobox in grid is active.
>How to force up/down arrows to move between rows ?


First of all, you'd have to have your own DataGridView class. Then, override the ProcessCmdKey method and handle the Up/Down arrows that way.
public class BBGridView : System.Windows.Forms.DataGridView
{
	protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
	{
		const int WM_KEYDOWN = 0x100;
		const int WM_SYSKEYDOWN = 0x104;

		if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN))
		{
			switch (keyData)
			{
				case Keys.Down:
					if (this.CurrentCell is DataGridViewComboBoxCell)
					{
						this.CurrentCell = this.Rows[this.CurrentCell.RowIndex + 1].Cells[this.CurrentCell.ColumnIndex];
						return true;
					}
					break;

				case Keys.Up:
					if (this.CurrentCell is DataGridViewComboBoxCell)
					{
						this.CurrentCell = this.Rows[this.CurrentCell.RowIndex - 1].Cells[this.CurrentCell.ColumnIndex];
						return true;
					}
					break;
			}
		}

		return base.ProcessCmdKey(ref msg, keyData);
	}
}
~~Bonnie




>
>>Set the DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
>>
>>~~Bonnie
>>
>>
>>
>>>I use DataGridView containing DataGridViewComboBoxColumn column.
>>>Combobox column displays dropdown list opening selection triangle in all rows. This covers part of visible data if columns are narrow.
>>>
>>>How to force dropdown list opening control to appear only in active (current) row ?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform