Click here to Skip to main content
15,920,602 members
Home / Discussions / C#
   

C#

 
GeneralRe: Dot-Matrix Printer Resolution Problem Pin
OriginalGriff16-May-11 22:29
mveOriginalGriff16-May-11 22:29 
GeneralRe: Dot-Matrix Printer Resolution Problem Pin
ismail2016-May-11 22:31
ismail2016-May-11 22:31 
GeneralRe: Dot-Matrix Printer Resolution Problem Pin
OriginalGriff16-May-11 22:40
mveOriginalGriff16-May-11 22:40 
GeneralRe: Dot-Matrix Printer Resolution Problem Pin
ismail2016-May-11 22:50
ismail2016-May-11 22:50 
GeneralRe: Dot-Matrix Printer Resolution Problem Pin
OriginalGriff16-May-11 23:04
mveOriginalGriff16-May-11 23:04 
GeneralRe: Dot-Matrix Printer Resolution Problem Pin
ismail2016-May-11 23:15
ismail2016-May-11 23:15 
AnswerRe: Dot-Matrix Printer Resolution Problem Pin
OriginalGriff16-May-11 23:33
mveOriginalGriff16-May-11 23:33 
AnswerRe: Dot-Matrix Printer Resolution Problem Pin
Luc Pattyn16-May-11 22:54
sitebuilderLuc Pattyn16-May-11 22:54 
As Griff said, this looks like a resolution problem (your printer has a higher DpiX, DpiY resolution than your screen), the best solution is to send the actual output elements (strings for text) to the printer.

The lazy way out is to send a bitmap at the right resolution. You can get the printer resolution from e.Graphics; you can get the screen resolution from:
Bitmap bm = new Bitmap(10,10);
Graphics g=Graphics.FromImage(bm);
int dpix=g.DpiX;


Therefore I would try this:
Bitmap bm = new Bitmap(10,10);
Graphics g=Graphics.FromImage(bm);
int dpix=g.DpiX;
int dpiy=g.DpiY;
bm.Dispose();
g=e.Graphics;
int w=this.Panel1.Width *g.DpiX/dpix;
int h=this.Panel1.Height*g.DpiY/dpiy;
bm = new Bitmap(w, h);
this.Panel1.DrawToBitmap(bm, new Rectangle(0, 0, w. h));
e.Graphics.DrawImageUnscaled(bm, 0, 0);
bm.Dispose();


Mind you, the bitmap will be larger than before, and printing will be slower. Printing the actual elements is the preferred way!

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

GeneralRe: Dot-Matrix Printer Resolution Problem Pin
ismail2016-May-11 23:08
ismail2016-May-11 23:08 
GeneralRe: Dot-Matrix Printer Resolution Problem Pin
Luc Pattyn16-May-11 23:15
sitebuilderLuc Pattyn16-May-11 23:15 
GeneralRe: Dot-Matrix Printer Resolution Problem Pin
ismail2016-May-11 23:20
ismail2016-May-11 23:20 
AnswerRe: Dot-Matrix Printer Resolution Problem Pin
Luc Pattyn16-May-11 23:43
sitebuilderLuc Pattyn16-May-11 23:43 
GeneralRe: Dot-Matrix Printer Resolution Problem Pin
ismail2016-May-11 23:56
ismail2016-May-11 23:56 
GeneralRe: Dot-Matrix Printer Resolution Problem Pin
Luc Pattyn17-May-11 0:18
sitebuilderLuc Pattyn17-May-11 0:18 
GeneralRe: Dot-Matrix Printer Resolution Problem Pin
ismail2017-May-11 0:36
ismail2017-May-11 0:36 
GeneralRe: Dot-Matrix Printer Resolution Problem Pin
Luc Pattyn17-May-11 0:57
sitebuilderLuc Pattyn17-May-11 0:57 
GeneralRe: Dot-Matrix Printer Resolution Problem Pin
ismail2017-May-11 1:00
ismail2017-May-11 1:00 
GeneralRe: Dot-Matrix Printer Resolution Problem Pin
Luc Pattyn17-May-11 1:05
sitebuilderLuc Pattyn17-May-11 1:05 
GeneralRe: Dot-Matrix Printer Resolution Problem Pin
ismail2017-May-11 1:11
ismail2017-May-11 1:11 
GeneralRe: Dot-Matrix Printer Resolution Problem Pin
ismail2017-May-11 1:29
ismail2017-May-11 1:29 
GeneralRe: Dot-Matrix Printer Resolution Problem Pin
ismail2017-May-11 2:08
ismail2017-May-11 2:08 
AnswerRe: Dot-Matrix Printer Resolution Problem Pin
Shameel17-May-11 4:15
professionalShameel17-May-11 4:15 
QuestionExport C# Windows Datagridview to excel Pin
sumit703416-May-11 19:09
sumit703416-May-11 19:09 
AnswerRe: Export C# Windows Datagridview to excel Pin
Ravi Sant16-May-11 23:13
Ravi Sant16-May-11 23:13 
AnswerRe: Export C# Windows Datagridview to excel Pin
ambarishtv17-May-11 0:37
ambarishtv17-May-11 0:37 

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.