要求是在程序上面放个图片做背景,并且随我的操作扩大缩小图片随着变。 
我做的话就是固定图片大小了,大家有什么好的办法找图像的坐标,我的可能麻烦了。
还一个附加问题就是怎么在一个程序上面找到一个我准备要在该地方放东西的坐标。

解决方案 »

  1.   

    使用GDI+绘制缩放图片使用Image::DrawImage函数
    Status DrawImage(IN Image* image,
                         IN const Point* destPoints,
                         IN INT count,
                         IN INT srcx,
                         IN INT srcy,
                         IN INT srcwidth,
                         IN INT srcheight,
                         IN Unit srcUnit,
                         IN const ImageAttributes* imageAttributes = NULL,
                         IN DrawImageAbort callback = NULL,
                         IN VOID* callbackData = NULL)
      

  2.   

    同意楼上,也可以用:StretchBlt()这个函数.
    BITMAP bmp;
    void Mypicture::OnPaint() 
    {
    CPaintDC dc(this); // device context for painting

    // TODO: Add your message handler code here
    CDC memdc;
    memdc.CreateCompatibleDC(&dc);
    memdc.SelectObject(&cbmp);
    CRect r;
    this->GetClientRect(&r);
    //获得位图参数
    long width,height;
    cbmp.GetBitmap(&bmp);
    width = bmp.bmWidth;
    height = bmp.bmHeight;
    dc.StretchBlt(0,0,r.Width(),r.Height(),&memdc,0,0,
    bmp.bmWidth,bmp.bmHeight,SRCCOPY);
    // Do not call CStatic::OnPaint() for painting messages
    }