BarcodeBatchShow.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using System.Drawing;
  2. using System.Windows.Forms;
  3. namespace Dongke.IBOSS.PRD.Client.Controls.BarcodeBatchSet
  4. {
  5. public partial class BarcodeBatchShow : UserControl
  6. {
  7. public BarcodeBatchShow()
  8. {
  9. InitializeComponent();
  10. this.lblRB.Text = "";
  11. ClearImage();
  12. }
  13. public Graphics GetGraphics()
  14. {
  15. return picImage.CreateGraphics();
  16. }
  17. public void SetImage(Image image, int width, int height)
  18. {
  19. ClearImage();
  20. /*this.picImage.Dock = DockStyle.None;
  21. if (this.VerticalScroll.Visible)
  22. {
  23. this.VerticalScroll.Value = 0;
  24. }
  25. if (this.HorizontalScroll.Visible)
  26. {
  27. this.HorizontalScroll.Value = 0;
  28. }*/
  29. //this.picImage.Top = 10;
  30. //this.picImage.Left = 10;
  31. this.picImage.Width = width;
  32. this.picImage.Height = height;
  33. this.lblRB.Left = this.picImage.Right + 10;
  34. this.lblRB.Top = this.picImage.Bottom + 10;
  35. picImage.Image = image;
  36. picImage.Visible = true;
  37. }
  38. public void ClearImage()
  39. {
  40. if (this.VerticalScroll.Visible)
  41. {
  42. this.VerticalScroll.Value = 0;
  43. }
  44. if (this.HorizontalScroll.Visible)
  45. {
  46. this.HorizontalScroll.Value = 0;
  47. }
  48. picImage.Visible = false;
  49. picImage.Left = 10;
  50. picImage.Top = 10;
  51. picImage.Width = 10;
  52. picImage.Height = 10;
  53. this.lblRB.Left = 0;
  54. this.lblRB.Top = 0;
  55. Image image = picImage.Image;
  56. if (image != null)
  57. {
  58. try
  59. {
  60. image.Dispose();
  61. }
  62. catch { }
  63. }
  64. picImage.Image = null;
  65. // this.picImage.Dock = DockStyle.Fill;
  66. }
  67. }
  68. }