diff --git a/Windows/Print.xaml b/Windows/Print.xaml
index 6992833..aa17708 100644
--- a/Windows/Print.xaml
+++ b/Windows/Print.xaml
@@ -5,14 +5,17 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:formula_manage.Windows"
mc:Ignorable="d"
- Title="打印设置" Height="450" Width="500" MaxWidth="500">
+ Title="打印设置" Height="500" Width="500" MaxWidth="500">
-
-
-
-
+
+
+
+
+
diff --git a/Windows/Print.xaml.cs b/Windows/Print.xaml.cs
index f9852e7..8c7b91c 100644
--- a/Windows/Print.xaml.cs
+++ b/Windows/Print.xaml.cs
@@ -18,6 +18,7 @@ using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Printing;
using formula_manage.UserClass;
+using System.Xml.Linq;
namespace formula_manage.Windows
{
@@ -30,8 +31,11 @@ namespace formula_manage.Windows
{
WindowStartupLocation = WindowStartupLocation.CenterScreen;
InitializeComponent();
+ cbxPrinter.ItemsSource = this.GetLocalPrinters();
}
+ bool Printer;
+
private void Button_Click(object sender, RoutedEventArgs e) //SQL_DISPEN_bak路径选择按钮
{
FolderBrowserDialog Dilog = new FolderBrowserDialog();
@@ -43,13 +47,13 @@ namespace formula_manage.Windows
Print_path.Text = Dilog.SelectedPath; //返回选择的字符串
}
}
- private void Button_Click_1(object sender, RoutedEventArgs e) //SQL_DISPEN_bak路径选择按钮
+ private void Button_Click_1(object sender, RoutedEventArgs e) //编辑模板
{
- if (string.IsNullOrEmpty(Print_path.Text))
+ /* if (string.IsNullOrEmpty(Print_path.Text))
{
System.Windows.MessageBox.Show("模板不能为空");
return;
- }
+ }*/
var data = this.CreateBillData();
if (!data.Item1)
{
@@ -63,7 +67,7 @@ namespace formula_manage.Windows
System.Windows.MessageBox.Show($"打开设计器失败:{tuple.Item2}");
}
}
- private void Button_Click_2(object sender, RoutedEventArgs e) //SQL_DISPEN_bak路径选择按钮
+ private void Button_Click_2(object sender, RoutedEventArgs e) //预览模板
{
}
@@ -97,5 +101,31 @@ namespace formula_manage.Windows
return new Tuple, DataSet>(true, dic, dsFrx);
}
+
+ private void Print_Checked(object sender, RoutedEventArgs e) //打印机是否生效
+ {
+ Printer = TEXT_Print.IsChecked.GetValueOrDefault(); //打印机是否生效
+ cbxPrinter.IsEnabled = Printer; //
+ }
+
+ private List GetLocalPrinters() //查找打印机
+ {
+ List list = new List();
+ try
+ {
+ foreach (string fPrinterName in PrinterSettings.InstalledPrinters)
+ {
+ var xePrintName = new XElement("Item", new XElement("OPTIONNAME", fPrinterName.Trim()), new XElement("OPTIONCODE", fPrinterName.Trim()));
+
+ if (!list.Contains(xePrintName))
+ list.Add(xePrintName);
+ }
+ }
+ catch (Exception ex)
+ {
+
+ }
+ return list;
+ }
}
}