You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 line
1.6 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace HKCardManager.Servers
  7. {
  8. public class OpaqueCommand
  9. {
  10. private MyOpaqueLayer m_OpaqueLayer = null;//半透明蒙板层
  11. /// <summary>
  12. /// 显示遮罩层
  13. /// </summary>
  14. /// <param name="control">控件</param>
  15. /// <param name="alpha">透明度</param>
  16. /// <param name="isShowLoadingImage">是否显示图标</param>
  17. public void ShowOpaqueLayer(Control control, int alpha, bool isShowLoadingImage)
  18. {
  19. try
  20. {
  21. if (this.m_OpaqueLayer == null)
  22. {
  23. this.m_OpaqueLayer = new MyOpaqueLayer(alpha, isShowLoadingImage);
  24. control.Controls.Add(this.m_OpaqueLayer);
  25. this.m_OpaqueLayer.Dock = DockStyle.Fill;
  26. this.m_OpaqueLayer.BringToFront();
  27. }
  28. this.m_OpaqueLayer.Enabled = true;
  29. this.m_OpaqueLayer.Visible = true;
  30. }
  31. catch { }
  32. }
  33. /// <summary>
  34. /// 隐藏遮罩层
  35. /// </summary>
  36. public void HideOpaqueLayer()
  37. {
  38. try
  39. {
  40. if (this.m_OpaqueLayer != null)
  41. {
  42. this.m_OpaqueLayer.Visible = false;
  43. this.m_OpaqueLayer.Enabled = false;
  44. }
  45. }
  46. catch (Exception ex)
  47. {
  48. //MessageBox.Show(ex.Message);
  49. }
  50. }
  51. }
  52. }