今天先把主要逻辑写出来,如果有时间就实现一个真正的截图工具。

 Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hSrcDC As Long, _
ByVal xSrc As Long, _
ByVal ySrc As Long, _
ByVal dwRop As Long) As Long
Private OnDraw As Boolean
Private OnDrag As Boolean
Private EndDraw As Boolean
Private LocalX As Single
Private LocalY As Single
Private DragX As Single
Private DragY As Single Private Sub Form_Load()
OnDraw = False
OnDrag = False
EndDraw = False Shape2().Width = *
Shape2().Height = *
For i = To
Call Load(Shape2(i))
Shape2(i).Width = *
Shape2(i).Height = *
Next Call ShowShape(False)
End Sub Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'drag the rect
If Button = vbLeftButton And EndDraw = True Then
If X > Shape1.Left And X < (Shape1.Left + Shape1.Width) And _
Y > Shape1.Top And Y < (Shape1.Top + Shape1.Height) Then
OnDrag = True
Me.MousePointer = vbSizeAll
DragX = X
DragY = Y
Exit Sub
End If
End If 'draw the rect
If Button = vbLeftButton And OnDraw = False Then
Me.MousePointer = vbCrosshair
LocalX = X
LocalY = Y
Shape1.Left = X
Shape1.Top = Y
Shape1.Width = *
Shape1.Height = *
Call MoveShape
Call ShowShape(False)
OnDraw = True
End If
End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'drag the rect
If Button = vbLeftButton And OnDrag = True Then
Shape1.Left = LocalX - (DragX - X)
Shape1.Top = LocalY - (DragY - Y)
Call MoveShape
Exit Sub
End If If Button = vbLeftButton And OnDraw = True Then
If X > LocalX Then
Shape1.Width = X - LocalX
Else
Shape1.Width = LocalX - X
Shape1.Left = LocalX - Shape1.Width
End If If Y > LocalY Then
Shape1.Height = Y - LocalY
Else
Shape1.Height = LocalY - Y
Shape1.Top = LocalY - Shape1.Height
End If Call MoveShape
Call ShowShape(True)
End If
End Sub Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
If OnDrag = True Then
OnDrag = False
LocalX = Shape1.Left
LocalY = Shape1.Top
End If
Me.MousePointer = vbDefault
Call DrawShape
OnDraw = False
EndDraw = True
ElseIf Button = vbRightButton Then
'RESET
Call ShowShape(False)
OnDraw = False
OnDrag = False
EndDraw = False
End If
End Sub Private Sub MoveShape()
Shape2().Left = Shape1.Left
Shape2().Top = Shape1.Top Shape2().Left = Shape1.Left + Shape1.Width / - ( * ) /
Shape2().Top = Shape1.Top Shape2().Left = Shape1.Left + Shape1.Width - ( * )
Shape2().Top = Shape1.Top Shape2().Left = Shape1.Left + Shape1.Width - ( * )
Shape2().Top = Shape1.Top + Shape1.Height / - ( * ) / Shape2().Left = Shape1.Left + Shape1.Width - ( * )
Shape2().Top = Shape1.Top + Shape1.Height - ( * ) Shape2().Left = Shape1.Left + Shape1.Width / - ( * ) /
Shape2().Top = Shape1.Top + Shape1.Height - ( * ) Shape2().Left = Shape1.Left
Shape2().Top = Shape1.Top + Shape1.Height - ( * ) Shape2().Left = Shape1.Left
Shape2().Top = Shape1.Top + Shape1.Height / - ( * ) /
End Sub Private Sub ShowShape(ByVal bool As Boolean)
Shape1.Visible = bool
For i = To
Shape2(i).Visible = bool
Next
DoEvents
End Sub Private Sub DrawShape()
Call ShowShape(False)
Call Picture1.Cls
Call BitBlt(Picture1.hDC, &, &, Shape1.Width / , Shape1.Height / , Me.hDC, Shape1.Left / , Shape1.Top / , vbSrcCopy)
Call ShowShape(True)
End Sub

贴张图:

VB6之截图的更多相关文章

  1. [置顶] VB6基本数据库应用(三):连接数据库与SQL语句的Select语句初步

    同系列的第三篇,上一篇在:http://blog.csdn.net/jiluoxingren/article/details/9455721 连接数据库与SQL语句的Select语句初步 ”前文再续, ...

  2. vb6 控件未注册问题解决

    打开项目时弹出如题错误. 另附一个帖子:http://bbs.csdn.net/topics/390580540,这个帖子讨论的不错,可以提供很多思路. 解决办法:http://rewwensoftw ...

  3. VS2010 开发 VB6.0 activeX控件 dll

    项目源码 https://download.csdn.net/download/csdn_z_s/10427764 开发环境 操作系统: win7 64位 旗舰版 Java语言开发环境:  Eclip ...

  4. 解决VB6.0中不能加载MSCOMCTL.OCX的错误提示

    VB6.0毕竟是很古老的开发工具了,其对所使用的第三方组件依赖性比较强,例如在打开从其它电脑上拿来的VB6.0的软件(系统)的工程文件(源代码)时,经常会遇到"不能加载MSCOMCTL.OC ...

  5. 通过adb方式给安卓手机截图的cmd批处理文件

    @echo off rem  通过adb方式截图rem  需要安装adb ,一般安装了android sdk 默认带了adb ,路径为sdk目录的android-sdk\platform-toolsr ...

  6. canvas与html5实现视频截图功能

    这段时间一直在研究canvas,突发奇想想做一个可以截屏视频的功能,然后把图片拉去做表情包,哈哈哈哈哈哈~~ 制作方法: 1.在页面中加载视频 在使用canvas制作这个截图功能时,首先必须保证页面上 ...

  7. 记:MySQL 5.7.3.0 安装 全程截图

    前言: 下一个班快讲MySQL数据库了,正好把服务器里面的MySQL卸了重装了一下. 截个图,作为笔记.也正好留给需要的朋友们. 目录: 下载软件 运行安装程序 安装程序欢迎界面 许可协议 查找更新 ...

  8. Atitit onvif 协议截图 getSnapshotUri 使用java

    Atitit onvif 协议截图 getSnapshotUri 使用java 1.1. ONVIF Device Test Tool1 1.2. 源码2 1.3. 直接浏览器访问http://192 ...

  9. 在Ubuntu|CentOS上安装Shutter截图工具及快捷键设置

    简介 Shutter前身叫GScrot,它是一款相当棒的截图软件. 通过Shutter,你可以截取包括选定区域.全屏幕.窗口.窗口内的控件甚至网页的图像.通过内置的强大插件机制,你可以在截图后,对图像 ...

随机推荐

  1. Java中 EvenQueue.invokeLater用法

    在Java中Swing是线程不安全的,是单线程的设计,这样的造成结果就是:只能从事件派发线程访问将要在屏幕上绘制的Swing组件.事件派发线程是调用paint和update等回调方法的线程,它还是事件 ...

  2. Nodejs基础:stream模块入门介绍与使用

    本文摘录自<Nodejs学习笔记>,更多章节及更新,请访问 github主页地址.欢迎加群交流,群号 197339705. 模块概览 nodejs的核心模块,基本上都是stream的的实例 ...

  3. 前端小课堂 js:函数的创建方式及区别

    js 函数的创建大体有这几种方式: -1-函数表达式(函数字面量): 说白了就是把一个函数赋值给了一个变量. var fun1 = function(index){ alert(index); } f ...

  4. 基于binlog来分析mysql的行记录修改情况(python脚本分析)

          最近写完mysql flashback,突然发现还有有这种使用场景:有些情况下,可能会统计在某个时间段内,MySQL修改了多少数据量?发生了多少事务?主要是哪些表格发生变动?变动的数量是怎 ...

  5. winfrom中将panel另存为图片

    private void button1_Click(object sender, EventArgs e)        {            Point ScrollMaxInfo = Get ...

  6. 【WPF】如何获取命令行参数

    应用程序以 Main 方法为入口点,如果为 Main 方法指定一个 string[] 类型的参数,在程序运行时,这个参数会获取到传递给应用程序的命令行参数. 而 WPF 应用程序比较特殊,因为在VS中 ...

  7. javascript基础-DOM原理

    解释清楚DOM原理并不是一件容易的事,但是任何一个前端工程师,都必须牢牢掌握它. DOM整体架构: 图解: DOM,即针对XML文档的应用程序编程接口(API).通俗一点说,HTML属于XML的一种, ...

  8. CORS协议与Spring注解的冲突

    众所周知,HTML5的CORS协议,支持各种request method,远胜于仅支持get方式的JSONP. 但今天,我用CORS协议,却一直不成功. 跨域异常,如图 POST http://10. ...

  9. 一天搞定CSS: overflow--14

    overflow:针对超出父级的内容如何显示 代码演示 <!DOCTYPE html> <html> <head> <meta charset="U ...

  10. maven 创建后报错

    <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId& ...