F_CMN_0102.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*******************************************************************************
  2. * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:F_CMN_0102.cs
  5. * 2.功能描述:图片预览
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * 庄天威 2014/09/13 1.00 新建
  9. *******************************************************************************/
  10. using System;
  11. using System.Drawing;
  12. using System.Windows.Forms;
  13. using Dongke.IBOSS.PRD.Basics.BaseResources;
  14. namespace Dongke.IBOSS.PRD.Client.CommonModule.FormCommon
  15. {
  16. /// <summary>
  17. /// 图片预览
  18. /// </summary>
  19. public partial class F_CMN_0102 : Form
  20. {
  21. #region 构造函数
  22. public F_CMN_0102(byte[] ImageByte)
  23. {
  24. InitializeComponent();
  25. System.IO.MemoryStream ms = new System.IO.MemoryStream(ImageByte);
  26. System.Drawing.Image returnImage = System.Drawing.Image.FromStream(ms);
  27. this.picImage.Image = returnImage;
  28. this.Text = FormTitles.F_CMN_0102;
  29. this.btnClose.Text = ButtonText.BTN_CLOSE;
  30. }
  31. #endregion
  32. #region 事件
  33. /// <summary>
  34. /// 图片大小改变事件
  35. /// </summary>
  36. /// <param name="sender"></param>
  37. /// <param name="e"></param>
  38. private void picImage_SizeChanged(object sender, EventArgs e)
  39. {
  40. Image picNow = this.picImage.Image;
  41. if (picNow != null)
  42. {
  43. if (picNow.Height > this.picImage.Height || picNow.Width > this.picImage.Width)
  44. {
  45. this.picImage.SizeMode = PictureBoxSizeMode.Zoom;
  46. }
  47. else
  48. {
  49. this.picImage.SizeMode = PictureBoxSizeMode.CenterImage;
  50. }
  51. }
  52. }
  53. /// <summary>
  54. /// 关闭按钮事件
  55. /// </summary>
  56. /// <param name="sender"></param>
  57. /// <param name="e"></param>
  58. private void btnClose_Click(object sender, EventArgs e)
  59. {
  60. this.Close();
  61. }
  62. #endregion
  63. }
  64. }