vb点虐 子窗体排序 vb窗体位置的代码
vb制作一个多窗体排序的功能
'修改如下:
成都创新互联公司长期为成百上千家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为赤峰企业提供专业的成都做网站、成都网站制作,赤峰网站改版等技术服务。拥有10年丰富建站经验和众多成功案例,为您定制开发。
Public Sub Sort(a() As Integer)
Dim n As Integer, t As Integer
n = UBound(a())
For i = 1 To n - 1
For j = i + 1 To n
If a(i) a(j) Then
t = a(i): a(i) = a(j): a(j) = t
End If
Next j
Next i
End Sub
Private Sub Form_Load()
Me.Show
'这里应该还有对a数组赋值的代码
Call Sort(a())
Dim i As Integer
For i = 0 To UBound(a())
Picture1.Print a(i)
Next i
End Sub
vb点虐 中如何把所有MDI子窗体的标题栏文字设置为 “子窗体i” (i 表示子窗体序号)?
增加一个模块
module mgrmdi
public mdifather as form=nothing
public mdison as integer=1
public sub OpenNewSon(byref SonForm as form)
___sonform.mdiparent=mdifather
___sonform.text=string.format("子窗体{0}",mdison.tostring)
___sonform.show
___mdison+=1
end module
在mdi父窗体启动时
sub form_load()
mdifather=me
end sub
加载子窗体使用
sub button1_click()
dim newform as new formson
OpenNewSon(newform)
end sub
如何给VB.NET窗体添加子窗体?
直接添加一个MID父窗体或在已有窗体的属性中找到IsMDIContainer属性,然后设置为True,然后创建第二个窗体 ,需要加载子窗体的时候:
Dim NewMDIChild As New Form2
NewMDIChild.MdiParent = Me
NewMDIChild.Show()
Public Shared Sub CheckMDIChildForm(ByVal MDIForm As Windows.Forms.Form, ByVal MDIChildForm As Windows.Forms.Form, ByVal MDIChildFormName As String)
If MDIForm.MdiChildren.Length 1 Then
'如果没有任何一个MDI子窗体,则创该MDI子窗体的窗体实例
Dim MDIChildFrm As Windows.Forms.Form = MDIChildForm ' 定义MDI子窗体
MDIChildFrm.MdiParent = MDIForm '指定父窗体
MDIChildFrm.Show() '打开窗体
Exit Sub
Else
Dim x As Integer
Dim frmyn As Boolean
For x = 0 To (MDIForm.MdiChildren.Length) - 1
Dim tempChild As Windows.Forms.Form = CType(MDIForm.MdiChildren(x), Windows.Forms.Form)
If tempChild.Name = MDIChildFormName Then
'检测到有该MDI子窗体,设为激活 并退出循环
frmyn = True
tempChild.BringToFront()
Exit For
Else
frmyn = False
End If
Next
If Not frmyn Then
'在打开的窗体中没检测到则新建
Dim MDIChildFrm As Windows.Forms.Form = MDIChildForm ' 定义MDI子窗体
MDIChildFrm.MdiParent = MDIForm '指定父窗体
MDIChildFrm.Show() '打开窗体
End If
End If
End Sub
标题名称:vb点虐 子窗体排序 vb窗体位置的代码
链接地址:http://azwzsj.com/article/ddchios.html