1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- using ScintillaNET;
- using System;
- using System.Windows.Forms;
- namespace LinePrinterPoC
- {
- public partial class LinePrinterForm : Form
- {
- private Scintilla _textBox;
- private LinePrinter _printer;
- public LinePrinterForm()
- {
- InitializeComponent();
- }
- private void LinePrinterForm_Shown(object sender, EventArgs e)
- {
- _printer = new LinePrinter();
- _textBox = new Scintilla { Dock = DockStyle.Fill };
- Controls.Add(_textBox);
- _textBox.BringToFront();
- }
- private void ChooseButton_Click(object sender, EventArgs e)
- {
- if (_printer.ChoosePrinter(this)) PrinterLabel.Text = _printer.PrinterName;
- }
- private void PrintButton_Click(object sender, EventArgs e)
- {
- if (false == _printer.Open("print doc"))
- {
- MessageBox.Show("Open printer fail");
- return;
- }
- MessageBox.Show(
- _printer.Print(_textBox.Text)
- ? "OK"
- : "Fail"
- );
- _printer.Close();
- }
- }
- }
|