FixedSizeNode got blurred backgroundimage


#1

My FixedSize Nodes got a blurred backgroundimage.
The automatic scaling of images must be the reason why the image
gets blurred. How can I fix this?
Here’s the Code I use for fixing the NodeSize:

protected override GoText CreateLabel()
{
GoText l = new GoText();
l.Selectable = false;
//l.Editable = true;
l.Alignment = GoObject.TopCenter;
l.FontSize = 13.0f;
l.Multiline = true;
l.Wrapping = true;
l.Clipping = true;
return l;
}
///


/// Diese Funktion stammt aus GoDiagram Samples Demo1, ebenso wie CreateLabel.
/// Wird benötigt, um eine Node mit fixer Textgröße zu erzeugen.
///

///
public override void LayoutChildren(GoObject childchanged)
{
GoObject bg = this.Background;
if (bg != null)
{
// Text Label vertikal zentrieren, unter Berücksichtigung der Background-Größe
GoText lbl = this.Label;
if (lbl != null)
{
SizeF tlMargin = this.TopLeftMargin;
SizeF brMargin = this.BottomRightMargin;
// LabelBounds mitteld Background-Bounds berechnen.
// unter Einbeziehung des linken und unteren Randes.
float maxLblWidth = Math.Max(bg.Width - (tlMargin.Width + brMargin.Width), 0);
float maxLblHeight = Math.Max(bg.Height - (tlMargin.Height + brMargin.Height), 0);
float lblHeight = Math.Min(lbl.Height, maxLblHeight);
float lblLeft = bg.Left + tlMargin.Width;

//Zeile geändert, da sonst Text immer in der Mitte erscheint.
//(maxLblHeight-lblHeight)/5,
//die 5 besagt, im ersten fünftel von oben.
//für die erste Hälfte also auf 2 ändern,
//für erstes Drittel auf 3 ändern usw…
float lblTop = bg.Top+ (maxLblHeight-lblHeight)/8;
lbl.Bounds = new RectangleF(lblLeft, lblTop, maxLblWidth, lblHeight);
lbl.WrappingWidth = maxLblWidth;
}
// Position aller Ports korrigieren.
if (this.TopPort != null)
{
this.TopPort.SetSpotLocation(MiddleTop, bg, MiddleTop);
}

if (this.RightPort != null)
{
this.RightPort.SetSpotLocation(MiddleRight, bg, MiddleRight);
}
if (this.BottomPort != null)
{
this.BottomPort.SetSpotLocation(MiddleBottom, bg, MiddleBottom);
}
if (this.LeftPort != null)
{
this.LeftPort.SetSpotLocation(MiddleLeft, bg, MiddleLeft);
}
}
}