VB.NET改变无框窗体大小

2025-01-25 02:39:10
推荐回答(4个)
回答1:

改变大小用Me.Width和Me.Height就行了,楼主想问的是允许用户改变无边框窗体的大小吧?
Public Class Form1
Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongA" (ByVal hwnd As Int32, ByVal nIndex As Int32) As Int32
Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongA" (ByVal hwnd As Int32, ByVal nIndex As Int32, ByVal dwNewLong As Int32) As Int32
Private Const GWL_STYLE As Int32 = -16
Private Const WS_THICKFRAME As Int32 = &H40000

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
Dim style As Int32 = GetWindowLong(Me.Handle, GWL_STYLE) Or WS_THICKFRAME
SetWindowLong(Me.Handle, GWL_STYLE, style)
End Sub
End Class

回答2:

方法有两种:一:你可以在Fom1(默认)的属性框里找到 Size属性,改变里面的数字就OK了;
二,可以直接用鼠标在Form1窗体右下角拖动,即可调整大小。
若你要让调试后的窗体全屏,找到Form1的Windowstate属性改成Maximizd。
我的回答希望对你有帮助~

回答3:

改变无框窗体大小?改变Size属性不就行了吗?

回答4:

vb6与vb.net