日期:2014-05-20  浏览次数:20936 次

关于窗体中图片拉伸的问题
我现在要做一个类似与《金山词霸2006》风格的窗体,请问怎样才能使图片的一部分保持不变其他的部分随着窗体的伸缩而不会产生变形?就像《金山词霸2006》中工具栏的右边按钮部分不会缩放,谢谢

------解决方案--------------------
是一个图的话肯定就不行
楼主考虑用一下PANEL控件
能达到你的要求
------解决方案--------------------
两张图吧
------解决方案--------------------
两张图合一块,一部分可拉伸,一部分固定
------解决方案--------------------
可以绘制两次.
private void drawImage2(Image img, int x, int y,int upHeight, int downHeight){
Rectangle ImgUpRect = new Rectangle (0,0, img.Width,upHeight);
Rectangle ImgDownRect = new Rectangle (0,upHeight, img.Width,img.Height - upHeight);

Rectangle drawUpRect = new Rectangle (x,y, img.Width,upHeight);
Rectangle drawDownRect = new Rectangle (x,y+upHeight, img.Width,downHeight);

g.DrawImage(Img, drawUpRect, ImgUpRect, GraphicsUnit.Pixel);
g.DrawImage(Img, ImgDownRect , drawDownRect , GraphicsUnit.Pixel);
}