Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Drawing.Imaging;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- //using System.Console;
- namespace Kody
- {
- public partial class Generator : Form
- {
- public Generator()
- {
- InitializeComponent();
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- private void txtBarcode_TextChanged(object sender, EventArgs e)
- {
- }
- private void load_Click(object sender, EventArgs e)
- {
- string[] lines = System.IO.File.ReadAllLines("C:/Users/lab/Desktop/123.txt");
- foreach (string line in lines) {
- System.Console.WriteLine(line);
- Zen.Barcode.CodeEan13BarcodeDraw barcode = Zen.Barcode.BarcodeDrawFactory.CodeEan13WithChecksum;
- if (line.Length == 12)
- {
- pictureBox1.Image = barcode.Draw(line, 100, 2);
- }
- }
- }
- private void btnBarcode_Click(object sender, EventArgs e)
- {
- Zen.Barcode.CodeEan13BarcodeDraw barcode = Zen.Barcode.BarcodeDrawFactory.CodeEan13WithChecksum;
- if (txtBarcode.TextLength == 12)
- {
- pictureBox1.Image = barcode.Draw(txtBarcode.Text, 100, 2);
- }
- else
- {
- MessageBox.Show("Podaj 12 cyfr");
- }
- }
- private void pictureBox1_Click(object sender, EventArgs e)
- {
- }
- private void myPrintDocument2_PrintPage(System.Object sender, System.Drawing.Printing.PrintPageEventArgs e)
- {
- Bitmap myBitmap1 = new Bitmap(pictureBox1.Width, pictureBox1.Height);
- pictureBox1.DrawToBitmap(myBitmap1, new Rectangle(0, 0, pictureBox1.Width*2, pictureBox1.Height));
- e.Graphics.DrawImage(myBitmap1, 0, 0);
- myBitmap1.Dispose();
- }
- private void btnPrint_Click(object sender, EventArgs e)
- {
- System.Drawing.Printing.PrintDocument myPrintDocument1 = new System.Drawing.Printing.PrintDocument();
- PrintDialog myPrinDialog1 = new PrintDialog();
- myPrintDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(myPrintDocument2_PrintPage);
- myPrinDialog1.Document = myPrintDocument1;
- if (myPrinDialog1.ShowDialog() == DialogResult.OK)
- {
- myPrintDocument1.Print();
- }
- }
- private void btnSave_Click(object sender, EventArgs e)
- {
- pictureBox1.Image.Save("kod_" + txtBarcode.Text + ".jpg");
- MessageBox.Show("Zapisano plik " + "kod_" + txtBarcode.Text + ".jpg");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement