Oriolesboy
Member
- Joined
- Jul 18, 2003
- Messages
- 10
Sorry if this has been posted before, I looked around as well as searched and did not find anything.
Here goes:
I have this board class (like a checker/chess/whatever_game board) and I want to send it to the printer to print it out.
There are two ways I am trying to do it each with their own problem:
1) Display the board on the screen and bitblt it to image then send it to the printer.
1p) The problem: Unfortunately the board is too large for the form and so the form adds a scroll bar, this results in part of the board missing and whatever is on the desktop being taken as an image (since the size of the board is greater then the form). I cannot just make the board fit on the screen as it needs to remain a certain size and i cannot change the resolution as this program may end up on many computers with different resolution sizes.
code: Graphics g is passed into the method
/*****************************************/
Image MyImage = new Bitmap(total_width, total_height, g);
Graphics g2 = Graphics.FromImage(MyImage);
IntPtr dc1 = g.GetHdc();
IntPtr dc2 = g2.GetHdc();
BitBlt(dc2, 0, 0,
boards[0].Width,
boards[0].Height,
dc1, 0, 0, 13369376);
g.ReleaseHdc(dc1);
g2.ReleaseHdc(dc2);
/******************************************/
2) Create the objects without displaying (ie- never drawing them to the current graphics- not displaying it on the screen in any way), and then bitblt that and draw the images to the printer
2p) The problem here is my board ends up transparents in most of the places and still ends with the desktop or the printer dialog as part of the image.
The code is pretty much the same, except that in the above code (not that it shows it) the objects are showing on the screen, and for this part the objects have not been drawn to the screen only created.
Also i try grabbing the objects graphics with:
Graphics temp_g = boards.CreateGraphics();
Any ideas how to do this?
- ps, my board is nothing but a collection of extended labels that I modified to display the appropriate graphics
EDIT: My board extends a GroupBox if that helps /EDIT
Thanks for any help!
I have found printing custom forms/objects to a printer to be a very pain, and have not found an easy way to do it.
Here goes:
I have this board class (like a checker/chess/whatever_game board) and I want to send it to the printer to print it out.
There are two ways I am trying to do it each with their own problem:
1) Display the board on the screen and bitblt it to image then send it to the printer.
1p) The problem: Unfortunately the board is too large for the form and so the form adds a scroll bar, this results in part of the board missing and whatever is on the desktop being taken as an image (since the size of the board is greater then the form). I cannot just make the board fit on the screen as it needs to remain a certain size and i cannot change the resolution as this program may end up on many computers with different resolution sizes.
code: Graphics g is passed into the method
/*****************************************/
Image MyImage = new Bitmap(total_width, total_height, g);
Graphics g2 = Graphics.FromImage(MyImage);
IntPtr dc1 = g.GetHdc();
IntPtr dc2 = g2.GetHdc();
BitBlt(dc2, 0, 0,
boards[0].Width,
boards[0].Height,
dc1, 0, 0, 13369376);
g.ReleaseHdc(dc1);
g2.ReleaseHdc(dc2);
/******************************************/
2) Create the objects without displaying (ie- never drawing them to the current graphics- not displaying it on the screen in any way), and then bitblt that and draw the images to the printer
2p) The problem here is my board ends up transparents in most of the places and still ends with the desktop or the printer dialog as part of the image.
The code is pretty much the same, except that in the above code (not that it shows it) the objects are showing on the screen, and for this part the objects have not been drawn to the screen only created.
Also i try grabbing the objects graphics with:
Graphics temp_g = boards.CreateGraphics();
Any ideas how to do this?
- ps, my board is nothing but a collection of extended labels that I modified to display the appropriate graphics
EDIT: My board extends a GroupBox if that helps /EDIT
Thanks for any help!
I have found printing custom forms/objects to a printer to be a very pain, and have not found an easy way to do it.
Last edited by a moderator: