可以在设计阶段,通过设置窗体的BorderStyle属性为0-None使窗体无边框。
曲阳ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为成都创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:13518219792(备注:SSL证书合作)期待与您的合作!
窗体的BorderStyle属性有如下取值:
0---None 无边框
1---Fixed Single 无最大/最小按钮,固定单边,运行时不能窗体改变大小
2---Sizeable 标准窗体,默认值
3---Fixed Dialog 固定对话框,没有最小化和最大化按钮,运行时不能窗体改变大小
4---Fixed ToolWindow 固定工具窗口,没有最小化和最大化按钮和控制菜单,不能改变大小尺寸的
5---Sizeable ToolWindow 可改变尺寸工具窗口,运行时可改变尺寸大小
设置窗体的text为空,设置窗体的controlbox属性为false,设置窗体的FormBorderStyle 属性为Sizable,就可以改变窗体大小了,并且可以在任务栏点击。
DllImport("user32.dll", ExactSpelling:=True) _
Private Shared Function SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, _
ByVal uFlags As UInteger) As Integer
End Function
Private Const GWL_STYLE As Integer = -16
Private Const GWL_EXSTYLE As Integer = -20
Private Const WS_BORDER As Integer = H800000
Private Const WS_EX_CLIENTEDGE As Integer = H200
Private Const SWP_NOSIZE As UInteger = H1
Private Const SWP_NOMOVE As UInteger = H2
Private Const SWP_NOZORDER As UInteger = H4
Private Const SWP_NOREDRAW As UInteger = H8
Private Const SWP_NOACTIVATE As UInteger = H10
Private Const SWP_FRAMECHANGED As UInteger = H20
Private Const SWP_SHOWWINDOW As UInteger = H40
Private Const SWP_HIDEWINDOW As UInteger = H80
Private Const SWP_NOCOPYBITS As UInteger = H100
Private Const SWP_NOOWNERZORDER As UInteger = H200
Private Const SWP_NOSENDCHANGING As UInteger = H400
Public Sub ChangeMdiClientBorderStyle(ByVal Value As System.Windows.Forms.BorderStyle, ByVal Handle As IntPtr)
Dim style As Integer = GetWindowLong(Handle, GWL_STYLE)
Dim exStyle As Integer = GetWindowLong(Handle, GWL_EXSTYLE)
' Add or remove style flags as necessary.
Select Case Value
Case BorderStyle.Fixed3D
exStyle = exStyle Or WS_EX_CLIENTEDGE
style = style And Not WS_BORDER
Exit Select
Case BorderStyle.FixedSingle
exStyle = exStyle And Not WS_EX_CLIENTEDGE
style = style Or WS_BORDER
Exit Select
Case BorderStyle.None
style = style And Not WS_BORDER
exStyle = exStyle And Not WS_EX_CLIENTEDGE
Exit Select
End Select
' Set the styles using Win32 calls
SetWindowLong(Handle, GWL_STYLE, style)
SetWindowLong(Handle, GWL_EXSTYLE, exStyle)
' Update the non-client area.
SetWindowPos(Handle, IntPtr.Zero, 0, 0, 0, 0, _
SWP_NOACTIVATE Or SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOZORDER Or SWP_NOOWNERZORDER Or SWP_FRAMECHANGED)
End Sub
''' summary
''' 获取MDIClient句柄
''' /summary
''' returns/returns
''' remarks/remarks
Private Function getMdiClientHandle() As IntPtr
Dim Obj As MdiClient = Nothing
Dim t As Type
For Each Item As Control In Me.Controls
t = Item.[GetType]()
If t.Name = "MdiClient" Then
Obj = DirectCast(Item, MdiClient)
Exit For
End If
Next
If Obj IsNot Nothing Then
Return Obj.Handle
Else
Return IntPtr.Zero
End If
End Function
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Me.IsMdiContainer Then
ChangeMdiClientBorderStyle(BorderStyle.None, getMdiClientHandle)
End If
End Sub
在属性窗口中把窗体的BorderStyle属性设为0即可(意思就是没有边框)
'窗体有个属性ClientSize 是除去边框及标题栏部分的为工作区
'你要的应该就是这个了。
'设置窗体工作区的大小 例为400*300
Me.ClientSize = New Size(400,300)