110,534
社区成员
发帖
与我相关
我的任务
分享
public delegate void btnclick();
public partial class Frmmain : Form
{
public event btnclick btnc;
Thread test_thread;
private void Frmmain_Load(object sender, EventArgs e)
{
test_thread = new Thread(test);
test_thread.Start();
}
private void test()
{
try
{
while (true)
{
string idi = ConfigurationManager.AppSettings["IDI"];
if (testDI(idi) == 0)
{
btnc();
}
}
}
}
}
子窗体中的方法
public void printbtn()
{
try
{
lock (locker)
{
int intlsh = int.Parse(ConfigurationManager.AppSettings["liushuihao"]);
if (intlsh == 0)
{
string liu = ConfigurationManager.AppSettings["date"] + intlsh.ToString("000");
this.ccode.Text = dbb.Rows[0][0].ToString() + this.getserianumber(liu);
results = this.ccode.Text;
bcc.CreateBarCode(pictureBox1, results);
}
else
{
string liu = ConfigurationManager.AppSettings["date"] + intlsh.ToString("000");
this.ccode.Text = dbb.Rows[0][0].ToString() + this.getserianumber(liu);
results = this.ccode.Text;
bcc.CreateBarCode(pictureBox1, results);
}
PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
pd.PrintController = new StandardPrintController();
pd.Print();
string lius = ConfigurationManager.AppSettings["date"] + intlsh.ToString("000");
results = dbb.Rows[0][0].ToString() + this.getserianumber(lius);
this.ccode.Text = results;
bcc.CreateBarCode(pictureBox1, results);
bool gone = SetConfigValue("liushuihao", results.Substring(results.Length - 3));
this.setdate();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}