AD
Administrator
Syncfusion Team
May 13, 2004 08:08 PM UTC
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
AD
Administrator
Syncfusion Team
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 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
MM
Michael Mann
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