Click here to Skip to main content
15,917,456 members
Home / Discussions / C#
   

C#

 
GeneralRe: "The given path's format is not supported." Pin
Mark J. Miller14-Apr-08 4:48
Mark J. Miller14-Apr-08 4:48 
GeneralRe: "The given path's format is not supported." Pin
J4amieC14-Apr-08 5:42
J4amieC14-Apr-08 5:42 
GeneralRe: "The given path's format is not supported." Pin
Mark J. Miller14-Apr-08 6:11
Mark J. Miller14-Apr-08 6:11 
GeneralRe: "The given path's format is not supported." Pin
J4amieC14-Apr-08 6:20
J4amieC14-Apr-08 6:20 
GeneralRe: "The given path's format is not supported." Pin
Mark J. Miller14-Apr-08 6:29
Mark J. Miller14-Apr-08 6:29 
GeneralRe: "The given path's format is not supported." Pin
PIEBALDconsult14-Apr-08 8:33
mvePIEBALDconsult14-Apr-08 8:33 
GeneralRe: "The given path's format is not supported." Pin
Luc Pattyn14-Apr-08 5:11
sitebuilderLuc Pattyn14-Apr-08 5:11 
QuestionHow to retrieve the printer's device context in C# ? Pin
Faysal14-Apr-08 4:03
Faysal14-Apr-08 4:03 
Hi,
I am working with C#. In my project I need to take printout of a form in report fashon. This form comprises of pictures, texts, graphs and other controls. So I have decided to take the print out from the screenshot of the form. For doing that I have used bitblt() function first. But the printing quality with that is really very poor. So I have decided to use stretchblt() function for getting a better quality.

Now I need to take the device context of the available printer first for using the stretchblt() function successfully. But the usual getprinterdc() function (supported in MFC) is not working in C#. So plz tell me how can I solve this problem. I am using the following code:

[System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")]<br />
public static extern int SetStretchBltMode(IntPtr hdcDest, int nStretchMode);<br />
[System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")]<br />
public static extern int StretchBlt(IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, int nWidthSrc, int nHeightSrc, System.Int32 dwRop);<br />
..<br />
..<br />
..<br />
private void CaptureScreen()<br />
{<br />
Graphics mygraphics = this.CreateGraphics();<br />
..<br />
..<br />
IntPtr dc1 = mygraphics.GetHdc(); //Source DC<br />
IntPtr dc2 = here I have to retrieve the available Printer DC as my destination DC //Target DC<br />
<br />
SetStretchBltMode(dc2, 4); //Here 4 is defined for HALFTONE<br />
StretchBlt(dc2, 0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height - 75, dc1, 0, 75, this.ClientRectangle.Width, this.ClientRectangle.Height, 13369376); //Here 13369376 is defined as SRCCOPY<br />
..<br />
..<br />
..<br />
//Saving in a memory stream<br />
memoryImage.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);<br />
}


Plz also let me know if u know any better solution of this problem

Thanks in advance
Faysal
GeneralRe: How to retrieve the printer's device context in C# ? Pin
Luc Pattyn14-Apr-08 7:41
sitebuilderLuc Pattyn14-Apr-08 7:41 
QuestionOpen new form Pin
Alessandra7714-Apr-08 3:37
Alessandra7714-Apr-08 3:37 
GeneralRe: Open new form Pin
A AntonySP14-Apr-08 3:40
A AntonySP14-Apr-08 3:40 
GeneralRe: Open new form Pin
Alessandra7714-Apr-08 3:43
Alessandra7714-Apr-08 3:43 
GeneralRe: Open new form Pin
Christian Graus14-Apr-08 3:46
protectorChristian Graus14-Apr-08 3:46 
GeneralRe: Open new form Pin
A AntonySP14-Apr-08 3:48
A AntonySP14-Apr-08 3:48 
GeneralRe: Open new form Pin
Alessandra7714-Apr-08 3:52
Alessandra7714-Apr-08 3:52 
GeneralRe: Open new form Pin
Christian Graus14-Apr-08 3:43
protectorChristian Graus14-Apr-08 3:43 
GeneralRe: Open new form Pin
Alessandra7714-Apr-08 3:46
Alessandra7714-Apr-08 3:46 
GeneralRe: Open new form Pin
Christian Graus14-Apr-08 3:55
protectorChristian Graus14-Apr-08 3:55 
AnswerRe: Open new form Pin
Pathetic Logic14-Apr-08 9:08
Pathetic Logic14-Apr-08 9:08 
Generalcolumn header text align in GridView Control Pin
A AntonySP14-Apr-08 3:37
A AntonySP14-Apr-08 3:37 
GeneralRe: column header text align in GridView Control Pin
Thomas Stockwell14-Apr-08 4:29
professionalThomas Stockwell14-Apr-08 4:29 
GeneralWindows Service class constructor and OnStart method Pin
George_George14-Apr-08 3:20
George_George14-Apr-08 3:20 
GeneralRe: Windows Service class constructor and OnStart method Pin
Mark J. Miller14-Apr-08 4:52
Mark J. Miller14-Apr-08 4:52 
GeneralRe: Windows Service class constructor and OnStart method Pin
George_George14-Apr-08 21:50
George_George14-Apr-08 21:50 
General.Net Profiler Pin
hatemtaleb14-Apr-08 3:05
hatemtaleb14-Apr-08 3:05 

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.