Click here to Skip to main content
15,885,366 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# Performance? Pin
tvbarnard26-Jun-09 2:07
tvbarnard26-Jun-09 2:07 
GeneralRe: C# Performance? Pin
Simon P Stevens26-Jun-09 3:29
Simon P Stevens26-Jun-09 3:29 
AnswerRe: C# Performance? Pin
Rajesh R Subramanian26-Jun-09 2:12
professionalRajesh R Subramanian26-Jun-09 2:12 
GeneralRe: C# Performance? Pin
tvbarnard26-Jun-09 2:16
tvbarnard26-Jun-09 2:16 
GeneralRe: C# Performance? Pin
Simon P Stevens26-Jun-09 3:32
Simon P Stevens26-Jun-09 3:32 
GeneralRe: C# Performance? Pin
Rajesh R Subramanian26-Jun-09 4:17
professionalRajesh R Subramanian26-Jun-09 4:17 
QuestionDisabling the Cancel Button During an Installation Pin
Imranlogi26-Jun-09 0:58
Imranlogi26-Jun-09 0:58 
QuestionPrinting without colour (or color) [modified] Pin
musefan26-Jun-09 0:54
musefan26-Jun-09 0:54 
Hi all,

I have a printing functions in my C# WinForms (.Net 3.5) application that prints to a printer that supports colour printing.

I am using a custom class that inherits from PrintDocument.

My printed page contains an image and some text. The Image contains colour.

Now, I can print everything just the way I want it to look in colour. But I want to include an option to print in 'Black and White'.

I can handle the text fine as I can just change the colour, but the image is where I am having issues.

I have already tried to set the DefaultPageSettings.Color property to false, this does not work, thou I suspect that is because I am inheriting the PrintDocument class and am expected to handle this functionality myself.
EDIT: I just realised that I am not handling the ability for multiple copies manually but when I set in DefaultPageSettings then it is auto handled as expected so I am now thinking that they is something causing the Color property to not be applied automatically.

I also tried creating a Bitmap with a grayscale pixelformat and drawing the image to that before drawing that bitmap the the PrintDocument's Graphics - This spat out a 'Out Of Memory' exception (admittedly, I could have made an error in the code but I don't really want to take this option anyway if possible)

A third option, which I have not tried yet, is to loop the image's pixels and convert them to grayscale - which is easy enough but again I would rather avoid that effort is possible.


Can anybody recommend the best way to handle this?

Thanks for any answers contributed


UPDATE:

OK, now I'm having what I would call strange results...

If I print the document with PrintDocument.Color set to true the Image is in colour (as expected)
If I print the document with PrintDocument.Color set to false the Image is in colour (not wanted)
If I manually convert the Image to grayscale and print with Color set to true the Image has a slight green tint (due to the greyscale conversion values)

But, if I manually convert the Image to grayscale and print with Color set to false then no green tint (i.e. the printer has printed the image in back and white as wanted!!!)

If anyone can see the logic in that then please let me know, BTW the image to greyscale function is done before passing the image to the custom PrintDocument class

Life goes very fast. Tomorrow, today is already yesterday.

modified on Friday, June 26, 2009 8:39 AM

AnswerRe: Printing without colour (or color) Pin
Manas Bhardwaj26-Jun-09 1:34
professionalManas Bhardwaj26-Jun-09 1:34 
GeneralRe: Printing without colour (or color) [modified] Pin
musefan26-Jun-09 1:47
musefan26-Jun-09 1:47 
QuestionHow to determine the keypress/mouse click is human action or simulation? Pin
alien viper26-Jun-09 0:08
alien viper26-Jun-09 0:08 
AnswerRe: How to determine the keypress/mouse click is human action or simulation? Pin
Christian Graus26-Jun-09 0:13
protectorChristian Graus26-Jun-09 0:13 
AnswerRe: How to determine the keypress/mouse click is human action or simulation? Pin
mutpan26-Jun-09 1:08
mutpan26-Jun-09 1:08 
GeneralRe: How to determine the keypress/mouse click is human action or simulation? Pin
Rajesh R Subramanian26-Jun-09 1:18
professionalRajesh R Subramanian26-Jun-09 1:18 
AnswerRe: How to determine the keypress/mouse click is human action or simulation? Pin
Rajesh R Subramanian26-Jun-09 1:19
professionalRajesh R Subramanian26-Jun-09 1:19 
AnswerRe: How to determine the keypress/mouse click is human action or simulation? Pin
molesworth26-Jun-09 3:03
molesworth26-Jun-09 3:03 
GeneralRe: How to determine the keypress/mouse click is human action or simulation? Pin
alien viper26-Jun-09 3:35
alien viper26-Jun-09 3:35 
AnswerRe: How to determine the keypress/mouse click is human action or simulation? Pin
Dan Neely26-Jun-09 4:00
Dan Neely26-Jun-09 4:00 
QuestionProblem with Windows Mobile and image scaling Pin
mrmckeb25-Jun-09 23:25
mrmckeb25-Jun-09 23:25 
QuestionBorder color of Textbox not working Pin
mutpan25-Jun-09 22:48
mutpan25-Jun-09 22:48 
AnswerRe: Border color of Textbox not working Pin
J4amieC25-Jun-09 23:42
J4amieC25-Jun-09 23:42 
GeneralRe: Border color of Textbox not working Pin
mutpan26-Jun-09 1:00
mutpan26-Jun-09 1:00 
GeneralRe: Border color of Textbox not working Pin
J4amieC26-Jun-09 1:16
J4amieC26-Jun-09 1:16 
GeneralRe: Border color of Textbox not working Pin
DaveyM6926-Jun-09 1:05
professionalDaveyM6926-Jun-09 1:05 
GeneralRe: Border color of Textbox not working Pin
J4amieC26-Jun-09 1:15
J4amieC26-Jun-09 1:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.