75 lines
2.3 KiB
C#
75 lines
2.3 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Drawing;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Runtime.InteropServices;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
|
|||
|
|
namespace JJMediSys
|
|||
|
|
{
|
|||
|
|
public partial class ItemsShowBox : Form
|
|||
|
|
{
|
|||
|
|
[DllImport("user32.dll")]//*********************拖动无窗体的控件
|
|||
|
|
public static extern bool ReleaseCapture();
|
|||
|
|
[DllImport("user32.dll")]
|
|||
|
|
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
|
|||
|
|
public const int WM_SYSCOMMAND = 0x0112;
|
|||
|
|
public const int SC_MOVE = 0xF010;
|
|||
|
|
public const int HTCAPTION = 0x0002;
|
|||
|
|
|
|||
|
|
public string showmsgstr = "";
|
|||
|
|
public int TimeDelay = 9;
|
|||
|
|
public ItemsShowBox(string MsgIn)
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
showmsgstr = MsgIn;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ItemsShowBox_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
int x = (Screen.PrimaryScreen.WorkingArea.Width - this.Width) / 2;
|
|||
|
|
int y = (Screen.PrimaryScreen.WorkingArea.Height - this.Height) / 2;
|
|||
|
|
this.Location = new Point(x, y);
|
|||
|
|
string[] Arr = showmsgstr.Split(';');
|
|||
|
|
int i = 0;
|
|||
|
|
listView1.Columns.Add("序号", 50); // 第一列,宽度为 100 像素
|
|||
|
|
listView1.Columns.Add("项目", 350); // 第二列,宽度为 150 像素
|
|||
|
|
foreach (string str in Arr)
|
|||
|
|
{
|
|||
|
|
if(str!="")
|
|||
|
|
{
|
|||
|
|
i++;
|
|||
|
|
listView1.Items.Add(new ListViewItem(new string[] { i.ToString(), str }));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void pictureBox1_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
this.Close();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void timerforClose_Tick(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
TimeDelay--;
|
|||
|
|
LabTimeDelay.Text = TimeDelay.ToString();
|
|||
|
|
if (TimeDelay<=0)
|
|||
|
|
{
|
|||
|
|
this.Close();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void ItemsShowBox_MouseDown(object sender, MouseEventArgs e)
|
|||
|
|
{
|
|||
|
|
ReleaseCapture();
|
|||
|
|
SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|