принтер принтит принты

This commit is contained in:
the 2024-06-24 22:04:04 +04:00
parent 1fa7832bd7
commit 17403f4ce9
4 changed files with 75 additions and 0 deletions

View File

@ -13,6 +13,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="BarCode" Version="2024.6.1" /> <PackageReference Include="BarCode" Version="2024.6.1" />
<PackageReference Include="BCrypt.Net-Next" Version="4.0.3" /> <PackageReference Include="BCrypt.Net-Next" Version="4.0.3" />
<PackageReference Include="IronPrint" Version="2024.6.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" /> <PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.6.0" /> <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.6.0" />

View File

@ -28,6 +28,7 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
dataGridView = new DataGridView(); dataGridView = new DataGridView();
buttonCreateSupply = new Button(); buttonCreateSupply = new Button();
menuStrip1 = new MenuStrip(); menuStrip1 = new MenuStrip();
@ -36,6 +37,9 @@
buttonSupplyStatusArriving = new Button(); buttonSupplyStatusArriving = new Button();
buttonSupplyStatusCompleted = new Button(); buttonSupplyStatusCompleted = new Button();
buttonCreateReport = new Button(); buttonCreateReport = new Button();
buttonPrintReport = new Button();
printPreviewDialog = new PrintPreviewDialog();
printDialog = new PrintDialog();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
menuStrip1.SuspendLayout(); menuStrip1.SuspendLayout();
SuspendLayout(); SuspendLayout();
@ -112,11 +116,36 @@
buttonCreateReport.UseVisualStyleBackColor = true; buttonCreateReport.UseVisualStyleBackColor = true;
buttonCreateReport.Click += buttonCreateReport_Click; buttonCreateReport.Click += buttonCreateReport_Click;
// //
// buttonPrintReport
//
buttonPrintReport.Location = new Point(707, 274);
buttonPrintReport.Name = "buttonPrintReport";
buttonPrintReport.Size = new Size(154, 44);
buttonPrintReport.TabIndex = 6;
buttonPrintReport.Text = "Распечатать отчет";
buttonPrintReport.UseVisualStyleBackColor = true;
buttonPrintReport.Click += buttonPrintReport_Click;
//
// printPreviewDialog
//
printPreviewDialog.AutoScrollMargin = new Size(0, 0);
printPreviewDialog.AutoScrollMinSize = new Size(0, 0);
printPreviewDialog.ClientSize = new Size(400, 300);
printPreviewDialog.Enabled = true;
printPreviewDialog.Icon = (Icon)resources.GetObject("printPreviewDialog.Icon");
printPreviewDialog.Name = "printPreviewDialog";
printPreviewDialog.Visible = false;
//
// printDialog
//
printDialog.UseEXDialog = true;
//
// FormMain // FormMain
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(901, 384); ClientSize = new Size(901, 384);
Controls.Add(buttonPrintReport);
Controls.Add(buttonCreateReport); Controls.Add(buttonCreateReport);
Controls.Add(buttonSupplyStatusCompleted); Controls.Add(buttonSupplyStatusCompleted);
Controls.Add(buttonSupplyStatusArriving); Controls.Add(buttonSupplyStatusArriving);
@ -144,5 +173,8 @@
private Button buttonSupplyStatusArriving; private Button buttonSupplyStatusArriving;
private Button buttonSupplyStatusCompleted; private Button buttonSupplyStatusCompleted;
private Button buttonCreateReport; private Button buttonCreateReport;
private Button buttonPrintReport;
private PrintPreviewDialog printPreviewDialog;
private PrintDialog printDialog;
} }
} }

View File

@ -8,8 +8,11 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Drawing.Printing;
using System.Linq; using System.Linq;
using System.Reflection.Metadata;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
@ -167,5 +170,14 @@ namespace WinFormsApp
} }
} }
} }
private void buttonPrintReport_Click(object sender, EventArgs e)
{
var dialog = new OpenFileDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
IronPrint.Printer.PrintAsync(dialog.FileName);
}
}
} }
} }

View File

@ -120,4 +120,34 @@
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="printPreviewDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="printPreviewDialog.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAEBAAAAAAIAAoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAA
AAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP//
/wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP//
/wD///8A////AP///wD///8A////AP///wD///8A////APb29v/29vb/9vb2//b29v/29vb/9vb2//b2
9v////8A////AP///wD///8A9vb2//b29v/29vb/9vb2//b29v/29vb/QkJC/0JCQv9CQkL/QkJC/0JC
Qv/29vb/////AP///wD///8A////APb29v9CQkL/QkJC/0JCQv9CQkL/9vb2/0JCQv9CQkL/QkJC/0JC
Qv9CQkL/9vb2/////wD///8A////AP///wD29vb/QkJC/0JCQv9CQkL/QkJC//b29v9CQkL/QkJC/0JC
Qv9CQkL/QkJC//b29v////8A////AP///wD///8A9vb2/0JCQv9CQkL/QkJC/0JCQv/29vb/9vb2//b2
9v/29vb/9vb2//b29v/29vb/9vb2//b29v////8A////APb29v9CQkL/QkJC/0JCQv9CQkL/9vb2/0JC
Qv9CQkL/QkJC/0JCQv9CQkL/QkJC/0JCQv/29vb/////AP///wD29vb/QkJC/0JCQv9CQkL/QkJC//b2
9v9CQkL/QkJC/0JCQv9CQkL/QkJC/0JCQv9CQkL/9vb2/////wD///8A9vb2/0JCQv9CQkL/QkJC/0JC
Qv/29vb/QkJC/0JCQv9CQkL/QkJC/0JCQv9CQkL/QkJC//b29v////8A////APb29v/29vb/9vb2//b2
9v/29vb/9vb2/0JCQv9CQkL/QkJC/0JCQv9CQkL/QkJC/0JCQv/29vb/////AP///wD///8A////AP//
/wD///8A////APb29v9CQkL/QkJC/0JCQv9CQkL/QkJC/0JCQv9CQkL/9vb2/////wD///8A////AP//
/wD///8A////AP///wD29vb/QkJC/0JCQv9CQkL/QkJC/0JCQv9CQkL/QkJC//b29v////8A////AP//
/wD///8A////AP///wD///8A9vb2/0JCQv9CQkL/QkJC/0JCQv9CQkL/QkJC/0JCQv/29vb/////AP//
/wD///8A////AP///wD///8A////APb29v/29vb/9vb2//b29v/29vb/9vb2//b29v/29vb/9vb2////
/wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP//
/wD///8A
</value>
</data>
<metadata name="printDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>286, 17</value>
</metadata>
</root> </root>