TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
hamid sherkat masoum
NA
1
2.9k
910122 - DrawImage weird behavior
Apr 11 2012 7:06 AM
in a form application with a picture box fitting within the form with the following handler for the picture box's Paint:
void f9(Graphics g)
{
var img = new Bitmap(3, 2);
var memG = Graphics.FromImage(img);
memG.FillRectangle(new SolidBrush(Color.Black), 0, 0, img.Width, img.Height);
GlobalFunctions.PutPixel(memG, new Pen(Color.Red), 1, 0);
GlobalFunctions.PutPixel(memG, new Pen(Color.Blue), 0, 1);
GlobalFunctions.PutPixel(memG, new Pen(Color.GreenYellow), 2, 0);
GlobalFunctions.PutPixel(memG, new Pen(Color.Cyan), 2, 1);
var srcRect = new Rectangle(0, 0, img.Width, img.Height);
int factor = 100;
var destRect = new Rectangle(0, 0, img.Width * factor, img.Height * factor);
g.FillRectangle(new SolidBrush(Color.DarkCyan), pictureBox1.ClientRectangle);
g.DrawRectangle(new Pen(Color.Blue), destRect);
g.DrawImage(img, destRect, srcRect, GraphicsUnit.Pixel);
}
i get the following output:
why? i expect this to be the result of drawing an image which is 4x3 instead of 3x2 which its 3 right points and 4 bottom points be of color dark blue. got what i mean?
is there any description for this behavior of DrawImage?
Reply
Answers (
0
)
Remove or set white back groung for Jpg image
Help required drawing dotted path lines, with even dots along the path line