Revision: 1351
http://orm.svn.sourceforge.net/orm/?rev=1351&view=rev
Author: mcurland
Date: 2009-01-15 00:26:23 +0000 (Thu, 15 Jan 2009)
Log Message:
-----------
The diagram spy LinkLabel crashes if there are too many diagrams. Clear the Links collection if an error is encountered. This is a temporary fix. We'll have to do something more robust in the future. refs #376
Modified Paths:
--------------
trunk/ORMModel/Shell/ORMDiagramSpy.cs
Modified: trunk/ORMModel/Shell/ORMDiagramSpy.cs
===================================================================
--- trunk/ORMModel/Shell/ORMDiagramSpy.cs 2009-01-08 22:48:55 UTC (rev 1350)
+++ trunk/ORMModel/Shell/ORMDiagramSpy.cs 2009-01-15 00:26:23 UTC (rev 1351)
@@ -607,6 +607,28 @@
#endregion // IProvideFrameVisibility Implementation
#region ORMDiagramSpyToolWindow specific
/// <summary>
+ /// MSBUG: Quick fix for a GDI+ bug that crashes the LinkLabel if there
+ /// are too many diagrams.
+ /// </summary>
+ private sealed class SafeLinkLabel : LinkLabel
+ {
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ try
+ {
+ base.OnPaint(e);
+ }
+ catch (OverflowException)
+ {
+ // The SetMeasureableCharacterRanges API fails with an OverflowException
+ // if the is too much text in the LinkLabel. If I could turn UseCompatibleTextRendering
+ // off for this one control then this would work, but this is controlled
+ // at the application level.
+ Links.Clear();
+ }
+ }
+ }
+ /// <summary>
/// Loads the SurveyTreeControl from the current document
/// </summary>
protected void LoadWindow()
@@ -618,7 +640,7 @@
ContainerControl container = new ContainerControl();
myDiagramView = diagramView = new ToolWindowDiagramView(this);
diagramView.DiagramClientView.DiagramDisassociating += new EventHandler(DiagramDisassociatingEvent);
- myWatermarkLabel = watermarkLabel = new LinkLabel();
+ myWatermarkLabel = watermarkLabel = new SafeLinkLabel();
watermarkLabel.Dock = DockStyle.Fill;
watermarkLabel.Site = diagramView.Site;
watermarkLabel.TextAlign = ContentAlignment.MiddleCenter;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|