You are currently offline, waiting for your internet to reconnect

MenuFont in ToolStrip causing ArgumentException

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 "Tahoma (TrueType)" is referencing "Tahoma.ttf" 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 "AS IS" 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.
Properties

Article ID: 943140 - Last Review: 12/03/2007 18:59:00 - Revision: 1.1

Microsoft .NET Framework 2.0

  • kbnomt kbrapidpub KB943140
Feedback
= 1; var varClickTracking = 1; var varCustomerTracking = 1; var Route = "76500"; var Ctrl = ""; document.write(" uage);" class="ng-binding" id="language-es-py">Paraguay - Español
Venezuela - Español
microsoft.com/c.gif?DI=4050&did=1&t=">html> var varCustomerTracking = 1; var Route = "76500"; var Ctrl = ""; document.write(" ')[0].appendChild(m);" onload="var m=document.createElement('meta');m.name='ms.dqp0';m.content='false';document.getElementsByTagName('head')[0].appendChild(m);" src="http://c1.microsoft.com/c.gif?"> >>