|
Hi,
I have a document that gets printed to a label printer via the PrintDocument class.
(Partial listing)
PrintDocument pd = new PrintDocument();
pd.DocumentName = "My document";
pd.PrintController = new StandardPrintController();
pd.BeginPrint += new PrintEventHandler(OnBeginPrint);
pd.PrintPage += new PrintPageEventHandler(onPrintPage);
pd.EndPrint += new PrintEventHandler(OnEndPrint);
pd.Print();
pd.Dispose();
My question:
Is there any method within the PrintDocument class that can reverse the printing for me. As I am sending to a label printer, it is important that the bottom of the label is presented first as it comes out of the printer.
-Regards,
David Bailey.
|
|
|
|
|
When you're printing, are you just using a Graphics object?
If so, then you can set the Graphics.Transform to be rotated by 180 degrees
|
|
|
|
|
Hi benjymous and thanks for your reply.
I have in my possession Charles Petzold's "Programming Microsoft Windows with C#" and did try a few things such as RotateTransform(180f) etc. Only some of the output swiveled like it should. Your comment at least helped me to work out why...
I am MOSTLY using a Graphics object to draw with. But I am also using a GetHdc() of that graphics object to draw some rich text via use of the RichTextBox. This output is remaining steadfast.
So is there anyway to rotate the output of a PrintDocument? Should I be using something else? Or will I have to rotate every individual element that I am trying to print?
Any help, suggestion or clue will be greatly received.
- David.
|
|
|
|
|
If you're stuck with the HDC stuff, you could just drawing everything to a bitmap first, then draw that bitmap to your final printer graphics object with the transform set.
|
|
|
|
|
How can i export .png images to an Excel sheet, is it possible only through some tools or can i do it with C#
|
|
|
|
|
What do you mean by 'code behind' ? This is not the ASP.NET forum. I assume it can be done with the Microsoft tools for Office, which expose Office to .NET code.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Is there any way to export Images to Excel using C#?
Could you please explain
|
|
|
|
|
Holy Moly. Did you read my reply ? What have you done to try to find the answer ? Have you searched the web ?
Funny how I search with google and find a ton of answers in seconds.
This[^] too hard for you ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
I want to created setup for C# windows application which should also install .net runtime incase not already installed of the users machine
Please adivce any url / links
Thanks in advance
|
|
|
|
|
ptr_Electron wrote: I want to created setup for C# windows application which should also install .net runtime incase not already installed of the users machine
While creating the setup,
1. In Solution Explorer > Right Click on Setup Project
2. Click on Properties
3. Property Page will come > Click on Prerequisites
4. Selcet the .NET Framework and also select the download or install option for that framework.
Hope this will help you
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
|
Google broken where you live ? Most setup packages support this.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
C# newb here. I've gone down the rabbit hole trying to find the answer myself, so I am asking here.
In my windows form, I want to prompt the user to enter an IP address. I made a popup dialog with a MaskedTextBox (mask was 990.990.990.990). This worked, but it required the user to fill in every character (even if he just had to press the arrow key or spacebar, that is kind of annoying).
I tried other masks (like 099.099.099.099), but nothing makes that annoyance go away.
So I decided to make 4 separate text boxes. This adds the ability to easily tab to the next octet, but it takes away the nice Copy/Paste ability to dump in an IP from the clipboard.
So I started looking for some kind of OnPaste event that I could handle and have it disburse pasted addresses automagically. There doesn't appear to be such an event.
I found several explanations of how to intercept Ctrl-V or Shift-Ins key combinations, but that is an incomplete solution; I want to catch all possible paste methods.
I was thinking about overriding the IsInputKey method somehow, but I don't know how to do that without creating a custom control (which just seems like massive overkill to me).
In Java, I could override the method at instantiation like so:
this.maskedTextBox1 = new System.Windows.Forms.MaskedTextBox() {
protected override bool IsInputKey(Keys AKeyData) {...}
};
But that doesn't seem to work in C#.
So what's the best way to accomplish what I want to do?
My other signature is a Porche.
|
|
|
|
|
You can still override functionality, you just need to do it as its own inherited class, rather than inline at instantiation.
|
|
|
|
|
Some of these[^] may interest you.
|
|
|
|
|
I appreciate the thought.
I already saw a couple of those, but I was hoping to avoid adding custom controls into my code.
Especially since it should be such a small change, dangit! Why does MS torment me so?
My other signature is a Porche.
|
|
|
|
|
Use keydown etc. events to filter out any bad characters, then in lost focus use IpAddress.TryParse(string). If that works IpAddress.Parse(string).
I don't know about your app, but you might also want to handle host names in the same box, which makes things a bit more complicated as well.
The true man wants two things: danger and play. For that reason he wants woman, as the most dangerous plaything.
|
|
|
|
|
As I said, I don't know how to do that without creating a custom control (i.e., inheriting the class). Doing that seems like over-working what should be a simple event handler.
As a one-off, that may be a necessary compromise. But it seems a bit like hard coding the text value for a button. Do it enough, and you lock yourself down.
If I do go the custom control route, should I override Paste functionality for four small textboxes, or should I override masking functionality for one big textbox?
Either way I really don't know the best functionality to override, so I'll have to pull my hair out all over again on that.
All I want is a super slick-input UI for IP addresses. Is that so much to ask for, Microsoft?
My other signature is a Porche.
|
|
|
|
|
Hi,
What is the fastest way to transfer a file from one system to another?
eg:
i have a server in listening mode, i send the image through socket to the server and from there to the destination system
or
upload to the ftp and download from there
Which is more effective and is there any other fast and better way?
Thankyou
YPKI
|
|
|
|
|
This is a dumb question. Obviously, the limitation is the network speed between machines. That, and, you're asking if it's faster to send a file directly, or send it twice.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
|
Did he not just say??
|
|
|
|
|
But that's okay, because you misunderstood his poorly worded question.
He appears to have 3 machines involved. The server is the midpoint, without which he cannot communicate to the end user PC.
He wants to know if using sockets is somehow faster/slower than FTP.
My other signature is a Porche.
|
|
|
|
|
Exactly
|
|
|
|
|
Hi,
What is the size limit of a byte[]?
Thankyou
YPKI
|
|
|
|