DarkTitleForm.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using Y.Skin.YoForm.NoTitle;
  10. using Y.Utils.WindowsUtils.APIUtils;
  11. namespace Y.Skin.YoForm.CustomTitle
  12. {
  13. public partial class DarkTitleForm : NoTitleForm
  14. {
  15. private int HeadHeight = 52;
  16. public DarkTitleForm()
  17. {
  18. InitializeComponent();
  19. }
  20. private void DarkTitleForm_Load(object sender, EventArgs e)
  21. {
  22. PBHeadIcon.Image = Icon.ToBitmap();
  23. }
  24. /// <summary>
  25. /// 拖动窗口移动
  26. /// </summary>
  27. /// <param name="sender"></param>
  28. /// <param name="e"></param>
  29. private void LBHeadTitle_MouseMove(object sender, MouseEventArgs e)
  30. {
  31. if (e.Button == MouseButtons.Left)
  32. {
  33. FormStyleAPI.ReleaseCapture();
  34. FormStyleAPI.SendMessage(Handle, FormStyleAPI.WM_NCLBUTTONDOWN, FormStyleAPI.HTCAPTION, 0);
  35. }
  36. }
  37. /// <summary>
  38. /// 最小化
  39. /// </summary>
  40. /// <param name="sender"></param>
  41. /// <param name="e"></param>
  42. private void BTFormMinBox_Click(object sender, EventArgs e)
  43. {
  44. WindowState = FormWindowState.Minimized;
  45. }
  46. /// <summary>
  47. /// 最大化及还原
  48. /// </summary>
  49. /// <param name="sender"></param>
  50. /// <param name="e"></param>
  51. private void BTFormMaxBox_Click(object sender, EventArgs e)
  52. {
  53. if (WindowState != FormWindowState.Maximized)
  54. WindowState = FormWindowState.Maximized;
  55. else
  56. WindowState = FormWindowState.Normal;
  57. }
  58. /// <summary>
  59. /// 关闭
  60. /// </summary>
  61. /// <param name="sender"></param>
  62. /// <param name="e"></param>
  63. private void BTFormCloseBox_Click(object sender, EventArgs e)
  64. {
  65. Close();
  66. }
  67. private void DarkTitleForm_SizeChanged(object sender, EventArgs e)
  68. {
  69. SetBorder();
  70. PNHead.Height = HeadHeight;
  71. }
  72. private void DarkTitleForm_MaximumSizeChanged(object sender, EventArgs e)
  73. {
  74. }
  75. private void LBHeadTitle_Click(object sender, EventArgs e)
  76. {
  77. }
  78. private void LBHeadTitle_DoubleClick(object sender, EventArgs e)
  79. {
  80. }
  81. }
  82. }