public void UpdateAutoSize() { SetBarcodeProperties(); SizeF size = Barcode.CalcBounds(); size.Width *= Zoom; size.Height *= Zoom; if (AutoSize) { if (Angle == 0 || Angle == 180) { Width = size.Width + Padding.Horizontal; if (size.Height > 0) { Height = size.Height + Padding.Vertical; } } else if (Angle == 90 || Angle == 270) { Height = size.Width + Padding.Vertical; if (size.Height > 0) { Width = size.Height + Padding.Horizontal; } } RelocateAlign(); } }