using FastReport; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Drawing; using System.Text; using System.Threading; using System.Windows.Forms; namespace dccdc.Selfhelp { public partial class frm_bgcx : Form { public frm_bgcx() { InitializeComponent(); } private void frm_bgcx_MouseMove(object sender, MouseEventArgs e) { Rectangle rect = new Rectangle(30, 30, 170, 56); if (rect.Contains(e.Location)) { Cursor = Cursors.Hand; } else { Cursor = Cursors.Default; } } private void frm_bgcx_MouseClick(object sender, MouseEventArgs e) { Rectangle rect = new Rectangle(30, 30, 170, 56); if (rect.Contains(e.Location)) { this.Close(); } } private void frm_bgcx_Load(object sender, EventArgs e) { } public static FastReport.EnvironmentSettings eSet = new EnvironmentSettings(); private void label2_Click(object sender, EventArgs e) { eSet.ReportSettings.ShowProgress = false; Status s = new Status("正在打印请稍后……"); s.Show(); Application.DoEvents(); DataTable dt = new DataTable(); dt.Columns.Add("barcode"); dt.Columns.Add("username"); DataRow dr = dt.NewRow(); dr["barcode"] = textBox1.Text; dr["username"] = ""; dt.Rows.Add(dr); FastReport.Report re = new FastReport.Report(); re.Load(Application.StartupPath+ "\\report\\ymbarcode.frx"); re.RegisterData(dt, "barcode"); re.PrintSettings.ShowDialog = false; string tmprint = System.Configuration.ConfigurationManager.AppSettings["tmprint"]; if (!string.IsNullOrEmpty(tmprint)) re.PrintSettings.Printer = tmprint; re.Print(); s.update("打印成功"); Application.DoEvents(); Thread.Sleep(2000); s.Close(); this.Close(); } Process pros; private void textBox1_Enter(object sender, EventArgs e) { pros = Process.Start("osk.exe"); } private void textBox1_Leave(object sender, EventArgs e) { pros.WaitForExit(); pros.Close(); } private void label1_Click(object sender, EventArgs e) { } } }