FrmLuckyShow.cs
4.31 KB
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GeneralLib;
namespace SunVoteARSPPT
{
public partial class FrmLuckyShow : Form
{
public FrmLuckyShow()
{
InitializeComponent();
this.Width = (int)(Screen.PrimaryScreen.Bounds.Width * 0.7);
lblRoll.Click += LblRoll_Click;
this.Click += LblRoll_Click;
}
private void LblRoll_Click(object sender, EventArgs e)
{
tmrRoll.Enabled = !tmrRoll.Enabled;
}
private void picClose_Click(object sender, EventArgs e)
{
this.Close();
}
List<string> LstName = new List<string>();
string ShowName = "";
private void FrmLuckyShow_Load(object sender, EventArgs e)
{
ControlOper.CenterForm(this, true);//杨斌 2014-09-16
lblRoll.Text = "";
LstName.Clear();
RosterList roster = new RosterList();
if (roster.RosterEnabled)
{
roster.LoadRoster();
int col = 0;
for (int i = 0; i < roster.Columns.Count; i++)
{
if (roster.Columns[i].ColumnName == GlobalInfo.response.ShowNameCol)
{
col = i;
break;
}
}
if (col > 0)
{
for (int i = 0; i < roster.Rows.Count; i++)
{
string name = roster.Rows[i].Cells[col].ToString();
LstName.Add(name);
}
}
}
else
{
string[] KeyIDList = PublicFunction.KeyIDSort();
LstName = KeyIDList.ToList<string>();
}
if (LstName.Count > 0)
{
tmrRoll.Interval = 10;
tmrRoll.Start();
}
}
private void FrmLuckyShow_KeyDown(object sender, KeyEventArgs e)
{
if (Globals.SunVoteARSAddIn.GetPPTVersion() >= 15)//杨斌 2015-07-08
return;
switch (e.KeyCode)
{
case Keys.Escape:
//this.Close();//屏蔽,在快捷键处理。杨斌 2015-05-26
break;
case Keys.Space:
tmrRoll.Enabled = !tmrRoll.Enabled;
break;
}
}
public void PressSpace()
{
tmrRoll.Enabled = !tmrRoll.Enabled;
}
private void tmrRoll_Tick(object sender, EventArgs e)
{
Random rd = new Random();
int i = 0;
if (LstName.Count < 1) return;
i = rd.Next(0, LstName.Count - 1);
string name = LstName[i];
LstName.Remove(name);
if (ShowName.Length > 0)
LstName.Add(ShowName);
ShowName = name;
lblRoll.Text = ShowName;
try
{
lblFont.Text = lblRoll.Text;
//lblFont.Font = lblRoll.Font;
lblFont.Font = new Font(lblRoll.Font.Name, lblRoll.Font.Size, lblRoll.Font.Style);
while ((lblFont.Width < lblRoll.Width) && (lblFont.Height < lblRoll.Height))
{
lblFont.Font = new Font(lblFont.Font.Name, lblFont.Font.Size + 0.75f, lblFont.Font.Style);
}
if (lblRoll.Font.Size > 12)
while ((lblFont.Width > lblRoll.Width) || (lblFont.Height > lblRoll.Height))
{
lblFont.Font = new Font(lblFont.Font.Name, lblFont.Font.Size - 0.75f, lblFont.Font.Style);
}
lblRoll.Font = new Font(lblFont.Font.Name, lblFont.Font.Size, lblFont.Font.Style);
}
catch { }
}
private void tmrSelect_Tick(object sender, EventArgs e)
{
this.Select();//杨斌 2014-09-24
}
private void FrmLuckyShow_FormClosing(object sender, FormClosingEventArgs e)
{
tmrSelect.Enabled = false;//杨斌 2014-09-24
}
}
}