We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

hdc exception when using Diagram on Windows2000

We''ve got an exception, trying to start program with Diagram. After the canvas is drawn, we try to add any elements and got an exeptions on elements painting. Can you tell what is the reason? =============================== System.ArgumentException: hdc at System.Windows.Forms.DibGraphicsBufferManager.CreateCompatibleDIB(IntPtr hdc, IntPtr hpal, Int32 ulWidth, Int32 ulHeight, IntPtr& ppvBits) at System.Windows.Forms.DibGraphicsBufferManager.CreateBuffer(IntPtr src, Int32 offsetX, Int32 offsetY, Int32 width, Int32 height) at System.Windows.Forms.DibGraphicsBufferManager.AllocBuffer(Graphics targetGraphics, IntPtr targetDC, Rectangle targetBounds) at System.Windows.Forms.DibGraphicsBufferManager.AllocBuffer(IntPtr target, Rectangle targetBounds) at System.Windows.Forms.Control.WmPaint(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Label.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ======================================= We have tryed to remov gradients, shadows and alpha, but the situation is the same..

8 Replies

AN Andrew August 25, 2005 09:14 PM UTC

>We''ve got an exception, trying to start program with Diagram. After the canvas is drawn, we try to add any elements and got an exeptions on elements painting. Can you tell what is the reason? >=============================== >System.ArgumentException: hdc > at System.Windows.Forms.DibGraphicsBufferManager.CreateCompatibleDIB(IntPtr hdc, IntPtr hpal, Int32 ulWidth, Int32 ulHeight, IntPtr& ppvBits) > at System.Windows.Forms.DibGraphicsBufferManager.CreateBuffer(IntPtr src, Int32 offsetX, Int32 offsetY, Int32 width, Int32 height) > at System.Windows.Forms.DibGraphicsBufferManager.AllocBuffer(Graphics targetGraphics, IntPtr targetDC, Rectangle targetBounds) > at System.Windows.Forms.DibGraphicsBufferManager.AllocBuffer(IntPtr target, Rectangle targetBounds) > at System.Windows.Forms.Control.WmPaint(Message& m) > at System.Windows.Forms.Control.WndProc(Message& m) > at System.Windows.Forms.Label.WndProc(Message& m) > at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) > at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) > at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) >======================================= > >We have tryed to remov gradients, shadows and alpha, but the situation is the same.. > Additional information: We explore this problem on 4 PC in our company: 1) Developer PC1 (my computer), ALL OK (OS= win XP sp2 with all updates from microsopft.com, last version of syncfusion essential studio) 2) Developer PC2, ALL OK, but we have a problem with resourses files (2 lines in costructor of form, and this 2 lines were added by Visual Studio, this 2 lines thrown the exceptions, but when I comment this lines, all goes as it should be) (OS win XP) 3) Developer PC 3, exception (and also problem whith 2 lines in code) (OS Win XP) 4) VmWare PC, exception. This is clear machine, only clear Win2000 and Framework.NET (it was take from VS.NET distributive) 5) Client machine (Win 2000 whith different programms), exception. As you can see Win2000 is not couse of problem, becouse problem has happened on winXP computers. Objects that I draw in diagramm are from syncfusion samples (it is rectangle with label). There is a link between two rectangles. This link is added like sample http://www.syncfusion.com/support/kb/diagram/Default.aspx?ToDo=view&questId=24


AD Administrator Syncfusion Team August 25, 2005 10:29 PM UTC

Eugene/Andrew, Can either of you send me a small sample that contains the offending lines that you speak of, and will allow me to reproduce the problem out here? Thanks, Prakash Surendra Syncfusion Inc.,


AD Administrator Syncfusion Team August 26, 2005 11:16 AM UTC

We got an exception, when adding any standart element onto the diagram. The element is drawn black and the exception is thrown.


AD Administrator Syncfusion Team August 26, 2005 11:19 AM UTC

An example of simple code which contains the diagram and right-click menu, adding an element to diagram: ========================================== using System; using System.Drawing; using System.Windows.Forms; using Syncfusion.Windows.Forms.Diagram; namespace TestNamespace.VisualTools { /// /// Summary description for CrushTest. /// public class CrushTest: Form{ private Syncfusion.Windows.Forms.Diagram.Controls.Diagram diagram1; private System.Windows.Forms.ContextMenu contextMenu1; private System.Windows.Forms.MenuItem menuItemCrushAll; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel2; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Label label1; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public CrushTest(){ InitializeComponent(); } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Component Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { //System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(ClassifyingModelViewDiagramm)); this.diagram1 = new Syncfusion.Windows.Forms.Diagram.Controls.Diagram(); this.contextMenu1 = new System.Windows.Forms.ContextMenu(); this.menuItemCrushAll = new System.Windows.Forms.MenuItem(); this.panel1 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel(); this.label1 = new System.Windows.Forms.Label(); this.textBox1 = new System.Windows.Forms.TextBox(); ((System.ComponentModel.ISupportInitialize)(this.diagram1.Model)).BeginInit(); this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); this.SuspendLayout(); // // diagram1 // this.diagram1.AllowDrop = true; this.diagram1.ContextMenu = this.contextMenu1; // // diagram1.Controller // this.diagram1.Controller.MaxHistory = 256; this.diagram1.Dock = System.Windows.Forms.DockStyle.Fill; this.diagram1.HScroll = true; this.diagram1.LayoutManager = null; this.diagram1.Location = new System.Drawing.Point(0, 0); // // diagram1.Model // this.diagram1.Model.BackgroundStyle.Color = System.Drawing.Color.White; this.diagram1.Model.BackgroundStyle.GradientAngle = 90F; //this.diagram1.Model.BackgroundStyle.GradientBounds = ((System.Drawing.RectangleF)(resources.GetObject("diagram1.Model.BackgroundStyle.GradientBounds"))); this.diagram1.Model.BackgroundStyle.GradientStartColor = System.Drawing.Color.White; this.diagram1.Model.BackgroundStyle.Properties = this.diagram1.Model; this.diagram1.Model.BackgroundStyle.Texture = null; this.diagram1.Model.BackgroundStyle.TextureWrapMode = System.Drawing.Drawing2D.WrapMode.Tile; this.diagram1.Model.BackgroundStyle.Type = Syncfusion.Windows.Forms.Diagram.BackgroundStyleType.Solid; this.diagram1.Model.BoundaryConstraintsEnabled = true; this.diagram1.Model.FillStyle.AlphaFactor = 255; this.diagram1.Model.FillStyle.Color = System.Drawing.Color.LightGray; this.diagram1.Model.FillStyle.GradientAngle = 90F; //this.diagram1.Model.FillStyle.GradientBounds = ((System.Drawing.RectangleF)(resources.GetObject("diagram1.Model.FillStyle.GradientBounds"))); this.diagram1.Model.FillStyle.GradientStartColor = System.Drawing.Color.LightGray; this.diagram1.Model.FillStyle.Properties = this.diagram1.Model; this.diagram1.Model.FillStyle.Texture = null; this.diagram1.Model.FillStyle.TextureWrapMode = System.Drawing.Drawing2D.WrapMode.Tile; this.diagram1.Model.FillStyle.Type = Syncfusion.Windows.Forms.Diagram.FillStyleType.Solid; this.diagram1.Model.Height = 1056F; this.diagram1.Model.LineStyle.DashCap = System.Drawing.Drawing2D.DashCap.Flat; this.diagram1.Model.LineStyle.DashOffset = 0F; this.diagram1.Model.LineStyle.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.diagram1.Model.LineStyle.EndCap = System.Drawing.Drawing2D.LineCap.Flat; this.diagram1.Model.LineStyle.LineColor = System.Drawing.Color.Black; this.diagram1.Model.LineStyle.LineJoin = System.Drawing.Drawing2D.LineJoin.Bevel; this.diagram1.Model.LineStyle.LineWidth = 2F; this.diagram1.Model.LineStyle.MiterLimit = 10F; this.diagram1.Model.LineStyle.Properties = this.diagram1.Model; this.diagram1.Model.MeasurementScale = 1F; this.diagram1.Model.MeasurementUnits = System.Drawing.GraphicsUnit.Pixel; this.diagram1.Model.Name = "Model"; this.diagram1.Model.RenderingStyle.Properties = this.diagram1.Model; this.diagram1.Model.RenderingStyle.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None; this.diagram1.Model.ShadowStyle.AlphaFactor = 255; this.diagram1.Model.ShadowStyle.Color = System.Drawing.Color.LightGray; this.diagram1.Model.ShadowStyle.OffsetX = 6F; this.diagram1.Model.ShadowStyle.OffsetY = 6F; this.diagram1.Model.ShadowStyle.Properties = this.diagram1.Model; this.diagram1.Model.ShadowStyle.Visible = false; this.diagram1.Model.Width = 816F; this.diagram1.Name = "diagram1"; this.diagram1.NudgeIncrement = 1F; this.diagram1.ScrollGranularity = 0.5F; this.diagram1.Size = new System.Drawing.Size(448, 312); this.diagram1.SmartSizeBox = false; this.diagram1.TabIndex = 0; this.diagram1.Text = "diagram1"; // // diagram1.View // this.diagram1.View.BackgroundColor = System.Drawing.Color.DarkGray; this.diagram1.View.Grid.Color = System.Drawing.Color.Black; this.diagram1.View.Grid.DashOffset = 4F; this.diagram1.View.Grid.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash; this.diagram1.View.Grid.GridStyle = Syncfusion.Windows.Forms.Diagram.GridStyle.Point; this.diagram1.View.Grid.HorizontalSpacing = 10F; this.diagram1.View.Grid.SnapToGrid = true; this.diagram1.View.Grid.VerticalSpacing = 10F; this.diagram1.View.Grid.Visible = true; this.diagram1.View.HandleAnchorColor = System.Drawing.Color.LightGray; this.diagram1.View.HandleColor = System.Drawing.Color.White; this.diagram1.View.HandleDisabledColor = System.Drawing.Color.Black; this.diagram1.View.HandleSize = 6; this.diagram1.View.HorizontalRuler.Visible = false; this.diagram1.View.MouseTrackingEnabled = true; this.diagram1.View.PasteOffsetX = 10; this.diagram1.View.PasteOffsetY = 10; this.diagram1.View.RulerFillColor = System.Drawing.Color.LightGray; this.diagram1.View.RulerLineColor = System.Drawing.Color.Black; this.diagram1.View.RulerSize = 16; this.diagram1.View.RulerUnits = Syncfusion.Windows.Forms.Diagram.MeasurementsUnit.Inches; this.diagram1.View.ShowPageBounds = true; this.diagram1.View.VerticalRuler.Visible = false; this.diagram1.VScroll = true; // // contextMenu1 // this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {this.menuItemCrushAll}); // // menuItemCrushAll // this.menuItemCrushAll.Index = 0; this.menuItemCrushAll.Text = "CrushAll"; this.menuItemCrushAll.Click += new System.EventHandler(this.menuItemCrussAll_Click); // // panel1 // this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.panel1.Controls.Add(this.diagram1); this.panel1.Location = new System.Drawing.Point(0, 96); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(448, 312); this.panel1.TabIndex = 1; // // panel2 // this.panel2.Controls.Add(this.label1); this.panel2.Controls.Add(this.textBox1); this.panel2.Dock = System.Windows.Forms.DockStyle.Top; this.panel2.Location = new System.Drawing.Point(0, 0); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(448, 96); this.panel2.TabIndex = 2; // // label1 // this.label1.Location = new System.Drawing.Point(8, 16); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(88, 16); this.label1.TabIndex = 1; this.label1.Text = "Èìÿ ìîäåëè"; // // textBox1 // this.textBox1.Location = new System.Drawing.Point(128, 16); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(296, 20); this.textBox1.TabIndex = 0; this.textBox1.Text = ""; //this.textBox1.Leave += new System.EventHandler(this.textBox1_Leave); // // ClassifyingModelViewDiagramm // this.Controls.Add(this.panel2); this.Controls.Add(this.panel1); this.Name = "ClassifyingModelViewDiagramm"; this.Size = new System.Drawing.Size(448, 416); ((System.ComponentModel.ISupportInitialize)(this.diagram1.Model)).EndInit(); this.panel1.ResumeLayout(false); this.panel2.ResumeLayout(false); this.ResumeLayout(false); } #endregion private void menuItemCrussAll_Click(object sender, System.EventArgs e) { Symbol diagView = (Symbol) new Symbol(); Syncfusion.Windows.Forms.Diagram.Rectangle outerRect = null; Syncfusion.Windows.Forms.Diagram.ControlNode ctrlNode = null; outerRect = new Syncfusion.Windows.Forms.Diagram.Rectangle(0, 0, 100, 30); outerRect.Name = "Rectangle"; outerRect.FillStyle.Color = Color.Orange; outerRect.ShadowStyle.Visible = false; diagView.AppendChild(outerRect); ctrlNode = new ControlNode(new RectangleF(2, 2, 98, 28)); ctrlNode.ControlAssemblyName = "System.Windows.Forms"; ctrlNode.ControlClassName = "System.Windows.Forms.Label"; ctrlNode.ActivateStyle = Syncfusion.Windows.Forms.Diagram.ActivateStyle.SelectedClick; ctrlNode.Name = "InnerLabel"; diagView.Ports.Add(new AnchoredPort(BoxPosition.Center)); ctrlNode.CreateControl(); ((System.Windows.Forms.Label)ctrlNode.Control).Text = "Imya01"; diagView.AppendChild(ctrlNode); //diagView.Location = new PointF(iFeature*diagView.Size.Width,0); diagView.X = 100; diagView.Y = 100; this.diagram1.Model.AppendChild(diagView); this.diagram1.Refresh(); } [STAThread] static void Main() { Application.Run(new CrushTest()); } } }


AD Administrator Syncfusion Team August 26, 2005 02:30 PM UTC

We''ve noticed, that when using button instead of label inside the diagram symbol exception isn''t thrown. We suppose that the problem may be about transparansy of label (but we don''t know why application crash on one of win XP computers as well as on Win2000) Also, as you can see, there are 2 lines created by designer, that commented in the code above (the tip concerning the resources again). We have a problem using this example on different computers.


AD Administrator Syncfusion Team August 26, 2005 09:00 PM UTC

Hi, Thanks for the new information. We are looking into the issue, and will update this post as soon as we learning something. Thanks, Prakash Surendra Syncfusion Inc.,


AD Administrator Syncfusion Team August 30, 2005 10:28 PM UTC

Hey guys, I am aware of this issue, and will try to post an update within 24 hours. My apologies for the delay. Thanks, Prakash Surendra Syncfusion Inc.,


AD Administrator Syncfusion Team September 1, 2005 09:43 PM UTC

Hi, I was able to reproduce the problem on a Windows 2000 machine. It looks like it is the ControlNode class''s attempt to generate the control bitmap on a Windows 2000 machine that is causing the execption. Seems to work fine on an XP machine. We are treating this as a QA issue, and will do our best to provide a fix/workaround as soon as possible. I will update this post when we learn more about the problem. The other problem related to the errors in the designer generated code has been fixed. V 3.3.0.0 will include the fix for this issue. Regards, Prakash Surendra Syncfusion Inc.,

Loader.
Live Chat Icon For mobile
Up arrow icon