private void btnPrint_Click(object sender, RoutedEventArgs e)
{
PrintDialog dialog = new PrintDialog();
if (dialog.ShowDialog() == true)
{
StackPanel stpanel;
stpanel = PrintStakPanel;
stpanel.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
Size grdSize = stpanel.DesiredSize;
Point grdPoint = new Point((dialog.PrintableAreaWidth - grdSize.Width) / 2, (dialog.PrintableAreaHeight - grdSize.Height) / 2);
stpanel.Arrange(new Rect(grdPoint, grdSize));
Grid.SetRow(stpanel, 0);
dialog.PrintVisual(stpanel, "Cinema Ticket");
}
}
質問する
3076 次