vb.net自定义窗口 vbnet ui

如何给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.Length1 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.net/C#修改一个其他程序的窗口的边框样式?private const int GWL_STYLE = (-16);
private const int GWL_EXSTYLE = (-20);
private const uint WS_EX_LAYERED = 0x80000;
private const uint WS_EX_TRANSPARENT = 0x20;
private const uint WS_THICKFRAME = 262144;
private const uint WS_BORDER = 8388608;
/// summary使指定 「 see cref="IntPtr"/ 句柄」 窗体 边框样式变为无边框 。/summary
public static uint 无边框窗体(IntPtr 句柄) {
uint style = API_窗口.GetWindowLong(句柄, GWL_STYLE);
style = ~WS_BORDER;
style = ~WS_THICKFRAME;
return API_窗口.SetWindowLong(句柄, GWL_STYLE, style); ;
}
API窗口静态类
[DllImport("user32", EntryPoint = "SetWindowLong")]
public static extern uint SetWindowLong(IntPtr hwnd, int nIndex, uint dwNewLong);
[DllImport("user32", EntryPoint = "GetWindowLong")]
public static extern uint GetWindowLong(IntPtr hwnd, int nIndex);
修改窗口位置
/// summary
/// 设置窗体的位置和大小 。
/// /summary
/// param name="hWnd"/param
/// param name="hWndInsertAfter"用于标识在z-顺序的此 CWnd 对象之前的 CWnd 对象 。
/// para/para如果uFlags参数中设置了SWP_NOZORDER标记则本参数将被忽略 。可为下列值之一:
/// para/paraHWND_BOTTOM:值为1,将窗体置于Z序的底部 。如果参数hWnd标识了一个顶层窗体,则窗体失去顶级位置,并且被置在其他窗体的底部 。
/// para/paraHWND_NOTOPMOST:值为-2,将窗体置于所有非顶层窗体之上(即在所有顶层窗体之后) 。如果窗体已经是非顶层窗体则该标志不起作用 。
/// para/paraHWND_TOP:值为0,将窗体置于Z序的顶部 。
/// para/paraHWND_TOPMOST:值为-1,将窗体置于所有非顶层窗体之上 。即使窗体未被激活窗体也将保持顶级位置 。/param
/// param name="x"窗体新的x坐标 。如hwnd是一个子窗体 , 则x用父窗体的客户区坐标表示/param
/// param name="y"窗体新的y坐标 。如hwnd是一个子窗体,则y用父窗体的客户区坐标表示/param
/// param name="Width"指定新的窗体宽度/param
/// param name="Height"指定新的窗体高度/param
/// param name="wFlags"/param
/// returns/returns
[DllImport("user32.dll", CharSet = CharSet.Ansi, EntryPoint = "SetWindowPos")]
public static extern int SetWindowPos(IntPtr hWnd, hWndInsertAfter hWndInsertAfter, int x, int y, int Width, int Height, wFlags wFlags);
/// summary
/// 调整指定 「 see cref="IntPtr"/ 句柄」 窗体的位置和尺寸 。
/// /summary
/// param name="句柄"指定 「 see cref="IntPtr"/ 句柄」 窗体/param
/// param name="x"横坐标/param
/// param name="y"纵坐标/param
/// param name="w"宽/param
/// param name="h"高/param
public static int 调整窗体(IntPtr 句柄, int x, int y, int w, int h) {
return API_窗口.SetWindowPos(句柄, 0, x, y, w, h, wFlags.SWP_NOZORDER);
}
/// summary
/// 调整指定 「 see cref="IntPtr"/ 句柄」 窗体的位置 。
/// /summary
/// param name="句柄"指定 「 see cref="IntPtr"/ 句柄」 窗体/param
/// param name="x"横坐标/param
/// param name="y"纵坐标/param
public static int 调整窗体位置(IntPtr 句柄, int x, int y) {
return API_窗口.SetWindowPos(句柄, 0, x, y, 0, 0, wFlags.SWP_NOSIZE | wFlags.SWP_NOZORDER);
}
如何创建vb.net窗体dim 一个窗体 as new form
with 一个窗体
.location=...
.size=...'这里是设置窗体的位置等属性
end with
一个窗体.show
【vb.net自定义窗口 vbnet ui】vb.net自定义窗口的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vbnet ui、vb.net自定义窗口的信息别忘了在本站进行查找喔 。

    推荐阅读