vb.net图片加水印 net 图片加水印( 二 )

CLSIDFromString StrPtr("{1D5BE4B5-FA4A-452D-9CDD-5DB35105E7EB}"), .GUID
.NumberOfValues = 1
.type = 4
.Value = https://www.04ip.com/post/VarPtr(quality)
End With
'保存图像
lRes = GdipSaveImageToFile(lBitmap, StrPtr(fileName), tJpgEncoder, tParams)
'销毁GDI+图像
GdipDisposeImage lBitmap
End If
'销毁 GDI+
GdiplusShutdown lGDIP
End If
If lRes Then
PictureBoxSaveJPG = False
Else
PictureBoxSaveJPG = True
End If
End Function
4)使用以下代码实现将加好文字水印图片保存为jpg格式图片 。
Private Sub Command3_Click() '保存为.jpg图片
' 设置“CancelError”为 True
CommonDialog1.CancelError = True
On Error GoTo ErrHandler
' 设置标志
CommonDialog1.Flags = cdlOFNHideReadOnly
' 设置过滤器
CommonDialog1.Filter = "JPEG Files""(*.jpg)|*.jpg"
' 指定缺省的过滤器
CommonDialog1.FilterIndex = 2
' 显示“打开”对话框
CommonDialog1.ShowSave
' 显示选定文件的名字
'MsgBox CommonDialog1.fileName
Set Picture2.Picture = Picture1.Image '转移Picture1所绘图为Picture2.Picture赋值
Dim ret As Boolean
ret = PictureBoxSaveJPG(Picture2, CommonDialog1.fileName) '保存压缩后的图片
If ret = False Then
MsgBox "保存失败"
End If
Exit Sub
ErrHandler:
' 用户按了“取消”按钮
Exit Sub
End Sub
谁有VB 给图片加水印的源文件或代码Private Sub Command1_Click()
AddTxtToPicAndSave Picture1, "文字水印", 100, 200, "c:\1.bmp", 0
End Sub
Private Sub AddTxtToPicAndSave(Picture As PictureBox, strText As String, x As Long, y As Long, SFile As String, SaveType As Integer)
With Picture
.AutoRedraw = True
.CurrentX = x
.CurrentY = y
.Font = "黑体"
.FontBold = True
.ForeColor = vbRed
.FontSize = 22
Picture.Print strText
Select Case SaveType
Case 0'BMP
SavePicture .Image, SFile
Case 1
'需要第三方控件来保存为其它图像格式
End Select
关于vb.net图片加水印和net 图片加水印的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

推荐阅读