void _PaperSize_PropertyChanged(object sender, PropertyChagedEventArgs e) { if (e.PropertyName == "Width") { if (KeepAspectRatio) { float newHeight = (float)Math.Round(_PaperSize.Height * (Convert.ToSingle(e.NewValue) / Convert.ToSingle(e.OldValue)), 2); if (_PaperSize.Height != newHeight) { PaperSize = new PaperSize(_PaperSize.Name, _PaperSize.Width, newHeight); //_PaperSize.Height = newHeight; } } SetFormSize(); } else if (e.PropertyName == "Height") { if (KeepAspectRatio) { float newWidth = (float)Math.Round(_PaperSize.Width * (Convert.ToSingle(e.NewValue) / Convert.ToSingle(e.OldValue)), 2); if (_PaperSize.Width != newWidth) { PaperSize = new PaperSize(_PaperSize.Name, newWidth, _PaperSize.Height); //SetFormSize(); //_PaperSize.Width = newWidth; } } } }
void _Margin_PropertyChanged(object sender, PropertyChagedEventArgs e) { if (e.PropertyName == "Left" || e.PropertyName == "Right") { SetFormSize(); } }