/// <summary> /// Event response function for the DefaultButton /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSetDefault_Click(object sender, RoutedEventArgs e) { ShowDatas datas = PopList.Tag as ShowDatas; if (null != datas) { SetDefaultPageData(datas); } }
/// <summary> /// Set the default print page data /// </summary> /// <param name="datas"></param> private void SetDefaultPageData(ShowDatas datas) { if (null == datas) { return; } txtHeaderLeft.Text = ""; txtHeaderCenter.Text = ShowData.GetShowText(ShowData.STR_FILE_PATH); txtHeaderRight.Text = ""; txtFooterLeft.Text = ShowData.GetShowText(ShowData.STR_DATE_PRINTER); txtFooterCenter.Text = ""; txtFooterRight.Text = ShowData.GetShowText(ShowData.STR_PAGE) + ShowData.GetShowText(ShowData.STR_PAGE_OF); }
public PrintPageSetup() { InitializeComponent(); //加载纸张样式列表项 lbStyles.Items.Add(PaperFormat.A3); lbStyles.Items.Add(PaperFormat.A4); //lbStyles.Items.Add(PaperFormat.A5); // load data chkPrintColor.IsChecked = PrintPageSetup.PrintWithColor; if (PrintPageSetup.PrintLandscape) { rbLandscape.IsChecked = true; } else { rbPortrait.IsChecked = true; } txtHeaderLeft.Text = PrintPageSetup.HeaderLeftInfo; txtHeaderCenter.Text = PrintPageSetup.HeaderCenterInfo; txtHeaderRight.Text = PrintPageSetup.HeaderRightInfo; txtFooterLeft.Text = PrintPageSetup.FooterLeftInfo; txtFooterCenter.Text = PrintPageSetup.FooterCenterInfo; txtFooterRight.Text = PrintPageSetup.FooterRightInfo; PaperFormat paper = PrintPageSetup.PaperStyle; foreach (PaperFormat item in lbStyles.Items) { if (paper == item) { lbStyles.SelectedItem = item; txtCurStyle.Text = item.ToString(); } } //初始化数据类型列表 ShowDatas datas = this.FindResource("DataList") as ShowDatas; if (datas != null) { //datas = new ObservableCollection<ShowData>(); //datas.Add(new ShowData(ShowType.TEXT)); datas.Add(new ShowData(ShowType.PAGE)); datas.Add(new ShowData(ShowType.PAGE_OF)); datas.Add(new ShowData(ShowType.CUR_DATE)); datas.Add(new ShowData(ShowType.CUR_TIME)); datas.Add(new ShowData(ShowType.CUR_DATE_TIME)); datas.Add(new ShowData(ShowType.FILE_PATH)); datas.Add(new ShowData(ShowType.PROJECT_PATH)); datas.Add(new ShowData(ShowType.DATE_PRINTED)); datas.Add(new ShowData(ShowType.DATE_CREATED)); datas.Add(new ShowData(ShowType.DATE_LAST_MODIFIED)); datas.Add(new ShowData(ShowType.OBJECT)); datas.Add(new ShowData(ShowType.OBJECT_TYPE)); PopList.Tag = datas; } }