OTSSplashScreen_Cleanness.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.Drawing;
  3. using System.Runtime.InteropServices;
  4. using System.Windows.Forms;
  5. using System.Xml;
  6. namespace OTSMeasureApp._10_OTSSplashScreen
  7. {
  8. public partial class OTSSplashScreen_Cleanness : Form
  9. {
  10. #region 使窗体可以移动的代码
  11. [DllImport("user32.dll")]
  12. public static extern bool ReleaseCapture();
  13. [DllImport("user32.dll")]
  14. public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int IParam);
  15. public const int WM_SYSCOMMAND = 0x0112;
  16. public const int SC_MOVE = 0xF010;
  17. public const int HTCAPTION = 0x0002;
  18. #endregion
  19. public OTSSplashScreen_Cleanness()
  20. {
  21. InitializeComponent();
  22. }
  23. private void OTSSplashScreen_Load(object sender, EventArgs e)
  24. {
  25. this.BackgroundImage = Properties.Resources.Cleanliness;
  26. }
  27. private void label2_Click(object sender, EventArgs e)
  28. {
  29. }
  30. private void richTextBox1_Click(object sender, EventArgs e)
  31. {
  32. System.Diagnostics.Process.Start("notepad.exe", Application.StartupPath + "\\version.txt");
  33. }
  34. private void richTextBox3_Click(object sender, EventArgs e)
  35. {
  36. this.Close();
  37. }
  38. private void OTSSplashScreen_Cleanness_MouseDown(object sender, MouseEventArgs e)
  39. {
  40. //拖动窗体
  41. this.Cursor = System.Windows.Forms.Cursors.Hand;//改变鼠标样式
  42. ReleaseCapture();
  43. SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
  44. this.Cursor = System.Windows.Forms.Cursors.Default;
  45. }
  46. }
  47. }