once you have resized your image, you will have to reset it's origin, for
example
private Bitmap m_Image;
private bool m_RedrawImage = false;
private int m_Top = 0;
private int m_Left = 0;
private void SetImageSizeDifference(int origWidth, int origHeight, bool zoom)
{
m_Left -= (m_Image.Width - origWidth);
m_Top -= (m_Image.Height - origHeight);
m_RedrawImage = true;
Refresh();
}
override public void OnPaint(object sender, PaintEventArgs e)
{
if(m_RedrawImage)
{
Graphics g = this.CreateGraphics();
g.DrawImage(m_Image, m_Left, m_Top);
m_RedrawImage = false;
}
}
--
Of all words of tongue and pen, the saddest are: "It might have been"
Bill.Richards @ greyskin .co .uk
http://greyskin.co.uk
"Diogo Alves - Software Developer" wrote:
Hi,
currently I am programming a control to zoom in/out images and move them
inside a frame, but when I zoom it keeps the upper left corner static making
the image growing to the lower-rigth direction... I would like to make the
the image fixed on the center of the frame expanding it to all the sides from
that point....
Guess that ou can figure out what I want (forgive my bad english)
I would like so code or tutorial if possible
Thanks in advance