Click here to Skip to main content
15,881,803 members
Home / Discussions / C#
   

C#

 
AnswerRe: Converting grid values to lower case for update Pin
Rutvik Dave25-Feb-09 8:36
professionalRutvik Dave25-Feb-09 8:36 
GeneralRe: Converting grid values to lower case for update Pin
alwaysgull25-Feb-09 11:18
alwaysgull25-Feb-09 11:18 
AnswerRe: Converting grid values to lower case for update Pin
Wendelius25-Feb-09 8:44
mentorWendelius25-Feb-09 8:44 
QuestionGet Recycle Bin icon Pin
Nitoc325-Feb-09 8:09
Nitoc325-Feb-09 8:09 
AnswerRe: Get Recycle Bin icon Pin
Giorgi Dalakishvili25-Feb-09 8:41
mentorGiorgi Dalakishvili25-Feb-09 8:41 
QuestionTableLayoutPanel Cell Pin
Muammar©25-Feb-09 7:37
Muammar©25-Feb-09 7:37 
AnswerRe: TableLayoutPanel Cell Pin
Rutvik Dave25-Feb-09 8:27
professionalRutvik Dave25-Feb-09 8:27 
QuestionDrawImageUnscaled not working Pin
Richard Blythe25-Feb-09 6:43
Richard Blythe25-Feb-09 6: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 8:24
sitebuilderLuc Pattyn25-Feb-09 8:24 
QuestionForm Key Down Even not activated? Pin
Muammar©25-Feb-09 6:36
Muammar©25-Feb-09 6:36 
AnswerRe: Form Key Down Even not activated? Pin
Richard Blythe25-Feb-09 6:44
Richard Blythe25-Feb-09 6:44 
AnswerRe: Form Key Down Even not activated? Pin
Muammar©25-Feb-09 6:48
Muammar©25-Feb-09 6:48 
Questionis there a better way to do [modified] Pin
netJP12L25-Feb-09 6:18
netJP12L25-Feb-09 6:18 
AnswerRe: is there a better way to do Pin
Richard Blythe25-Feb-09 6:50
Richard Blythe25-Feb-09 6:50 
AnswerRe: is there a better way to do Pin
Dan Neely25-Feb-09 7:07
Dan Neely25-Feb-09 7:07 
GeneralRe: is there a better way to do Pin
Richard Blythe25-Feb-09 7:16
Richard Blythe25-Feb-09 7:16 
GeneralRe: is there a better way to do Pin
Dan Neely25-Feb-09 7:54
Dan Neely25-Feb-09 7:54 
GeneralRe: is there a better way to do [modified] Pin
netJP12L25-Feb-09 8:02
netJP12L25-Feb-09 8:02 
QuestionFind Control on webform Pin
Terick25-Feb-09 5:12
Terick25-Feb-09 5:12 
AnswerRe: Find Control on webform Pin
J4amieC25-Feb-09 5:38
J4amieC25-Feb-09 5:38 
GeneralRe: Find Control on webform Pin
Terick25-Feb-09 6:03
Terick25-Feb-09 6:03 
GeneralRe: Find Control on webform Pin
Terick25-Feb-09 6:28
Terick25-Feb-09 6:28 
GeneralRe: Find Control on webform Pin
Rutvik Dave25-Feb-09 8:43
professionalRutvik Dave25-Feb-09 8:43 
GeneralRe: Find Control on webform Pin
Terick25-Feb-09 11:04
Terick25-Feb-09 11:04 
QuestionDatetimepicker Pin
cdpace25-Feb-09 5:00
cdpace25-Feb-09 5: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.