111,094
社区成员




string filename = @"C:\test.docx";
pro = new System.Diagnostics.Process();
pro.StartInfo.CreateNoWindow = true;
pro.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
pro.StartInfo.UseShellExecute = true;
pro.StartInfo.FileName = filename;
pro.StartInfo.Verb = "print";
pro.Start();
MessageBox.Show("");//测试用的提示语句
public partial class Form1 : Form
{
System.Diagnostics.Process pro;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Print();
}
private void Print()
{
Thread t = new Thread(delegate()
{
string filename = @"C:\test.docx";
pro = new System.Diagnostics.Process();
pro.StartInfo.CreateNoWindow = true;
pro.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
pro.StartInfo.UseShellExecute = true;
pro.StartInfo.FileName = filename;
pro.StartInfo.Verb = "print";
pro.Start();
MessageBox.Show("");
});
t.IsBackground = true;
t.Start();
}
private void button2_Click(object sender, EventArgs e)
{
if (pro != null)
{
pro.Kill();
pro = null;
}
}
}