-
Notifications
You must be signed in to change notification settings - Fork 0
/
BlackList.cs
124 lines (115 loc) · 4.14 KB
/
BlackList.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace BX
{
public partial class BlackList : Form
{
public BlackList()
{
InitializeComponent();
}
const int HTLEFT = 10;
const int HTRIGHT = 11;
const int HTTOP = 12;
const int HTTOPLEFT = 13;
const int HTTOPRIGHT = 14;
const int HTBOTTOM = 15;
const int HTBOTTOMLEFT = 0x10;
const int HTBOTTOMRIGHT = 17;
protected override void WndProc(ref Message m)
{
switch (m.Msg)
{
case 0x0201://鼠标左键按下的消息
m.Msg = 0x00A1;//更改消息为非客户区按下鼠标
m.LParam = IntPtr.Zero;//默认值
m.WParam = new IntPtr(2);//鼠标放在标题栏内
base.WndProc(ref m);
break;
default:
base.WndProc(ref m);
break;
}
}
private void Form3_Load(object sender, EventArgs e)
{
load("1", "");
}
public void load(string number, string xuehao)
{
string[] args = new string[3];
args[0] = number;
args[1] = myuser.ErrInfo;
args[2] = xuehao;
object result = myuser.InvokeWebService(myuser.ServerPage, "ReaderBlack", args);
DataSet DSRe = (DataSet)result;
this.dataGridView1.AutoGenerateColumns = true;
//将返回的DSRe绑定到datagridview上
this.dataGridView1.DataSource = DSRe;
//指定显示的datatable
this.dataGridView1.DataMember = "blacklist";
dataGridView1.ScrollBars = ScrollBars.Vertical;
dataGridView1.CellBorderStyle = DataGridViewCellBorderStyle.Single;
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView1.Columns[0].Width = 60;
int i;
for (i = 0; i < dataGridView1.Rows.Count; i++)
{
if (i % 2 == 0)
{
dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Moccasin;
}
}
}
private void button1_Click(object sender, EventArgs e)
{
if (xuehao.Text.Trim() == "")
{
load("1", "");
}
else
{
load("2", xuehao.Text.Trim());
if (dataGridView1.Rows.Count > 0)
{
dataGridView1.Rows[0].DefaultCellStyle.BackColor = Color.Indigo;
}
}
}
private void toolStripMenuItem1_Click(object sender, EventArgs e)
{
string xm= dataGridView1.CurrentRow.Cells[2].Value.ToString().Trim();
string xh = dataGridView1.CurrentRow.Cells[1].Value.ToString().Trim();
if (MessageBox.Show("确定把【" + xm + "】从黑名单中删除?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
{
string[] args = new string[6];
args[0] = myuser.ErrInfo;
args[1] = xh;
args[2] = "";
args[3] = "";
args[4] = "";
args[5] = "del";
object result = myuser.InvokeWebService(myuser.ServerPage, "GuanliBlack", args);
MessageBox.Show(result.ToString());
load("1", "");
}
}
private void button9_Click(object sender, EventArgs e)
{
this.Close();
}
private void Form3_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
LinearGradientBrush myBrush = new LinearGradientBrush(this.ClientRectangle, Color.MediumTurquoise, Color.LightYellow, LinearGradientMode.Vertical);
g.FillRectangle(myBrush, this.ClientRectangle);
}
}
}