Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Force Ctrl+F1 to cycle between windows
Message
De
29/06/2008 11:43:36
 
 
À
25/06/2008 14:01:43
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01326709
Message ID:
01327516
Vues:
7
Andrus,

You say you overrode the OnKeyPress, but then you showed code for the ProcessCmdKey ... are you saying that you tried that instead? And did it work?

It should work, but you don't show your "custom processing". Here's what I did that works. This code belongs in the MdiParent, not the MdiChild:
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
  switch (keyData)
  {
	  case Keys.Control | Keys.F1:
	  case Keys.Control | Keys.Tab:
		  for (int i = 0; i < this.MdiChildren.Length; i++)
		{
			if (this.MdiChildren[i].Equals(this.ActiveMdiChild))
			{
				i++;
				if (i == this.MdiChildren.Length)
					i = 0;
				this.ActivateMdiChild(this.MdiChildren[i]);
				this.ActiveMdiChild.Activate();
				break;
			}
		}
	  return true;
  }
  return base.ProcessCmdKey(ref msg, keyData);
}
~~Bonnie



>MDI WinForms 2 application.
>I need that Ctrl+F1 cycles through windows like in VFP.
>
>I overrided MDI child form OnKeypress method but Ctrl+F1 press is ignored.
>
>How to force Ctrl+F1 to cycle between windows ?
>
>
>Andrus.
>
>protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
>{
> switch (keyData)
> {
> case Keys.Control | Keys.Tab:
> // ... custom processing occurs hear.
> return true;
>
> case Keys.Control | Keys.F1:
> keyData = Keys.Control | Keys.Tab ;
> break;
> }
> return base.ProcessCmdKey(ref msg, keyData);
>}
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