用这个选择 picture1内裁剪后的图形,该用哪个API移动到picture2内呢?

cxy5636917 2015-01-02 08:01:23
SelectClipRgn .hdc, hRgn 用这个选择 picture1内裁剪后的图形,该用哪个API移动到picture2内呢?

我用建立多边形的方法选定picture1内的部分,可是如何移动到picture2内呢?

如下图:







...全文
527 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
cxy5636917 2015-01-07
  • 打赏
  • 举报
回复
看来结贴结早了。有问题还得继续啊。
wy24789 2015-01-05
  • 打赏
  • 举报
回复
SelectClipRgn picture2.hdc, hRgn BitBlt Picture2.hdc, 0, 0, w, h, Picture1.hdc, 0, 0, SRCCOPY
cxy5636917 2015-01-05
  • 打赏
  • 举报
回复
右边的为picture3,带图片。内部黑色的为picture2,黑色背景。用于盛放截取的多边形图。这样就可以实现抠图和贴图的功能了。
cxy5636917 2015-01-05
  • 打赏
  • 举报
回复
谢谢各位了。实际上在picture2内再设置一个多边形

Dim r As Rect
GetRgnBox newcliprgn, r

hRgn = CreatePolygonRgn(ap(0), n, 1)
SetWindowRgn Picture2.hwnd, hRgn, True
SelectClipRgn Picture2.hdc, hRgn
BitBlt Picture2.hdc, 0, 0, r.Right - r.Left, r.Bottom - r.Top, Picture1.hdc, 0, 0, SRCCOPY



赵4老师 2015-01-05
  • 打赏
  • 举报
回复
PaintPicture 方法 用以在 Form, PictureBox 或 Printer 上绘制图形文件(.bmp、.wmf、.emf、.cur、.ico或 .dib)的内容。不支持命名参数。 语法 object.PaintPicture picture, x1, y1, width1, height1, x2, y2, width2, height2, opcode
一如既往哈 2015-01-04
  • 打赏
  • 举报
回复
分数有点少............
cxy5636917 2015-01-04
  • 打赏
  • 举报
回复
谢谢of123 还是不行。 这是我程序的关键代码: Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) Picture1.PSet (x, y) ReDim Preserve ap(n) ap(n).x = x ap(n).y = y n = n + 1 End Sub Private Sub Form_Load() Picture1.ForeColor = vbRed '这两行没必要放在mousemove中 Picture1.DrawWidth = 5 End Sub Private Sub Command1_Click() With Picture1 W = .Width / 15 H = .Height / 15 .BackColor = vbBlack hRgn = CreatePolygonRgn(ap(0), n, 1) SetWindowRgn .hwnd, hRgn, True '将图片框Pic裁剪为圆角矩形 SelectClipRgn .hdc, hRgn .BackColor = vbBlack End With end sub 其它不值一提,请您再看看。
of123 2015-01-04
  • 打赏
  • 举报
回复
试试: Picture1.SetFocus Picture2.AutoRedraw = True rv = SendMessage(Picture1.hwnd, WM_PAINT, Picture2.hDC, 0) rv = SendMessage(Picture1.hwnd, WM_PRINT, Picture2.hDC, PRF_CHILDREN + PRF_CLIENT + PRF_OWNED) Picture2.Picture = Picture2.Image Picture2.AutoRedraw = False
cxy5636917 2015-01-02
  • 打赏
  • 举报
回复
如:windows系统自带的画图内那样,选定一部分,进行移动,翻转等。
cxy5636917 2015-01-02
  • 打赏
  • 举报
回复
也就是所谓的抠图的啦。 区域已经选定,可是如何扣除来,放到另一个picture内,并且可以移动它呢? 目前用到的主要是这三个api Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As POINTAPI, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long Private Declare Function SelectClipRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long) As Long Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long

809

社区成员

发帖
与我相关
我的任务
社区描述
VB 多媒体
社区管理员
  • 多媒体
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧