Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi, I have a small program and Iam trying to print the RDLC report from the Button_Click(). While I convert the C# code to C++/CLI, I get struck from the below areas. Any kind helps ...Thanks

// Handler for PrintPageEvents
	public: static System::Void PrintPage(Object^ sender, PrintPageEventArgs^ e){
Metafile^ pageMetaFile = gcnew Metafile(pageToPrint);
		System::Drawing::Rectangle^ adjustedRect = gcnew Rectangle(e->PageBounds.Left - Convert::ToInt32(e->PageSettings->HardMarginX), e->PageBounds.Top - Convert::ToInt32(e->PageSettings->HardMarginY), e->PageBounds.Width, e->PageBounds.Height);

//Below line error like no instance of overloaded function System::Drawing::Graphics::Fillrectangle matches the arguement list & arguement type System::Drawing::Brush, System::Drawing::Rectangle and the Object type is System::drawing::Graphics
????????????

e->Graphics->FillRectangle(Brushes::White, adjustedRect);

Thanks for the helps !

What I have tried:

Tried to Print RDLC report directly to the printer.
Posted

1 solution

Try e->graphics->FillRectangle(Brushes::White, e ->PageBounds.Left - Convert::ToInt32(e->PageSettings->HardMarginX), e->PageBounds.Top - Convert::ToInt32(e->PageSettings->HardMarginY), e->PageBounds.Width, e->PageBounds.Height); instead.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900