using System; using System.Drawing; namespace Dongke.WinForm.Controls.InvoiceLayout.DrawBarcode { /// /// 绘制参数 /// [Serializable] public class DrawingOptions { private float? _dpiX; private float? _dpiY; private Rectangle _imageRect = new Rectangle(); /// /// 绘制参数 /// public DrawingOptions() { BackColor = Color.White; ForeColor = Color.Black; } /// /// 图片范围 /// public Rectangle ImageRect { get => this._imageRect; set { //if (value.Width <= this.Margin.Horizontal || // value.Height <= this.Margin.Vertical) //{ //} this._imageRect = value; } } /// /// 图片左 /// public int ImageLeft { get { return this._imageRect.Left; } set { this._imageRect.X = value; } } /// /// 图片上 /// public int ImageTop { get { return this._imageRect.Top; } set { this._imageRect.Y = value; } } /// /// 图片宽 /// public int ImageWidth { get { return this._imageRect.Width; } set { this._imageRect.Width = value; } } /// /// 图片高 /// public int ImageHeight { get { return this._imageRect.Height; } set { this._imageRect.Height = value; } } /// /// 图片余白 /// public BarcodeMargin Margin { get; set; } /// /// 背景色 /// public Color BackColor { get; set; } /// /// 前景色 /// public Color ForeColor { get; set; } /// /// 画布 /// public Graphics DrawGraphics { get; set; } /// /// 水平分辨率 /// public float? DpiX { get => DrawGraphics?.DpiX ?? _dpiX; set { _dpiX = value; } } /// /// 垂直分辨率 /// public float? DpiY { get => DrawGraphics?.DpiY ?? _dpiY; set { _dpiY = value; } } /// /// 条码图片显示方式 /// public BarcodeShowType ShowType { get; set; } = BarcodeShowType.Show; } }