Search code examples
c#wpfdevexpress-wpf

How to print CHEQUE without background in wpf C#


i would like to print the cheque so i am taking one background image to put the textblocks on correct place so that the text should be on correct place my requirement is i have to put the cheque in the printer and i have to show the values on cheque so my intention is after printing it should not show the image on cheque cheque

private void Button_Click_1(object sender, RoutedEventArgs e)
    {
        PrintDialog dialog = new PrintDialog();
        if (dialog.ShowDialog() == true)
        {
            dialog.PrintVisual(stackPrinting, "stackPrinting");
        }
    }

Solution

  • your code behind button click should be like this hope it works.

    grdCheque.Background = new SolidColorBrush();
            PrintDialog dialog = new PrintDialog();
            if (dialog.ShowDialog() == true)
            {
                dialog.PrintVisual(grdCheque, "grdCheque");
                this.Close();
            }