Microsoft KB Archive/943140

= MenuFont in ToolStrip causing ArgumentException =

Article ID: 943140

Article Last Modified on 12/3/2007

-

APPLIES TO


 * Microsoft .NET Framework 2.0

-



Source: Microsoft Support



RAPID PUBLISHING
RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.



Action
You create a Windows Forms application and one of your forms contains a ToolStrip.



Result
On some machines, you may experience an exception with the following callstack:

System.InvalidOperationException: An error occurred creating the form. See Exception.InnerException for details. The error is: Parameter is not valid. ---> System.ArgumentException: Parameter is not valid.

at System.Drawing.Font.GetHeight(Graphics graphics)

at System.Drawing.Font.get_SizeInPoints

at System.Drawing.SystemFonts.FontInPoints(Font font)

at System.Drawing.SystemFonts.get_MenuFont

at System.Windows.Forms.ToolStripManager.get_DefaultFont

at System.Windows.Forms.ToolStripItem.get_Font

at System.Windows.Forms.ToolStripItemInternalLayout.CommonLayoutOptions

at System.Windows.Forms.ToolStripDropDownButton.ToolStripDropDownButtonInternalLayout.CommonLayoutOptions

at System.Windows.Forms.ToolStripItemInternalLayout.GetLayoutData

at System.Windows.Forms.ToolStripItemInternalLayout.PerformLayout

. ..

. ..

. ..



Cause
There is a problem with the way that the Tahoma TrueType font is used in the ToolStrip.



Resolution
Ensure that &quot;Tahoma (TrueType)&quot; is referencing &quot;Tahoma.ttf&quot; in the registry:

HKLM\Software\Microsoft\WindowsNT\CurrentVersion\Fonts

It should not be set to Tahoma.fon, for example.



MoreInformation


DISCLAIMER
MICROSOFT CORPORATION AND/OR ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY, RELIABILITY, OR ACCURACY OF THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN. ALL SUCH INFORMATION AND RELATED GRAPHICS ARE PROVIDED &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND. MICROSOFT AND/OR ITS RESPECTIVE SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THIS INFORMATION AND RELATED GRAPHICS, INCLUDING ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, WORKMANLIKE EFFORT, TITLE AND NON-INFRINGEMENT. YOU SPECIFICALLY AGREE THAT IN NO EVENT SHALL MICROSOFT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, PUNITIVE, INCIDENTAL, SPECIAL, CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE, DATA OR PROFITS, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE USE OF OR INABILITY TO USE THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN, WHETHER BASED ON CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY OR OTHERWISE, EVEN IF MICROSOFT OR ANY OF ITS SUPPLIERS HAS BEEN ADVISED OF THE POSSIBILITY OF DAMAGES.

Keywords: kbnomt kbrapidpub KB943140

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.