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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Chart symbol scaling / resize problems

Thread ID:





13856 May 12,2004 12:44 PM UTC Jun 15,2004 07:39 AM UTC WinForms 4
Tags: Chart
Michael Mann
Asked On May 12, 2004 12:44 PM UTC

Hi, this posting refers to my incident 9618 - that I posted three months ago and for that I haven''t received any reply yet. In the meantime, version has been released and the behaviour is still "wrong"! I would appreciate any help =============================================== I have some problems when working with my own implemented symbols. I want the symbol to represent itself - so I want to use a texture. When I use clamp texture mode - the image is always painted at the diagram''s origin at 0, 0 and not at the origin of it''s container node or rectangle. That''s even the problem in the Symbol Designer delivered by the product. Therefore I use the tile mode, but I hope I can use the clamp mode in future as well. I want the image displayed in the middle of the background rectangle of the symbol. After initialization it works. But after a scaling has occurred, I have the following problem: Because of the fact that the OnScale doesn''t work - or the event isn''t triggered - don''t know why - I use the event OnBoundsChanged to react to a scaling change. I compute the middle of the background rectangle and place the new rectangle (with the image as texture) in the very middle of the background rectangle. But it doesn''t work - I think that''s due to scaling factors. But if I set the property AllowResize to false - it doesn''t work at all. Even in the Symbol designer the same problems occur. Here''s my sample code: protected override void OnBoundsChanged(BoundsEventArgs evtArgs) { Syncfusion.Windows.Forms.Diagram.Rectangle panel = children["IconPanel"] as Syncfusion.Windows.Forms.Diagram.Rectangle; Syncfusion.Windows.Forms.Diagram.Rectangle back = children["SymbolBack"] as Syncfusion.Windows.Forms.Diagram.Rectangle; children.Remove(panel); float x = (back.Width / 2) - (49 / 2); float y = (back.Height / 2) - (49 / 2); // place the new rectangle at the very middle and set it''s size to 49x49 Syncfusion.Windows.Forms.Diagram.Rectangle newPanel = new Syncfusion.Windows.Forms.Diagram.Rectangle(x, y, 49, 49); newPanel.SetPropertyValue("AllowResize", false); newPanel.Scale(1, 1); newPanel.Name = "IconPanel"; newPanel.FillStyle.Color = Color.Yellow; // not in use - test it with fill color // newPanel.FillStyle.TextureWrapMode = System.Drawing.Drawing2D.WrapMode.Tile; // newPanel.FillStyle.Texture = Texture; this.AppendChild(newPanel); } Thanks in advance Michael Mann

Administrator [Syncfusion]
Replied On May 13, 2004 08:08 PM UTC

Michael, I was under the impression that this problem was fixed for the update of Essential Diagram. I will look into the issue and update you as soon as possible. Regards, Prakash

Administrator [Syncfusion]
Replied On May 24, 2004 03:49 PM UTC

Michael, Are you able to reproduce this condition with a symbol generated using the Symbol Designer in the version of Essential Diagram? I just tested this condition by creating a Symbol with a clamped Texture and the texture origin is correctly coordinated with the Symbol origin upon sizing or scaling. This is a fix that we added for the recent release of Essential Diagram and is stated in the Release Notes as such. Please test this condition using the Symbol Designer in the latest build and if it still appears to be present, then provide me with a step-by-step sequence on reproducing it. If the problem is exclusive to your programmatically defined symbol, then please send us a sample that includes the Symbol definition, and the diagram implementation depicting the problem. Thanks, Prakash Syncfusion, Inc

Michael Mann
Replied On June 3, 2004 06:50 AM UTC

Hi, I thins that the problem only arises with my code, because I use a panel in my symbol that is placed in the middle of the symbol and that panel has a texture. This should act like an icon in the middle of the symbol. Here''s what''s going on: public virtual void InitSymbol() { // Clear all children base.children.Clear(); /* I append a rectangle that acts as a transparent background */ // Draw background Syncfusion.Windows.Forms.Diagram.Rectangle rect; rect = new Syncfusion.Windows.Forms.Diagram.Rectangle(0, 0, INITIAL_WIDTH, INITIAL_HEIGHT); rect.Name = "SymbolBack"; rect.LineStyle.LineColor = Color.Transparent; rect.FillStyle.Color = Color.FromArgb(255, 240, 240, 240); rect.FillStyle.Type = FillStyle.FillType.Solid; AppendChild(rect); // then I get a texture to use withing the created rectangle with AddTexture() string resourceName = typeof(ImageSymbol).Assembly.GetName().Name + ".Resources.Image.Texture.bmp"; Texture = System.Drawing.Image.FromStream(typeof(ImageSymbol).Assembly.GetManifestResourceStream(resourceName)); Syncfusion.Windows.Forms.Diagram.Rectangle back = this.children["SymbolBack"] as Syncfusion.Windows.Forms.Diagram.Rectangle; float x = (back.Width / 2) - (49 / 2); float y = (back.Height / 2) - (49 / 2); AddTexture(Texture, new PointF(x, y)); } /* Creates a new origin at the very middle of the symbol''s back and draws the texture on the panel, which should be displayed at the very middle - during the first call, this does the job */ protected void AddTexture(System.Drawing.Image texture, PointF origin) { Sync.Rectangle back = children["SymbolBack"] as Sync.Rectangle; Sync.Rectangle iconPanel = children["IconPanel"] as Sync.Rectangle; if (iconPanel != null) { children.Remove(iconPanel); } Sync.Rectangle newPanel = new Sync.Rectangle(origin.X, origin.Y, 49, 49); newPanel.Name = "IconPanel"; newPanel.LineStyle.LineColor = Color.White; newPanel.FillStyle.TextureWrapMode = System.Drawing.Drawing2D.WrapMode.Tile; newPanel.FillStyle.Texture = texture; this.AppendChild(newPanel); } To react to size changes, I wanted to override OnScale, but this event is never fired. Is that what it should do? Therefore I used the OnBoundsChanged event to react to size changes: /* Calculate new very middle of the back */ protected override void OnBoundsChanged(BoundsEventArgs evtArgs) { float x = evtArgs.NewBounds.Location.X / 2 - (49 / 2); float y = evtArgs.NewBounds.Location.Y / 2 - (49 / 2); AddTexture(Texture, new PointF(x, y)); } The problem is that the scaling factor influences the points and the symbol is wrong displayed. How can I avoid it? Thanks

Michael Mann
Replied On June 15, 2004 07:39 AM UTC

Any updates?


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon