vb.net - VB graphics from image file shows bigger than it's original size -
i have in vb.net :
public class form1 dim output new bitmap(300, 300) dim gfx graphics = graphics.fromimage(output) sub refreshscreen() handles timer1.tick gfx.drawimage(image.fromfile("wheel.png"), new point(50, 50)) gfx.fillrectangle(brushes.blue, 100, 100, 25, 25) 'some other drawings on top picturebox1.image = output end sub end class
the problem "wheel.png" shows bigger in picturebox1 it's original resolution , scaled , blurred. how can fix ?
change line :
gfx.drawimage(image.fromfile("wheel.png"), new point(50, 50))
by :
gfx.drawimage(image.fromfile("wheel.png"), new rectangle(0, 0, 225, 70))
a rectangle specify size, not worry weird scaling. have image in variable object, , accessing object .height , .width fix drawimage issue.
Comments
Post a Comment