UCBtnImg.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. // ***********************************************************************
  2. // Assembly : HZH_Controls
  3. // Created : 08-08-2019
  4. //
  5. // ***********************************************************************
  6. // <copyright file="UCBtnImg.cs">
  7. // Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
  8. // </copyright>
  9. //
  10. // Blog: https://www.cnblogs.com/bfyx
  11. // GitHub:https://github.com/kwwwvagaa/NetWinformControl
  12. // gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
  13. //
  14. // If you use this code, please keep this note.
  15. // ***********************************************************************
  16. using System;
  17. using System.Collections.Generic;
  18. using System.ComponentModel;
  19. using System.Drawing;
  20. using System.Data;
  21. using System.Linq;
  22. using System.Text;
  23. using System.Windows.Forms;
  24. namespace HZH_Controls.Controls
  25. {
  26. /// <summary>
  27. /// Class UCBtnImg.
  28. /// Implements the <see cref="HZH_Controls.Controls.UCBtnExt" />
  29. /// </summary>
  30. /// <seealso cref="HZH_Controls.Controls.UCBtnExt" />
  31. public partial class UCBtnImg : UCBtnExt
  32. {
  33. /// <summary>
  34. /// The BTN text
  35. /// </summary>
  36. private string _btnText = "自定义按钮";
  37. /// <summary>
  38. /// 按钮文字
  39. /// </summary>
  40. /// <value>The BTN text.</value>
  41. [Description("按钮文字"), Category("自定义")]
  42. public override string BtnText
  43. {
  44. get { return _btnText; }
  45. set
  46. {
  47. _btnText = value;
  48. lbl.Text = value;
  49. lbl.Refresh();
  50. }
  51. }
  52. /// <summary>
  53. /// 图片
  54. /// </summary>
  55. /// <value>The image.</value>
  56. [Description("图片"), Category("自定义")]
  57. public virtual Image Image
  58. {
  59. get
  60. {
  61. return this.lbl.Image;
  62. }
  63. set
  64. {
  65. this.lbl.Image = value;
  66. }
  67. }
  68. /// <summary>
  69. /// The image font icons
  70. /// </summary>
  71. private object imageFontIcons;
  72. /// <summary>
  73. /// Gets or sets the image font icons.
  74. /// </summary>
  75. /// <value>The image font icons.</value>
  76. [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
  77. [Editor(typeof(ImagePropertyEditor), typeof(System.Drawing.Design.UITypeEditor))]
  78. public object ImageFontIcons
  79. {
  80. get { return imageFontIcons; }
  81. set
  82. {
  83. if (value == null || value is Image)
  84. {
  85. imageFontIcons = value;
  86. if (value != null)
  87. {
  88. Image = (Image)value;
  89. }
  90. }
  91. }
  92. }
  93. /// <summary>
  94. /// 图片位置
  95. /// </summary>
  96. /// <value>The image align.</value>
  97. [Description("图片位置"), Category("自定义")]
  98. public virtual ContentAlignment ImageAlign
  99. {
  100. get { return this.lbl.ImageAlign; }
  101. set { lbl.ImageAlign = value; }
  102. }
  103. /// <summary>
  104. /// 文字位置
  105. /// </summary>
  106. /// <value>The text align.</value>
  107. [Description("文字位置"), Category("自定义")]
  108. public virtual ContentAlignment TextAlign
  109. {
  110. get { return this.lbl.TextAlign; }
  111. set { lbl.TextAlign = value; }
  112. }
  113. /// <summary>
  114. /// Initializes a new instance of the <see cref="UCBtnImg" /> class.
  115. /// </summary>
  116. public UCBtnImg()
  117. {
  118. InitializeComponent();
  119. IsShowTips = false;
  120. base.BtnForeColor = ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(102)))));
  121. base.BtnFont = new System.Drawing.Font("微软雅黑", 17F);
  122. base.BtnText = "自定义按钮";
  123. }
  124. }
  125. }