收藏 分享(赏)

vb绘制矩形绕任意点旋转任意角度完整板.docx

上传人:myw993772 文档编号:6332787 上传时间:2019-04-07 格式:DOCX 页数:6 大小:90.65KB
下载 相关 举报
vb绘制矩形绕任意点旋转任意角度完整板.docx_第1页
第1页 / 共6页
vb绘制矩形绕任意点旋转任意角度完整板.docx_第2页
第2页 / 共6页
vb绘制矩形绕任意点旋转任意角度完整板.docx_第3页
第3页 / 共6页
vb绘制矩形绕任意点旋转任意角度完整板.docx_第4页
第4页 / 共6页
vb绘制矩形绕任意点旋转任意角度完整板.docx_第5页
第5页 / 共6页
点击查看更多>>
资源描述

1、本文档整理仅供上海理工大学计算机辅助设计课程作业参考和 VB 初学者学习(若只绕原点旋转 command4 函数下坐标变换只需要保存中间带三角函数的 8 个变幻赋值即可)经同学们反映,现改用 VB 编写,并附上前面板图,程序中包括完善容错,显得冗长,请同学们自行取舍By 飞云留客Private Sub Command1_Click()If Text1.Text = “ ThenLabel12.Caption = (“请输入坐标数值 x1“)ElseIf Not IsNumeric(Text1.Text) ThenLabel12.Caption = (“x1 输入的不是一个数字“)ElseIf

2、Val(Text1.Text) 50 Or Val(Text1.Text) 50 Or Val(Text2.Text) 50 Or Val(Text3.Text) 50 Or Val(Text4.Text) 50 Or Val(Text1.Text) 50 Or Val(Text2.Text) 50 Or Val(Text3.Text) 50 Or Val(Text4.Text) 50 Or Val(Text6.Text) 50 Or Val(Text7.Text) -50 ThenLabel12.Caption = (“y0 不在绘制范围“)Elsex1 = Text1.Texty1 = T

3、ext2.Textx2 = Text3.Texty2 = Text4.Texta1 = Text5.Texte = Text6.Textf = Text7.Textrota = a1 * 3.1415926 / 180x1 = x1 - ey1 = y1 - fx2 = x2 - ey2 = y2 - fx11 = x1 * Cos(rota) - y1 * Sin(rota)y11 = x1 * Sin(rota) + y1 * Cos(rota)x12 = x2 * Cos(rota) - y1 * Sin(rota)y12 = x2 * Sin(rota) + y1 * Cos(rota

4、)x22 = x2 * Cos(rota) - y2 * Sin(rota)y22 = x2 * Sin(rota) + y2 * Cos(rota)x21 = x1 * Cos(rota) - y2 * Sin(rota)y21 = x1 * Sin(rota) + y2 * Cos(rota)x11 = x11 + ey11 = y11 + fx12 = x12 + ey12 = y12 + fx22 = x22 + ey22 = y22 + fx21 = x21 + ey21 = y21 + fPicture1.Line (x11, y11)-(x12, y12)Picture1.Lin

5、e (x12, y12)-(x22, y22)Picture1.Line (x22, y22)-(x21, y21)Picture1.Line (x11, y11)-(x21, y21)End IfEnd IfEnd IfEnd IfEnd IfEnd IfEnd IfEnd IfEnd IfEnd IfEnd IfEnd IfEnd IfEnd IfEnd IfEnd IfEnd IfEnd IfEnd IfEnd IfEnd SubPrivate Sub Form_Load()Picture1.ScaleMode = 6Picture1.Height = 7000Picture1.Widt

6、h = 6000Picture1.Scale (-50, 50)-(50, -50)Picture1.Line (-50, 0)-(50, 0)Picture1.Line (0, 50)-(0, -50)Dim a As SingleDim a1 As SingleDim x1 As DoubleDim y1 As DoubleDim x2 As DoubleDim y2 As DoubleDim rota As DoubleDim x11 As DoubleDim y11 As DoubleDim x12 As DoubleDim y12 As DoubleDim x22 As DoubleDim y22 As DoubleDim x21 As DoubleDim y21 As DoubleDim e As DoubleDim f As DoubleEnd Sub

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 社会民生

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报