| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 554 人关注过本帖
标题:两个Command不能分别输入代码
只看楼主 加入收藏
shylulu31415
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2011-5-14
结帖率:0
收藏
 问题点数:0 回复次数:3 
两个Command不能分别输入代码
我做了一个图片控件   想两个Command分别输入代码   显示两种东西    可是现在一个先弄好了   我在复制一个别的代码   粘贴到另一个    却不能显示    而且两个Command代码也变成一样的了
搜索更多相关主题的帖子: 东西 而且 
2011-05-14 09:19
missphoenix
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2011-5-13
收藏
得分:0 
能发下代码过来看下吗?不明白具体情况,可能是你的command_1和command_2事件没区分开来,因为你是全复制的就会发生这种情况
2011-05-15 11:35
shylulu31415
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2011-5-14
收藏
得分:0 
回复 2楼 missphoenix
好的
这是第一个
Dim t1, t2, t3, t4 As Double '定义两杆间的夹角
Dim l1, l2, l3, l4 As Long '定义各杆的长度
Dim xa As Double, ya As Double '
Dim xb As Double, yb As Double '
Dim xc As Double, yc As Double '
Dim xd As Double, yd As Double '定义各个绞支点的坐标

Const pi = 3.1415926 '定义一个常量来计算弧度


Public Sub Form_Load() '初始化杆一的位置
t1 = -90 * pi / 180
t2 = -90 * pi / 180
l1 = 95
l3 = 95
l4 = 50


End Sub

Private Sub Command1_Click()
Picture1.Scale (-200, 200)-(200, -200)
Timer1.Interval = 1
If Timer1.Enabled = True Then
Timer1.Enabled = False
Else:
Timer1.Enabled = True
End If
End Sub

Private Sub Timer1_Timer()

xaa = xa
yaa = ya
xbb = xb
ybb = yb
xcc = xc
ycc = yc
xdd = xd
ydd = yd

xa = 0
ya = 0

xb = l1 * Cos(t1)
yb = -l1 * Sin(t1)

xd = l4
yd = 0

xc = xd + l3 * Cos(t2)
yc = yd - l3 * Sin(t2)


t1 = t1 + pi / 180
t2 = t2 + pi / 180

Picture1.Cls
Picture1.DrawWidth = 10
'Picture1.Circle (xa, ya), 1, QBColor(4)
'Picture1.Circle (xb, yb), 1, QBColor(8)
'Picture1.Circle (xc, yc), 1, QBColor(13)
'Picture1.Circle (xd, yd), 1, QBColor(4)

Picture1.DrawWidth = 4
Picture1.Line (xa, ya)-(xb, yb), QBColor(1)
Picture1.Line (xb, yb)-(xc, yc), QBColor(4)
Picture1.Line (xc, yc)-(xd, yd), QBColor(8)
Picture1.Line (xd, yd)-(xa, ya), QBColor(13)


'在picture1中擦去上一点的连杆机构位置,并画出新的连杆机构的位置,视觉上感觉为动画



End Sub







这是第二个
Const pi = 3.14159

    Dim a

    Private Sub Command1_Click()



     Picture1.Cls

   

     Picture1.ScaleMode = 0

     Picture1.ScaleMode = 3

     Picture1.Scale (-10, 10)-(10, -10)


     Picture1.DrawWidth = 1



     Picture1.Line (-10, 0)-(10, 0), vbBlue

     Picture1.Line (9, 0.5)-(10, 0), vbBlue

     Picture1.Line -(9, -0.5), vbBlue

     Picture1.ForeColor = vbBlue

     Picture1.Print "X"



     Picture1.Line (0, 10)-(0, -10), vbBlue

     Picture1.Line (0.5, 9)-(0, 10), vbBlue

     Picture1.Line -(-0.5, 9), vbBlue

     Picture1.Print "Y"



     Picture1.CurrentX = 0.5

     Picture1.CurrentY = -0.5

     Picture1.Print "O"
     
     
      Picture1.CurrentX = 8.5

     Picture1.CurrentY = 2

     Picture1.Print "Φ(°)"
     
     
       Picture1.CurrentX = 0.8

     Picture1.CurrentY = 9.5

     Picture1.Print "rad/s"
     
     
     Picture1.Line (2, 0)-(2, 0.5), vbBlue
      Picture1.CurrentX = 2

     Picture1.CurrentY = -0.5

     Picture1.Print "90"
     
      
     Picture1.Line (4, 0)-(4, 0.5), vbBlue
      Picture1.CurrentX = 4

     Picture1.CurrentY = -0.5

     Picture1.Print "180"
     
      
     Picture1.Line (6, 0)-(6, 0.5), vbBlue
      Picture1.CurrentX = 6

     Picture1.CurrentY = -0.5

     Picture1.Print "270"
     
     


Picture1.Line (8, 0)-(8, 0.5), vbBlue
      Picture1.CurrentX = 8

     Picture1.CurrentY = -0.5

     Picture1.Print "360"

Picture1.Line (-2, 0)-(-2, 0.5), vbBlue
      Picture1.CurrentX = -2

     Picture1.CurrentY = -0.5

     Picture1.Print "-90"


Picture1.Line (-4, 0)-(-4, 0.5), vbBlue
      Picture1.CurrentX = -4

     Picture1.CurrentY = -0.5

     Picture1.Print "-180"
     
     Picture1.Line (-6, 0)-(-6, 0.5), vbBlue
      Picture1.CurrentX = -6

     Picture1.CurrentY = -0.5

     Picture1.Print "-270"

Picture1.Line (-8, 0)-(-8, 0.5), vbBlue
      Picture1.CurrentX = -8

     Picture1.CurrentY = -0.5

     Picture1.Print "-360"

Picture1.Line (0, pi)-(0.5, pi), vbBlue
      Picture1.CurrentX = -0.8

     Picture1.CurrentY = 3.4

     Picture1.Print "10"

Picture1.Line (0, -pi)-(0.5, -pi), vbBlue
      Picture1.CurrentX = -1#

     Picture1.CurrentY = -3#

     Picture1.Print "-10"





     Picture1.DrawWidth = 2


     For a = 0 To 2 * pi Step pi / 6000

     Picture1.PSet (a, pi / 2), vbYellow
     


     Next



     Picture1.CurrentX = 4

     Picture1.CurrentY = 2.8

     Picture1.ForeColor = vbBlack

     Picture1.Print "杆3角速度图"
     
     


    End Sub

2011-05-16 03:09
shylulu31415
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2011-5-14
收藏
得分:0 
回复 2楼 missphoenix
还有能帮忙做一个带有坐标轴   有坐标的的正弦曲线的程序代码吗
2011-05-16 03:10
快速回复:两个Command不能分别输入代码
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015573 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved