Browse Source

打印设置页面完成

master
忱 沈 2 years ago
committed by sc
parent
commit
d59701122e
  1. 4
      Windows/Print.xaml
  2. 20
      Windows/Print.xaml.cs

4
Windows/Print.xaml

@ -39,5 +39,9 @@
<ComboBox HorizontalAlignment="Left" Height="20" Margin="110,305,0,0" VerticalAlignment="Top" Width="180" x:Name="Template" IsEditable="True"/> <ComboBox HorizontalAlignment="Left" Height="20" Margin="110,305,0,0" VerticalAlignment="Top" Width="180" x:Name="Template" IsEditable="True"/>
<Button Content="删除模板" HorizontalAlignment="Left" Height="20" Margin="375,305,0,0" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" Click="Button_Click_4"/> <Button Content="删除模板" HorizontalAlignment="Left" Height="20" Margin="375,305,0,0" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" Click="Button_Click_4"/>
<Button Content="添加模板" HorizontalAlignment="Left" Height="20" Margin="295,305,0,0" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" Click="Button_Click_3"/> <Button Content="添加模板" HorizontalAlignment="Left" Height="20" Margin="295,305,0,0" VerticalAlignment="Top" Width="70" Background="#FFF9F9F9" Click="Button_Click_3"/>
<Grid Grid.Column="1" x:Name="Prompt" Margin="0,0,0,0" Background="White" Opacity="0.8" Visibility="Hidden">
<TextBlock Height="50" Margin="0,0,0,150" TextWrapping="Wrap" Text="Processing,Pleasewait..." Width="400" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</Grid> </Grid>
</Window> </Window>

20
Windows/Print.xaml.cs

@ -55,9 +55,10 @@ namespace formula_manage.Windows
bool Printer4; bool Printer4;
bool Printer5; bool Printer5;
string Temp_M, Temp_S;
private void Window_Print(object sender, RoutedEventArgs e) private void Window_Print(object sender, RoutedEventArgs e)
{ {
string Temp_M, Temp_S;
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath); UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
Printer = Boolean.Parse(Configini.IniReadvalue("PRINTER", "P1")); Printer = Boolean.Parse(Configini.IniReadvalue("PRINTER", "P1"));
@ -80,6 +81,11 @@ namespace formula_manage.Windows
TEXT_Print3.IsChecked = Printer3; TEXT_Print3.IsChecked = Printer3;
cbxPrinter3.IsEnabled = Printer3; cbxPrinter3.IsEnabled = Printer3;
PRINT_file();
}
private void PRINT_file()//建立模板列表
{
DirectoryInfo di_M = new DirectoryInfo(Print_path.Text); //new文件夹 DirectoryInfo di_M = new DirectoryInfo(Print_path.Text); //new文件夹
FileInfo[] files_M = di_M.GetFiles("*.frx");//生成文件夹中的文件名合集 FileInfo[] files_M = di_M.GetFiles("*.frx");//生成文件夹中的文件名合集
Template_M.ItemsSource = files_M;//加载合集 Template_M.ItemsSource = files_M;//加载合集
@ -231,17 +237,22 @@ namespace formula_manage.Windows
private void Button_Click_3(object sender, RoutedEventArgs e)//新建模板文件 private void Button_Click_3(object sender, RoutedEventArgs e)//新建模板文件
{ {
Prompt.Visibility = Visibility.Visible; //开启页面遮罩
string Template_path = Print_path.Text + "/" + Template.Text; string Template_path = Print_path.Text + "/" + Template.Text;
string Template_DATA = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Report ScriptLanguage=\"CSharp\" ReportInfo.Created=\"12/12/2023 23:59:59\" ReportInfo.Modified=\"12/12/2023 23:59:59\" ReportInfo.CreatorVersion=\"2023.12.12.0\">\r\n <Dictionary/>\r\n <ReportPage Name=\"Page1\" Watermark.Font=\"宋体, 60pt\">\r\n <ReportTitleBand Name=\"ReportTitle1\" Width=\"718.2\" Height=\"37.8\"/>\r\n <PageHeaderBand Name=\"PageHeader1\" Top=\"41.8\" Width=\"718.2\" Height=\"28.35\"/>\r\n <DataBand Name=\"Data1\" Top=\"74.15\" Width=\"718.2\" Height=\"75.6\"/>\r\n <PageFooterBand Name=\"PageFooter1\" Top=\"153.75\" Width=\"718.2\" Height=\"18.9\"/>\r\n </ReportPage>\r\n</Report>"; string Template_DATA = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Report ScriptLanguage=\"CSharp\" ReportInfo.Created=\"12/12/2023 23:59:59\" ReportInfo.Modified=\"12/12/2023 23:59:59\" ReportInfo.CreatorVersion=\"2023.12.12.0\">\r\n <Dictionary/>\r\n <ReportPage Name=\"Page1\" Watermark.Font=\"宋体, 60pt\">\r\n <ReportTitleBand Name=\"ReportTitle1\" Width=\"718.2\" Height=\"37.8\"/>\r\n <PageHeaderBand Name=\"PageHeader1\" Top=\"41.8\" Width=\"718.2\" Height=\"28.35\"/>\r\n <DataBand Name=\"Data1\" Top=\"74.15\" Width=\"718.2\" Height=\"75.6\"/>\r\n <PageFooterBand Name=\"PageFooter1\" Top=\"153.75\" Width=\"718.2\" Height=\"18.9\"/>\r\n </ReportPage>\r\n</Report>";
if (File.Exists(Template_path)) //判断文件是否存在 if (File.Exists(Template_path)) //判断文件是否存在
{ {
System.Windows.MessageBox.Show("模板已存在"); System.Windows.MessageBox.Show("模板已存在");
Prompt.Visibility = Visibility.Hidden;//去页面遮罩
return; return;
} }
if (string.IsNullOrEmpty(Template.Text)) if (string.IsNullOrEmpty(Template.Text))
{ {
System.Windows.MessageBox.Show("模板名不能为空"); System.Windows.MessageBox.Show("模板名不能为空");
Prompt.Visibility = Visibility.Hidden;//去页面遮罩
return; return;
} }
@ -250,7 +261,14 @@ namespace formula_manage.Windows
if (!tuple.Item1) if (!tuple.Item1)
{ {
System.Windows.MessageBox.Show($"打开设计器失败:{tuple.Item2}"); System.Windows.MessageBox.Show($"打开设计器失败:{tuple.Item2}");
Prompt.Visibility = Visibility.Hidden;
return;
} }
PRINT_file(); ;//刷新模板列表
Template.Text = null;//清空输入
Prompt.Visibility = Visibility.Hidden;//去页面遮罩
} }
private void Button_Click_4(object sender, RoutedEventArgs e)//删除指定模板 private void Button_Click_4(object sender, RoutedEventArgs e)//删除指定模板

Loading…
Cancel
Save