




全文预览已结束
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Windows 绘图 一 实验目的 一 实验目的 了解 windows 绘图的一般过程 增强对课本基本原理的理解 以 vc 为主 学习高级语言图形编程技术 二 实验过程 二 实验过程 该实验采用 visual basic 作为编程语言 首先根据 VB 的特性制定一下的整体思路 主要实现曲线 圆 点 直线等图形的绘制 利用鼠标的 mousemove mousedown mouseup 三个事件 分情况进行处理 以此实现对不同选项的响 应 界面如下 主要代码 Dim ljs As Integer 必须定义为全局 变量 Dim drawstate As Boolean 定义画笔状态 左键按下为有效 Dim prex As Single 坐标初始值 在左键按下后记录 Dim prey As Single 坐标初始值 在左键按下后记录 Private Sub Combo1 Change Picture1 DrawWidth Val Combo1 End Sub Private Sub Command1 Click ljs 1 Label4 Caption 温馨提示 请拖动鼠标左 键绘制曲线 右键单击取消该操作 line End Sub Private Sub Command2 Click ljs 2 Label4 Caption 温馨提示 单击鼠标左键 确定圆心 拖动直至松开鼠标左键 右键 单击取消该操作 circle End Sub Private Sub Command3 Click ljs 3 Label4 Caption 温馨提示 单击鼠标左键 即可 point End Sub Private Sub Command4 Click ljs 4 line Label4 Caption 温馨提示 按住鼠标左键 拖动直至松开鼠标左键 End Sub Private Sub Command5 Click Form2 Show Form1 Visible True End Sub Private Sub Command6 Click ljs 6 Label4 Caption 注记 输入文字后 按鼠 标左键确定位置 Char InputBox 请输入注记文字 注记 surveying End Sub Private Sub Form Load Text1 Text2 Label4 Caption 欢迎使用本绘图程序 请 根据提示进行操作 End Sub 以下为三个鼠标事件 针对前面的选项依 次处理 Private Sub Picture1 MouseDown Button As Integer Shift As Integer X As Single Y As Single 分选项进行讨论 If ljs 1 Then If Button 1 Then Picture1 DrawWidth 1 drawstate True 此处做一个标记 prex X prey Y End If If Button 2 Then ljs 0 鼠标右键终止 当前画笔 End If End If If ljs 2 Then If Button 1 Then drawstate True 此处做一个标记 prex X prey Y End If If Button 2 Then ljs 0 鼠标右键终止 当前画笔 End If End If If ljs 3 Then If Button 1 Then Picture1 DrawWidth 5 drawwidth 是全 局属性 Picture1 PSet X Y End If If Button 2 Then ljs 0 End If End If If ljs 4 Then If Button 1 Then prex X prey Y End If End If End Sub Private Sub Picture1 MouseMove Button As Integer Shift As Integer X As Single Y As Single Text1 X Text2 Y 显示当前坐标 If ljs 1 Then If drawstate True Then Picture1 DrawWidth 1 Picture1 Line prex prey X Y 指定在 picture1 中操作 prex X prey Y End If End If End Sub Private Sub Picture1 MouseUp Button As Integer Shift As Integer X As Single Y As Single If ljs 1 Then If Button 1 Then drawstate False End If End If If ljs 2 Then Picture1 DrawWidth 1 Dim r As Single If Button 1 Then drawstate False End If r Sqr X prex X prex Y prey Y prey Picture1 Circle prex prey r End If If ljs 4 Then Picture1 DrawWidth 1 If Button 1 Then Picture1 Line prex prey X Y End If End If End Sub 签名代码 Private Sub Command1 Click Form2 Show Form3 Visible False End Sub Private Sub Command2 Click Dim i As Integer Picture1 Scale 0 0 31 31 For i 1 To 30 Picture1 Line i 0 i 41 Picture1 Line 0 i 31 i Next i Command3 Enabled True End Sub Private Sub Command3 Click Dim i As Integer Dim j As Integer Picture1 DrawWidth 1 For i 1 To 30 For j 1 To 30 Picture1 Circle i j 0 2 必须 指明对 picture 进行操作 默认是 form Next j Next i Command4 Enabled True End Sub Private Sub Command4 Click Label2 Caption 李继尚个人签名 Picture1 DrawWidth 5 可通过禁止 该按钮的使用防止字体过大 Dim i As Integer For i 2 To 9 Picture1 PSet i 3 vbBlue 点的 颜色 Next i For i 2 To 6 Picture1 PSet 6 i vbBlue Next i For i 4 To 8 Picture1 PSet i 6 vbBlue Next i Picture1 PSet 5 4 vbBlue Picture1 PSet 4 5 vbBlue Picture1 PSet 3 6 vbBlue Picture1 PSet 7 4 vbBlue Picture1 PSet 8 5 vbBlue Picture1 PSet 9 6 vbBlue Picture1 PSet 7 7 vbBlue For i 8 To 11 Picture1 PSet 6 i vbBlue Next i For i 3 To 9 Picture1 PSet i 9 vbBlue Next i For i 3 To 10 Picture1 PSet 14 i vbBlue Next i For i 11 To 13 Picture1 PSet i 6 vbBlue Next i Picture1 PSet 13 3 vbBlue Picture1 PSet 13 4 vbBlue For i 11 To 13 Picture1 PSet i 8 vbBlue Next i Picture1 PSet 12 7 vbBlue Picture1 PSet 12 9 vbBlue Picture1 PSet 11 10 vbBlue Picture1 PSet 12 5 vbBlue For i 15 To 19 Picture1 PSet i 6 vbBlue Next i For i 3 To 9 Picture1 PSet 17 i vbBlue Next i Picture1 PSet 15 4 vbBlue Picture1 PSet 16 5 vbBlue Picture1 PSet 19 4 vbBlue Picture1 PSet 18 5 vbBlue Picture1 PSet 16 7 vbBlue Picture1 PSet 15 8 vbBlue Picture1 PSet 18 7 vbBlue Picture1 PSet 19 8 vbBlue For i 14 To 19 Picture1 PSet i 10 vbBlue Next i For i 5 To 10 Picture1 PSet 23 i vbBlue Next i Picture1 PSet 24 4 vbBlue Picture1 PSet 23 3 vbBlue Picture1 PSet 26 4 vbBlue Picture1 PSet 27 3 vbBlue Picture1 PSet 23 5 vbBlue Picture1 PSet 23 10 vbBlue For i 5 To 10 Picture1 PSet 28 i vbBlue Next i Picture1 PSet 27 9 vbBlue For i 23 To 28 Picture1 PSet i 5 vbBlue Next i For i 2 To 5 Picture1 PSet 25 i vbBlue Next i Picture1 PSet 25 7 vbBlue Picture1 PSet 26 7 vbBlue Picture1 PSet 25 8 vbBlue Picture1 PSet 26 8 vbBlue End Sub Private Sub Form Load Text1 Text2 Command
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 交易安全保障措施-洞察及研究
- 建筑废木材回收项目可行性研究报告
- 健康管理服务平台在健康管理服务市场中的市场细分与竞争格局研究报告
- 2026届湖南省新课标语文高三第一学期期末经典试题
- 职业技术学校与企业共建职业技能鉴定所合作协议
- 韩国夫妻离婚程序中共同债务承担及清偿协议
- 2025年教师招聘之《小学教师招聘》练习试题【综合题】附答案详解
- 2025年肿瘤内科化疗药物不良反应处理答案及解析
- 2025年儿科重症监护护理常见问题处理考核答案及解析
- 2025年放射科CT影像学常见病变诊断答案及解析
- 2025年国家电网公司招聘岗位竞聘模拟题及答案
- 隧道施工应急预案与响应方案
- 2025年广播电视技术能手预选赛竞赛试题含答案
- 2025年健身教练专业技能测评考试试题及答案解析
- 2025年山东高考化学试题及答案
- 2025-2026北师大版二年级数学上册(全册)教案设计
- 环卫人员安全知识培训课件
- 诉讼业务培训课件
- 公司适用法律法规标准清单2025年08月更新
- 医院诊断证明书word模板
- 女性盆底解剖结构及功能
评论
0/150
提交评论