public override void PrintInitialization(StringBuilder builder) { base.PrintInitialization(builder); builder.Append("\t\tDialogSetPositionRelative("); builder.Append(Name); builder.Append(", "); builder.Append(Anchor.ToSCIIString()); builder.Append(", "); builder.Append(ParentDialog.Name); builder.Append(", "); builder.Append(ParentAttachPoint.ToSCIIString()); builder.Append(", "); builder.Append(Offset.X); builder.Append(", "); builder.Append(Offset.Y); builder.AppendLine(");"); }
public override void ParentSizeChanged(Size oldSize, Size newSize) { Point p = Position; if (ParentAttachPoint.IsMiddleX()) { p.X += (Size.Width - oldSize.Width) / 2 - (Size.Width - newSize.Width) / 2; } else if (ParentAttachPoint.IsRight()) { p.X += newSize.Width - oldSize.Width; } if (ParentAttachPoint.IsMiddleY()) { p.Y += (Size.Height - oldSize.Height) / 2 - (Size.Height - newSize.Height) / 2; } else if (ParentAttachPoint.IsBottom()) { p.Y += newSize.Height - oldSize.Height; } Position = p; LastParentSize = newSize; }