Click here to Skip to main content
15,793,609 members
Home / Discussions / C#
   

C#

 
AnswerRe: Converting grid values to lower case for update Pin
Rutvik Dave25-Feb-09 9:36
professionalRutvik Dave25-Feb-09 9:36 
GeneralRe: Converting grid values to lower case for update Pin
alwaysgull25-Feb-09 12:18
alwaysgull25-Feb-09 12:18 
AnswerRe: Converting grid values to lower case for update Pin
Wendelius25-Feb-09 9:44
mentorWendelius25-Feb-09 9:44 
QuestionGet Recycle Bin icon Pin
Nitoc325-Feb-09 9:09
Nitoc325-Feb-09 9:09 
AnswerRe: Get Recycle Bin icon Pin
Giorgi Dalakishvili25-Feb-09 9:41
mentorGiorgi Dalakishvili25-Feb-09 9:41 
QuestionTableLayoutPanel Cell Pin
Muammar©25-Feb-09 8:37
Muammar©25-Feb-09 8:37 
AnswerRe: TableLayoutPanel Cell Pin
Rutvik Dave25-Feb-09 9:27
professionalRutvik Dave25-Feb-09 9:27 
QuestionDrawImageUnscaled not working Pin
Richard Blythe25-Feb-09 7:43
Richard Blythe25-Feb-09 7:43 
I'm designing a small vector graphics app. Right now I'm writing code for painting a shape as it's being moved. For move operations, the shape is painted to a bitmap buffer so refreshes can be more effecient. Everything is working fine except when the drawing surface is scaled (zoomed).

The scaling factor is applied to the Graphics object when a paint message is called. That scaling factor is also used to generate a scaled "move bitmap" for the shape. For example, if the physical size of the shape is: 100 x 100 and the scaling factor is 50% then the move bitmap will be 50 x 50. The bitmap is then drawn as unscaled.

The problem is that the DrawImageUnscaled() method is not working! I get the same scaled results as if I were calling the DrawImage() method. This is rendering the scaled "move bitmap" to an additionaly scaled size!

Has anyone experienced this before?

//Code sample

private void initMoveBitmap()
{
//if the scaling factor is .50 the GetScaledBounds will produce a 50x50 on a 100x100 size
Rectangle r = shape.GetScaledBounds();
bmpMove = new Bitmap(r.Width, r.Height);

System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(bmpMove);
gr.TranslateTransform(-r.X, -r.Y);
gr.ScaleTransform(scale, scale);
paint_move_bitmap(gr);
gr.Dispose();
gr = null;
}

public void PaintShape(Graphics g)
{
//scenario: the graphics object has a scaling factor of .50

if (bmpMove != null)
//produces no difference from the DrawImage() method
graphics.DrawImageUnscaled(bmpMove, pntBmpPos);
else
//paint the shape.. (code excluded)
}

My code this week has no errors. But it's Monday morning and I haven't got out of bed.

AnswerRe: DrawImageUnscaled not working Pin
Luc Pattyn25-Feb-09 9:24
sitebuilderLuc Pattyn25-Feb-09 9:24 
QuestionForm Key Down Even not activated? Pin
Muammar©25-Feb-09 7:36
Muammar©25-Feb-09 7:36 
AnswerRe: Form Key Down Even not activated? Pin
Richard Blythe25-Feb-09 7:44
Richard Blythe25-Feb-09 7:44 
AnswerRe: Form Key Down Even not activated? Pin
Muammar©25-Feb-09 7:48
Muammar©25-Feb-09 7:48 
Questionis there a better way to do [modified] Pin
netJP12L25-Feb-09 7:18
netJP12L25-Feb-09 7:18 
AnswerRe: is there a better way to do Pin
Richard Blythe25-Feb-09 7:50
Richard Blythe25-Feb-09 7:50 
AnswerRe: is there a better way to do Pin
Dan Neely25-Feb-09 8:07
Dan Neely25-Feb-09 8:07 
GeneralRe: is there a better way to do Pin
Richard Blythe25-Feb-09 8:16
Richard Blythe25-Feb-09 8:16 
GeneralRe: is there a better way to do Pin
Dan Neely25-Feb-09 8:54
Dan Neely25-Feb-09 8:54 
GeneralRe: is there a better way to do [modified] Pin
netJP12L25-Feb-09 9:02
netJP12L25-Feb-09 9:02 
QuestionFind Control on webform Pin
Terick25-Feb-09 6:12
Terick25-Feb-09 6:12 
AnswerRe: Find Control on webform Pin
J4amieC25-Feb-09 6:38
J4amieC25-Feb-09 6:38 
GeneralRe: Find Control on webform Pin
Terick25-Feb-09 7:03
Terick25-Feb-09 7:03 
GeneralRe: Find Control on webform Pin
Terick25-Feb-09 7:28
Terick25-Feb-09 7:28 
GeneralRe: Find Control on webform Pin
Rutvik Dave25-Feb-09 9:43
professionalRutvik Dave25-Feb-09 9:43 
GeneralRe: Find Control on webform Pin
Terick25-Feb-09 12:04
Terick25-Feb-09 12:04 
QuestionDatetimepicker Pin
cdpace25-Feb-09 6:00
cdpace25-Feb-09 6:00 

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.