DarkTitleForm.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. public DarkTitleForm()
  16. {
  17. InitializeComponent();
  18. }
  19. private void DarkTitleForm_Load(object sender, EventArgs e)
  20. {
  21. PBHeadIcon.Image = Icon.ToBitmap();
  22. }
  23. /// <summary>
  24. /// 拖动窗口移动
  25. /// </summary>
  26. /// <param name="sender"></param>
  27. /// <param name="e"></param>
  28. private void LBHeadTitle_MouseMove(object sender, MouseEventArgs e)
  29. {
  30. if (e.Button == MouseButtons.Left)
  31. {
  32. FormStyleAPI.ReleaseCapture();
  33. FormStyleAPI.SendMessage(Handle, FormStyleAPI.WM_NCLBUTTONDOWN, FormStyleAPI.HTCAPTION, 0);
  34. }
  35. }
  36. /// <summary>
  37. /// 最小化
  38. /// </summary>
  39. /// <param name="sender"></param>
  40. /// <param name="e"></param>
  41. private void BTFormMinBox_Click(object sender, EventArgs e)
  42. {
  43. WindowState = FormWindowState.Minimized;
  44. }
  45. /// <summary>
  46. /// 最大化及还原
  47. /// </summary>
  48. /// <param name="sender"></param>
  49. /// <param name="e"></param>
  50. private void BTFormMaxBox_Click(object sender, EventArgs e)
  51. {
  52. if (WindowState != FormWindowState.Maximized)
  53. WindowState = FormWindowState.Maximized;
  54. else
  55. WindowState = FormWindowState.Normal;
  56. }
  57. /// <summary>
  58. /// 关闭
  59. /// </summary>
  60. /// <param name="sender"></param>
  61. /// <param name="e"></param>
  62. private void BTFormCloseBox_Click(object sender, EventArgs e)
  63. {
  64. Close();
  65. }
  66. }
  67. }