473,585 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Graphics.DrawIm age upside down? (rotate 180 degrees)

Hey All,

Is it possible to draw an image upside down?

I am using Microsofts example of "Printing a local report without
preview".

The only trick is that I want to flip the image upside down.

Reason: I need to guarantee that I print a barcode in the exact same
location (lower right side) no matter the paper size. So if I flip the
image upside down (rotate 180) then the upper left corner will be my
fixed point.

Thoughts?

~Gina_M~

Jul 25 '07 #1
5 6943
On Tue, 24 Jul 2007 17:37:48 -0700, Gina_Marano <gi*******@gmai l.com>
wrote:
Hey All,

Is it possible to draw an image upside down?
You may want to look at the Graphics.Transf orm property. You could create
a transformation matrix that supplies the appropriate rotation, as well as
moving the origin to the opposite corner of the page. Then everything you
draw would as if you had just rotated the whole page 180 degrees.

Of course, do this only with those things you want to be rotated.
Otherwise, you might as well just physically rotate the paper when it's
finished printing. :)

All that said:
[...]
The only trick is that I want to flip the image upside down.

Reason: I need to guarantee that I print a barcode in the exact same
location (lower right side) no matter the paper size. So if I flip the
image upside down (rotate 180) then the upper left corner will be my
fixed point.
IMHO, if all you care about is the _position_ of the barcode, then
flipping it upside down is way more effort than you need to make. It's
trivial to find the lower right corner, and then create your drawing
rectangle based on that and the actual size of your bitmap, and doesn't
require any fiddling around with the transformation for the Graphics
instance.

Pete
Jul 25 '07 #2
Gina_Marano wrote:
Hey All,

Is it possible to draw an image upside down?

I am using Microsofts example of "Printing a local report without
preview".

The only trick is that I want to flip the image upside down.

Reason: I need to guarantee that I print a barcode in the exact same
location (lower right side) no matter the paper size. So if I flip the
image upside down (rotate 180) then the upper left corner will be my
fixed point.

Thoughts?

~Gina_M~
FYI: A flip will not produce the same results as a 180 degree rotation.
It sounds like you want to make sure the bar code can be scanned from
the top left no matter which way up the paper is. If so then a 180
degree rotation will be the way to go as a flip will have the bar code
back to front.

It's a small difference but will make a large difference to your bar
code scanner.
Jul 25 '07 #3
FYI: A flip will not produce the same results as a 180 degree rotation.
It sounds like you want to make sure the bar code can be scanned from
the top left no matter which way up the paper is. If so then a 180
degree rotation will be the way to go as a flip will have the bar code
back to front.

It's a small difference but will make a large difference to your bar
code scanner.- Hide quoted text -

- Show quoted text -
Yes, rotating 180 degrees is what I meant. How would one do this?

Pete, the reason for the rotate is so I don't have to care about the
page length and width. I probably don't want to have to query the
printer to try and find out what size of paper is in tray 1... All I
care about is that the position of the barcode is in the same position
lower right hand corner of the paper regardless of papersize. Note: if
it where just the length that varies then I would just have to use a
report footer but after getting that working I realized that the width
could vary also.

Any ideas how one would rotate the image 180 degrees?

~Gina_M~

Jul 25 '07 #4
On Wed, 25 Jul 2007 06:33:47 -0700, Gina_Marano <gi*******@gmai l.com>
wrote:
Pete, the reason for the rotate is so I don't have to care about the
page length and width. I probably don't want to have to query the
printer to try and find out what size of paper is in tray 1
You get the page size in the PrintPageEventA rgs. There's no need to
"query the printer".
... All I
care about is that the position of the barcode is in the same position
lower right hand corner of the paper regardless of papersize.
Then look at the paper size in the PrintPageEventA rgs and position the
barcode according to the paper size. It's no different than, for example,
drawing a footer on a printed page or anchoring a user-interface element
to the right and/or bottom of a window.
Note: if
it where just the length that varies then I would just have to use a
report footer but after getting that working I realized that the width
could vary also.
I don't know what a "report footer" is, but if you have that as an option,
why doesn't the "report footer" offer support for specifying alignment?
As in, make the element you want to include in the footer right-aligned,
so that it always winds up flush against the right side of the footer?
Any ideas how one would rotate the image 180 degrees?
Yes. I posted that information in my first reply. There are other ways,
but what I already wrote is the most straightforward , IMHO.

Pete
Jul 25 '07 #5
You get the page size in the PrintPageEventA rgs. There's no need to
"query the printer".
Ahh, this is great!
Then look at the paper size in the PrintPageEventA rgs and position the
barcode according to the paper size. It's no different than, for example,
drawing a footer on a printed page or anchoring a user-interface element
to the right and/or bottom of a window.
Great!
I don't know what a "report footer" is, but if you have that as an option,
why doesn't the "report footer" offer support for specifying alignment?
As in, make the element you want to include in the footer right-aligned,
so that it always winds up flush against the right side of the footer?
That would be nice but I have used many report builders and none that
I know of allow that. :(
Yes. I posted that information in my first reply. There are other ways,
but what I already wrote is the most straightforward , IMHO.
Yes, I figured it out. I was rendering to EMF then trying to rotate.
WRONG!! Much easier to render to BMP then simple rotate. :) As I have
said often, I make things too hard sometimes.

Thanks for your help! I will go through it and probably post a follow
up. I am having problems just printing a normal report as landscape.
More details soon.

~Gina_M~

Aug 3 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3422
by: Otie | last post by:
I have a circle that displays information in 1-degree increments - there are 90 such increments that comprise the circle. I need a pointer within the circle that rotates. The pointer must include areas to the left and right of the center line so that a person is better able to see when something is within 2 or 3 or 4 or 5 marks (degrees) of...
8
12265
by: Mark Johnson | last post by:
Using: VS 2003 NET C# for Framework and Framework Compact Trying : Moving a Card (Bitmap) as in Solitare (PC + WinCe) Version on OnMouseMove Problem : The affected drawing Area by Invalidate (or Invalidate(Rectangle)) flickers in a nasty way when repainting. This does not happen in the Solitare (PC + WinCe) Versions a well as in a Card...
3
2570
by: Peter Oliphant | last post by:
I'm importing a jpeg via: Bitmap* image = new Bitmap( filename ) ; Then, using the Drawing::Graphics object, I execute DrawImage( image, x, y ). My problem is that the original image was 200x200, but it's drawing something smaller (something like 130x130, about 2/3 the original size). I am using transforms, but I've verified that scaling...
8
3305
by: Nathan Sokalski | last post by:
I am trying to write code to rotate a graphic that I have. Here is the code I am currently using: Dim frogbitmap As New Bitmap(Drawing.Image.FromFile(Server.MapPath("images/frog.gif"))) Dim froggraphic As Graphics = Graphics.FromImage(frogbitmap) froggraphic.RotateTransform(90) frogbitmap.Save(Server.MapPath("images/frog2.gif"),...
0
1277
by: Kwok | last post by:
Using html, I want to rotate the word upside down. When a user input a sentence, the sentence then will rotate 180degree. I use <div>, it can only rotate 90degree..... can anyone help me??
8
11018
by: lovecreatesbeauty | last post by:
I write a function to rotate a matrix by 90 degrees clockwise, this function works on a matrix of specific size, for example, it rotates a 4*4 matrix of integers in the following code. The function makes one more copy of the original matrix, how is the efficiency? Can the copy be saved? Comments on it are welcome. Can I extend it to work on...
1
1952
by: RC | last post by:
First, this is a SVG issue, not 100% of XML issue. But I can't find SVG group to post this. Since SVG is XML file, I post here hopefully someone know both SVG and XML can help. Here is my SVG lines line.blue {stroke:blue;stroke-width:3;} line.bluedash {stroke:blue;stroke-width:1;stroke-dasharray: 9,5;} <defs>
2
3327
by: drsmooth | last post by:
Hi, i have made several different things using a double buffer and a jframe before but never had this problem: if you look thrugh the code, you can see that i draw a whole bunch of stuff to the screen and sometimes, i get a frame or two of just blank jframe color public void draw() { BufferStrategy bf =...
0
1719
by: harryusa | last post by:
I am experimenting with the rotate function and so far I can't get my code to return anything but the URL of my script. Here it is: <?php // The file you are rotating $image = 'halloween.jpg'; //How many degrees you wish to rotate $degrees = 180;
0
7908
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7836
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5389
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3835
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1447
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1175
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.