OTSSplashScreen_SteelMineral.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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.Runtime.InteropServices;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. namespace OTSMeasureApp._10_OTSSplashScreen
  12. {
  13. public partial class OTSSplashScreen_SteelMineral : Form
  14. {
  15. #region 使窗体可以移动的代码
  16. [DllImport("user32.dll")]
  17. public static extern bool ReleaseCapture();
  18. [DllImport("user32.dll")]
  19. public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int IParam);
  20. public const int WM_SYSCOMMAND = 0x0112;
  21. public const int SC_MOVE = 0xF010;
  22. public const int HTCAPTION = 0x0002;
  23. #endregion
  24. public OTSSplashScreen_SteelMineral()
  25. {
  26. InitializeComponent();
  27. }
  28. private void richTextBox1_Click(object sender, EventArgs e)
  29. {
  30. this.Close();
  31. }
  32. private void OTSSplashScreen_SteelMineral_MouseDown(object sender, MouseEventArgs e)
  33. {
  34. //拖动窗体
  35. this.Cursor = System.Windows.Forms.Cursors.Hand;//改变鼠标样式
  36. ReleaseCapture();
  37. SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
  38. this.Cursor = System.Windows.Forms.Cursors.Default;
  39. }
  40. }
  41. }