放分!! + .NET 窗口奇异特性(未完成,大家发挥一下吧!)
.NET 的IDE里面有很多窗口可以Dock的,或者说可以放在旁边而且占据子窗口工作区。不懂?自己试试运行一下这个例子就知道我说什么了。不过我没有完成,会有很多问题,但我觉得这些都是小问题,肯定可以解决的!
注意,本例子有三个文件组成!
'Module1.vb
Module Module1
Public frm1 As New fMain()
Public frm2 As New Mask001()
Sub main()
frm2.MdiParent = frm1
frm2.Show()
Application.Run(frm1)
End Sub
End Module
'Mask001.vb
Public Class Mask001
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
Me.TopLevel = False
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写处置以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意:以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Dock = System.Windows.Forms.DockStyle.Fill
Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(200, 93)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'Mask001
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(200, 93)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1})
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow
Me.Name = "Mask001"
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
Me.Text = "Form2"
Me.TopMost = True
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
frm1.Activate()
End Sub
End Class
'fMain.vb
Public Class fMain
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
FrmBtn.FormBorderStyle = FormBorderStyle.Sizable
FrmBtn.Visible = True
End Sub
'窗体重写处置以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意:以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.FrmBtn = New WindowsApplication1.Mask001()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.SuspendLayout()
'
'FrmBtn
'
Me.FrmBtn.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.FrmBtn.ClientSize = New System.Drawing.Size(108, 273)
Me.FrmBtn.Dock = System.Windows.Forms.DockStyle.Left
Me.FrmBtn.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Me.FrmBtn.MaximumSize = New System.Drawing.Size(0, 0)
Me.FrmBtn.MinimumSize = New System.Drawing.Size(0, 0)
Me.FrmBtn.Name = "FrmBtn"
Me.FrmBtn.ShowInTaskbar = False
Me.FrmBtn.StartPosition = System.Windows.Forms.FormStartPosition.Manual
Me.FrmBtn.Text = "Form2"
Me.FrmBtn.TopMost = True
'
'Label1
'
Me.Label1.BackColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(192, Byte), CType(128, Byte))
Me.Label1.Location = New System.Drawing.Point(80, 8)
Me.Label1.Name = "Label1"
Me.Label1.TabIndex = 3
Me.Label1.Text = "Label1"
'
'Label2
'
Me.Label2.Name = "Label2"
Me.Label2.TabIndex = 0
Me.Label2.Text = "Label2"
'
'fMain
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.FrmBtn, Me.Label2, Me.Label1})
Me.IsMdiContainer = True
Me.Name = "fMain"
Me.Text = "Form1"
Me.Visible = True
Me.ResumeLayout(False)
End Sub
#End Region
Friend WithEvents FrmBtn As Mask001
End Class
Sumtec宇宙技术中心 VB技术支持
本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利,并保持和微软所提供的条款一致。具体事项可参考微软公司的使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。
(因为比较紧急,没有制作自己的网页,敬请见谅。谢谢使用!)