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

Chart symbol scaling / resize problems

Thread ID:

Created:

Updated:

Platform:

Replies:

13856 May 12,2004 08:44 AM Jun 15,2004 03:39 AM Windows Forms 4
loading
Tags: Chart
Michael Mann
Asked On May 12, 2004 08:44 AM

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 2.0.5.1 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 04:08 PM

Michael, I was under the impression that this problem was fixed for the 2.0.5.1 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 11:49 AM

Michael, Are you able to reproduce this condition with a symbol generated using the Symbol Designer in the 2.0.5.1 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 2.0.5.1 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 02:50 AM

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 03:39 AM

Any updates?

CONFIRMATION

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.

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.

;