473,396 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Gragphics.DrawImage on a flipped Image

I need to draw to an image after it has been rotated, but if I draw
something before the rotation is done then DrawImage doesn't work:

Here's the code.

using System;
using System.Drawing;

class ImageTest
{
public static void Main()
{
Image img = new Bitmap(67,98);
Graphics g = Graphics.FromImage(img);

//Without this line it works
g.DrawLine(new Pen(Color.Black), 0, 0, 67, 98);

//Width e Height are swapped
img.RotateFlip(RotateFlipType.Rotate90FlipNone);

g = Graphics.FromImage(img);
Image img2 = new Bitmap("test.bmp");

//img.Width is 98
g.DrawImage(img2, 80, 0);
img.Save("result.bmp");
}
}

The result of the code above is only a diagonal line.
If the call to DrawLine is removed, test.bmp is drawn too.
Please help.
Nov 17 '05 #1
0 1159

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

Similar topics

3
by: Jeroen Ceuppens | last post by:
Hi, When i do this in my programma, in the contstructor of the form: g.DrawImage(i,new Rectangle(0,0,i.Width,i.Height),0,0,i.Width,i.Height,GraphicsUnit.Pixel); it doens't paint it ;( but if...
5
by: Frecklefoot | last post by:
I'm using DrawImage() to copy one image onto another, larger one. I'm using a DrawImage() overload to stretch the source image onto the destination. The problem is that when it draws the stretched...
1
by: Ajay | last post by:
Hello Guys, Iam working on a zoom in and out tool and here is the code iam using for it //Method for zooming in Bitmap bmpSource=new Bitmap(ImgBox.Image); Bitmap bmpZoomed=new...
3
by: DichkoSoft | last post by:
Dear All I don't know haw i resize inage in VB.NET I want load image with size 800x600 then rezize it to 80x60 pixels and save to a file. -- DichkoSoft
21
by: DraguVaso | last post by:
Hi, I have an inherited DataGrid, that does lots of extra stuff. For exemple drawing a backgroundimage in every cell. The problem is that it's taking too much time (using gdi+), so I want to do...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
4
by: John Swan | last post by:
Hello. I'm trying to create a simple program that amongst other things creates a thumbnail of an image (Bitmap) to a set size determined by the user in pixels? The problem is: All of the...
1
by: Hardy Wang | last post by:
Hi, I found a piece of code to add drop shadow to a photo like below, after I save the image, it is actually a BMP file even though I specify a JPG file extension (see...
10
by: byrd48 | last post by:
Hi, I haven't had much luck searching for guidance on the following challenge. I have a .NET app in which I would like to take multiple thumnail images and combine them into one flat image....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.