-- 放在保存按钮后提示不对啊
Dim pic As WinForm.PictureBox = e.Form.Controls("PicView2")
Dim img As Image
e.Form.TimerEnabled = False
If pic.Image IsNot Nothing
Dim buffer() As Byte = Functions.Execute("GetImageToBytes",pic.Image)
Dim result As Integer = Functions.Execute("SaveBytesToFile",buffer,e.Form.Controls("FileName").Value)
If result = 1
Tables("初二会考系统").Current("相片") = Tables("初二会考系统").Current("学籍号") & ".JPG"
Tables("学籍表").Current("已拍照") = True
MessageBox.Show("照片保存为: " & e.Form.Controls("FileName").Value ,"保存成功")
Else
MessageBox.Show("保存失败","失败")
End If
Else
MessageBox.Show("请先拍照!","错误")
End If
e.Form.TimerEnabled = True
Dim file As String = "d:\\123.jpg"
Dim txt As String = "我是水印文字"
Dim img As image = getImage(file)
Dim bmp = new bitmap(img.Width, img.Height)
Dim g = graphics.fromimage(bmp)
g.DrawImage(img,0,0) \'绘制原图片\'
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality
Dim fnt As new Font("微软雅黑", 60, FontStyle.Bold) \'水印文字字体
Dim size = g.MeasureString(txt, fnt)
g.TranslateTransform((img.width-size.width)/2, img.Height - size.height - 50) \'设置文字的绘制起点
g.RotateTransform(-45) \'逆时针旋转45度
Dim semiTransBrush As new System.Drawing.SolidBrush(Color.FromArgb(120, 177, 171, 171)) \'水印文字颜色,120是透明度,范围0~255
g.DrawString(txt, fnt, semiTransBrush, new PointF(0,0))
bmp.save("E:\\问题\\shuiyin.jpg",img.RawFormat)
bmp.Dispose
semiTransBrush.Dispose
此主题相关图片如下:2345截图20210518100513.jpg