Silverlight를 처음 사용합니다. 인쇄 할 때 DatePicker
아이콘을 제거해야합니다. 그래서 나는이 코드를 인쇄 할 때 아이콘을 없애기 위해 썼다. 인쇄 대화 상자에서 인쇄 버튼을 클릭하면 올바르게 작동합니다. 하지만 인쇄 대화 상자를 닫으면 날짜 선택기 아이콘이 나타나지 않습니다. 인쇄 대화 상자의 가까운 이벤트에 코드를 작성해야합니다. 인쇄 대화 상자의 이벤트를 찾을 수 없습니다. Silverlight에서 인쇄 대화 상자 닫기 이벤트를 처리하는 방법 5
이
인쇄 코드입니다 :private StackPanel Downloaded_Data(StackPanel Sp_Element)
{
foreach (UIElement ele in Sp_Element.Children)
{
if (ele is FirstPageTC)
{
if ((ele as FirstPageTC).Content is StackPanel)
Downloaded_Data((ele as FirstPageTC).Content as StackPanel);
if ((ele as FirstPageTC).Content is Grid)
Download_Grid((ele as FirstPageTC).Content as Grid);
}
if (ele is Blank_Page)
{
if ((ele as Blank_Page).Content1 is StackPanel)
Downloaded_Data((ele as Blank_Page).Content1 as StackPanel);
if ((ele as Blank_Page).Content1 is Grid)
Download_Grid((ele as Blank_Page).Content1 as Grid);
}
if (ele is DatePicker)
{
DatePicker s = ele as DatePicker;
s.Style = App.Current.Resources["DateStyle"] as Style;
// s.Background = new SolidColorBrush(Color.FromArgb(255, 143, 188, 143));
}
if (ele is StackPanel)
{
Downloaded_Data(ele as StackPanel);
}
if (ele is Grid)
{
Download_Grid(ele as Grid);
}
}
return Sp_Element;
}
public void Download_Grid(Grid grid_down)
{
foreach (UIElement ele in grid_down.Children)
{
if (ele is Border)
{
UIElement ele_b = (ele as Border).Child;
if (ele_b is DatePicker)
{
DatePicker s = ele_b as DatePicker;
s.Style = App.Current.Resources["DateStyle"] as Style;
// s.Background = new SolidColorBrush(Color.FromArgb(255, 143, 188, 143));
}
//here
if (ele_b is Grid)
{
Download_Grid(ele_b as Grid);
}
if (ele_b is StackPanel)
{
Downloaded_Data(ele_b as StackPanel);
}
}
}
}
private void Downloaded_Datepicker(StackPanel Sp_Element)
{
foreach (UIElement ele in Sp_Element.Children)
{
if (ele is FirstPageTC)
{
if ((ele as FirstPageTC).Content is StackPanel)
Downloaded_Datepicker((ele as FirstPageTC).Content as StackPanel);
if ((ele as FirstPageTC).Content is Grid)
Download_GridDate((ele as FirstPageTC).Content as Grid);
}
if (ele is Blank_Page)
{
if ((ele as Blank_Page).Content1 is StackPanel)
Downloaded_Datepicker((ele as Blank_Page).Content1 as StackPanel);
if ((ele as Blank_Page).Content1 is Grid)
Download_GridDate((ele as Blank_Page).Content1 as Grid);
}
if (ele is DatePicker)
{
DatePicker s = ele as DatePicker;
s.Style = App.Current.Resources["DateNormal"] as Style;
}
if (ele is StackPanel)
{
Downloaded_Datepicker(ele as StackPanel);
}
if (ele is Grid)
{
Download_GridDate(ele as Grid);
}
}
}
public void Download_GridDate(Grid grid_down)
{
foreach (UIElement ele in grid_down.Children)
{
if (ele is Border)
{
UIElement ele_b = (ele as Border).Child;
if (ele_b is DatePicker)
{
DatePicker s = ele_b as DatePicker;
s.Style = App.Current.Resources["DateNormal"] as Style;
}
//here
if (ele_b is Grid)
{
Download_GridDate(ele_b as Grid);
}
if (ele_b is StackPanel)
{
Downloaded_Datepicker(ele_b as StackPanel);
}
}
}
}
public void PrintPage(StackPanel sp_Print)
{
foreach (UIElement sp_Element in sp_Print.Children)
{
if (sp_Element is StackPanel)
{
StackPanel printableSpnel=Downloaded_Data(sp_Element as StackPanel);
//sp_Printing[count] = sp_Element as StackPanel;
//count = count + 1;
sp_Printing[count] = printableSpnel;
count = count + 1;
}
}
WithDatePickerIcon = sp_Print as StackPanel;
print_Doc.PrintPage += new EventHandler<PrintPageEventArgs>(print_Doc_PrintPage);
print_Doc.Print("REOSK Printing");
}
void print_Doc_PrintPage(object sender, PrintPageEventArgs e)
{
if (count == i)
{
e.PageVisual = sp_Printing[i];
e.HasMorePages = false;
Downloaded_Datepicker(WithDatePickerIcon as StackPanel);
}
else
{
e.PageVisual = sp_Printing[i];
e.HasMorePages = true;
i = i + 1;
Downloaded_Datepicker(WithDatePickerIcon as StackPanel);
}
}