VB能实现圆角矩形、椭圆形裁剪图片吗
如题,用VB来裁剪图片时,系统只默认为矩形裁剪,那如何才能做到圆角矩形裁剪,椭圆形裁剪呢?有什么可供直接使用的插件,或者模块,或者实现非方角矩形裁剪的思路是什么 ? VB?图片?裁剪
[解决办法]
Option Explicit
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Private Declare Function SelectClipRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long) As Long
Private Sub Command1_Click()
Dim pic As StdPicture
Set pic = LoadPicture("F:\Picture\Show\aa6.jpg")
SavePicture pic, "e:\1.bmp"
End Sub
Private Sub Form_Load()
Dim hRgn As Long
Dim W As Long, H As Long
With Picture1
W = .Width / 15
H = .Height / 15
hRgn = CreateRoundRectRgn(0, 0, W - 10, H - 10, 30, 30)
SelectClipRgn .hdc, hRgn
.Picture = LoadPicture("F:\Picture\Show\aa6.jpg")
End With
End Sub