关于asp.net中 控制水印大小

来源:百度知道 编辑:UC知道 时间:2024/09/22 01:27:22
有哪位高手制作过水印,我制作的水印控制不了水印的大小只能控制水印的在图片中的右边距和底边距,在此感谢了~

你可以参考我的blog.
http://www.cnblogs.com/jackrebel/archive/2008/02/27/1083172.html

不懂可以问

添加水印的原理是绘制一个阴影图像,所以要在绘制这个图像指定宽高时设置大小,参考代码如下:
grWatermark.DrawImage(imgWatermark,
new Rectangle(xPosOfWm,yPosOfWm,wmWidth,wmHeight), //Set the detination Position
0, // x-coordinate of the portion of the source image to draw.
0, // y-coordinate of the portion of the source image to draw.
wmWidth, // Watermark Width
wmHeight, // Watermark Height
GraphicsUnit.Pixel, // Unit of measurment
imageAttributes); //ImageAttributes Object

看到wmWidth和wmHeight了吗,就是宽高的意思,就设置这里。你最好知道这些参数的意思,这样就知道在哪里设置宽高了。你并没有给出你的源代码,所以我也只能给你讲原理,并附带了示例,相信你可以解决问题的。Try again!