主题:急切求助:在运行程序时如何显示动态变化的数据?
xinying2005
[专家分:0] 发布于 2005-10-25 16:22:00
在程序运行时,要求label的旁边出现一类似菜单的提示,提示程序运行时很多变量的变化情况(要求分行排列这些变量及其变化情况即 变量1 变化情况
变量2 变化情况
变量3 变化情况
…… )。
回复列表 (共13个回复)
沙发
singleminded [专家分:490] 发布于 2005-10-25 18:06:00
System.Windows.Forms.Application.DoEvents
在程序中加入这句
例如:
如果你运行程序是个循环
do while ...
System.Windows.Forms.Application.DoEvents
loop
这样程序运行时,你就能点击label弹出菜单
板凳
xinying2005 [专家分:0] 发布于 2005-10-27 16:22:00
label 的菜单是怎么出来的?
3 楼
singleminded [专家分:490] 发布于 2005-10-27 16:30:00
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'加载菜单
ContextMenu1.MenuItems.Add("d")
ContextMenu1.MenuItems.Add("e")
'写上句,你点击右击菜单也就出来了,如果你菜单是动态加载上的
Label1.ContextMenu = ContextMenu1()
End Sub
4 楼
xinying2005 [专家分:0] 发布于 2005-10-27 16:43:00
d,e 是变量吗?
如果我调用的是函数,变量是函数得到的呢?(在label1。contextmenu中直接写变量就行)
5 楼
singleminded [专家分:490] 发布于 2005-10-27 16:48:00
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim a, b As String
a = "d"
b = "e"
ContextMenu1.MenuItems.Add(a)
ContextMenu1.MenuItems.Add(b)
Label1.ContextMenu = ContextMenu1()
End Sub
6 楼
singleminded [专家分:490] 发布于 2005-10-27 16:50:00
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim a, b As String
a = "d"
b = "e"
'调用过程
ContextMenu1.MenuItems.Add(fun)
ContextMenu1.MenuItems.Add(b)
Label1.ContextMenu = ContextMenu1()
End Sub
Private Function fun() As String
fun = "1"
End Function
7 楼
xinying2005 [专家分:0] 发布于 2005-10-27 16:56:00
如何实现分行显示不同变量?
8 楼
singleminded [专家分:490] 发布于 2005-10-27 16:58:00
ContextMenu1.MenuItems.Add(fun)
ContextMenu1.MenuItems.Add(b)
这个你也加任意多个呀
都是分行的呀
9 楼
xinying2005 [专家分:0] 发布于 2005-10-27 17:04:00
显示为: 变量名称 变量变化的情况。这样,举个例子来说,程序运行时,单击右键后,前面显示变量名称p,后面显示p所对应的函数。而且由于时刻在调用函数,p所对应的值一直在变化。要求p和它的变化值在同一行。谢谢
10 楼
xinying2005 [专家分:0] 发布于 2005-10-27 17:06:00
如何编程 才能使变量的值在动态变化
我来回复