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
|
System.Windows.Forms.Timer myTimer = new System.Windows.Forms.Timer() ;
string backgrd="";
PrintDocument pd = new PrintDocument();
private void Timer(Object myObject, EventArgs myEventArgs)
{
myTimer.Stop();
myTimer.Tick -= Timer;
CaptureInfo.CaptureFrame();
}
public Form1()
{
InitializeComponent();
pd.PrintPage += pd_PrintPage;
}
private void ErrorMessage(Exception error)
{
MessageBox.Show(error.Message, "Webcam Test", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
private void debut()
{
Flash.Movie = "E:/livre/conf/photo.swf";
panel1.BackgroundImage = Image.FromFile(backgrd);
pictureBox1.Visible = true;
pictureBox2.Visible = false;
label4.Visible = true;
label5.Visible = true;
Recom.Visible = false;
Recom.Movie = null;
Print.Visible = false;
Print.Movie = null;
//pictureBox2.Image = null;
Flash.Visible = true;
}
private void Print_Click(object sender3, EventArgs e3)
{
Recom.Visible = false;
Print.Visible = false;
panel1.BackgroundImage = Image.FromFile("E:/livre/conf/loading.gif");
pictureBox2.Visible = false;
pictureBox5.Visible = false;
imprimer();
debut();
}
private void imprimer()
{
MessageBox.Show("2");
pd.Print();
}
private void pd_PrintPage(object senderP, System.Drawing.Printing.PrintPageEventArgs ev)
{
try
{
MessageBox.Show("1");
ev.Graphics.DrawImage(this.pictureBox5.Image, 0, 0, 390, 300);
ev.HasMorePages = false;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void Flash_Enter(object sender, EventArgs e)
{
myTimer.Tick += Timer;
myTimer.Interval = 4000;
myTimer.Start();
}
private void Recom_Enter_1(object sender2, EventArgs e2)
{
MessageBox.Show("3");
debut();
} |
Partager