【www.gdgbn.com--元旦图片】

" 水印文字

 " intdirection:图片位置:
 " 如果传进来的是数组 array(left,top):
 "  left 表示水印图片相对源图的左上角x方向距离
 "  top 表示水印图片相对源图的左上角y方向距离
 " 如果是单一数字:
 "  1:左上 2:上中 3:右上 4:左中 5:中中 6:右中 7:左下 8:中下 9:右下
 " intleft 表示水印文字相对源图的左上角x方向距离
 " inttop 表示水印文字相对源图的左上角y方向距离
 " strtext 水印文字
 public sub drawtext(intdirection,strtext)
  dim objjpeg2
  dim intwidth
  dim intheight
  dim intleft
  dim inttop
  
  message = ""
  if fileisopen then
   intwidth = intjpegwidth
   intheight = intjpegheight
   if intwidth     if not isarray(intdirection) then
     select case intdirection
     case 1
      intleft = 0
      inttop = 0
     case 2
      intleft = (width-intwidth)/2
      inttop = 0
     case 3
      intleft = width-intwidth
      inttop = 0
     case 4
      intleft = 0
      inttop  = (height-intheight)/2
     case 5
      intleft = (width-intwidth)/2
      inttop = (height-intheight)/2
     case 6
      intleft = width-intwidth
      inttop  = (height-intheight)/2
     case 7
      intleft = 0
      inttop  = height-intheight
     case 8
      intleft = (width-intwidth)/2
      inttop  = height-intheight
     case else
      intleft = width-intwidth
      inttop  = height-intheight
     end select
    else
     intleft = intdirection(0)
     inttop = intdirection(1)
    end if
    on error resume next
    with objjpeg.canvas
     .font.color  = intjpegcolor
     .font.family = strjpegfamily
     .font.bold   = flagjpegbold
     .font.size   = intjpegsize*2
     .print intleft,inttop,strtext
    end with
    if err then
     message = "打文字水印出错!"
    end if
   else
    message = "图片太小或水印区域过大!"
   end if
  else
   message = "文件没有打开!"
  end if
 end sub


 %>

本文来源:http://www.gdgbn.com/ps/27639/