using System.Drawing; using System.Windows.Forms; namespace Dongke.IBOSS.PRD.Client.Controls.BarcodeBatchSet { public partial class BarcodeBatchShow : UserControl { public BarcodeBatchShow() { InitializeComponent(); this.lblRB.Text = ""; ClearImage(); } public Graphics GetGraphics() { return picImage.CreateGraphics(); } public void SetImage(Image image, int width, int height) { ClearImage(); /*this.picImage.Dock = DockStyle.None; if (this.VerticalScroll.Visible) { this.VerticalScroll.Value = 0; } if (this.HorizontalScroll.Visible) { this.HorizontalScroll.Value = 0; }*/ //this.picImage.Top = 10; //this.picImage.Left = 10; this.picImage.Width = width; this.picImage.Height = height; this.lblRB.Left = this.picImage.Right + 10; this.lblRB.Top = this.picImage.Bottom + 10; picImage.Image = image; picImage.Visible = true; } public void ClearImage() { if (this.VerticalScroll.Visible) { this.VerticalScroll.Value = 0; } if (this.HorizontalScroll.Visible) { this.HorizontalScroll.Value = 0; } picImage.Visible = false; picImage.Left = 10; picImage.Top = 10; picImage.Width = 10; picImage.Height = 10; this.lblRB.Left = 0; this.lblRB.Top = 0; Image image = picImage.Image; if (image != null) { try { image.Dispose(); } catch { } } picImage.Image = null; // this.picImage.Dock = DockStyle.Fill; } } }