A 7 minute motivational speach with a few points to remember.
sâmbătă, 13 august 2011
joi, 4 august 2011
Ignore Enter Key Press for .NET Button
According to the documentation found on MSDN, "A Button can be clicked by using the mouse, ENTER key, or SPACEBAR if the button has focus."
It took a while until I have found how to disable the Enter and Spacebar keys to produce the Click event for a form button that has focus. The solution is to override the ProcessCmdKey method in a derived class and catch the Enter key press in that method and return before it gets to be processed by the method in the Button base class. Here is the basic class I used to accomplish this.
/// <summary>
/// A class that inherits the System.Windows.Forms.Button class and ignores
/// the ENTER key press that also triggers the click event.
/// </summary>
internal class ButtonNoEnter : System.Windows.Forms.Button
{
protected override bool ProcessCmdKey( ref Message msg, Keys keyData )
{
if( keyData == Keys.Enter || keyData == Keys.Space )
{
return true;
}
return base.ProcessCmdKey( ref msg, keyData );
}
}
It took a while until I have found how to disable the Enter and Spacebar keys to produce the Click event for a form button that has focus. The solution is to override the ProcessCmdKey method in a derived class and catch the Enter key press in that method and return before it gets to be processed by the method in the Button base class. Here is the basic class I used to accomplish this.
/// <summary>
/// A class that inherits the System.Windows.Forms.Button class and ignores
/// the ENTER key press that also triggers the click event.
/// </summary>
internal class ButtonNoEnter : System.Windows.Forms.Button
{
protected override bool ProcessCmdKey( ref Message msg, Keys keyData )
{
if( keyData == Keys.Enter || keyData == Keys.Space )
{
return true;
}
return base.ProcessCmdKey( ref msg, keyData );
}
}
Etichete:
ProcessCmdKey,
System.Windows.Forms.Button
vineri, 27 mai 2011
Word 2007 Registry Policy Settings
Having to open older versions of Microsoft Word files is prevented by default in Microsoft Windows 2007 by means of registry settings. There is a support article published by Microsoft that describes how to disable this limitation. ( http://support.microsoft.com/kb/922849#w2007 ). The purpose is to add a new registry key with the name FileOpenBlock and then create a new entry under this key, named FilesBeforeVersion and assign it the value 0.
I wanted to fix the solution myself and tried to locate the registry key specified in the article, but was unable to locate it. Here is where they claim it would be:
I wanted to fix the solution myself and tried to locate the registry key specified in the article, but was unable to locate it. Here is where they claim it would be:
HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\12.0\Word\Security\FileOpenBlock
and here is where I actually found it:
HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Word\Security\FileOpenBlock.
Other than the minor error in the article, I was able of fixing the issue and of opening older file versions.
I am using Windows 7 Professional 32 bit.
duminică, 8 mai 2011
Accept this license agreement
Upon installing Visual Studio 2005 I was politely presented a license agreement, partly English, partly something else !?
Abonați-vă la:
Postări (Atom)