vb.net窗体停靠 vb中窗体是什么意思

vb.net在设计过程中,发现当窗口化的窗体最大化后,里面的组件不能被放大~~

这个问题,如有可能你应当先把大的控件停靠在窗体的某部分,其他的控件用form的resize事件触发控件宽高的数值或控件位置坐标的数值。例:

创新互联公司专注为客户提供全方位的互联网综合服务,包含不限于做网站、成都网站建设、祁县网络推广、小程序开发、祁县网络营销、祁县企业策划、祁县品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联公司为所有大学生创业者提供祁县建站搭建服务,24小时服务热线:028-86922220,官方网址:www.cdcxhl.com

Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize

Dim pLabel1, pTextBox1, pButton1 As New Point

pLabel1.X = CInt(Me.Width / 7)

pLabel1.Y = CInt(Me.Height / 8) + 4

pTextBox1.X = CInt(Me.Width / 5)

pTextBox1.Y = CInt(Me.Height / 8)

pButton1.X = CInt(Me.Width / 3)

pButton1.Y = CInt(Me.Height / 8) - 1

Me.Label1.Location = pLabel1

Me.TextBox1.Location = pTextBox1

Me.Button1.Location = pButton1

End Sub

以上只是改变了控件的位置,如需改变控件的大小,重新定义计算控件的size属性

VB.NET的窗体是通过什么属性来控制在屏幕上的位置的?

.Top 和 .Left

.Top 是距离屏幕顶端的距离,也就是Y坐标

.Left 是距离屏幕左边的距离,也就是X坐标

例如

Private Sub Form_Load()

With Me

.Top = 0

.Left = 0

End With

End Sub

把自己的位置调到最左上角

vb.net窗体靠屏幕边缘触发事件

建立新的form,加入一个timer,interval设为100

Option Explicit

Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

Private Type POINTAPI

X As Long

Y As Long

End Type

Dim p As POINTAPI

Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Private Const HWND_TOPMOST = -1

Private Const SWP_NOMOVE = H2

Private Const SWP_NOSIZE = H1

Private Sub Form_Load()

SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE '加载窗口是指定窗口在最顶层

Timer1.Enabled = True

End Sub

Private Sub Timer1_Timer()

On Error Resume Next

GetCursorPos p

If Me.Top = 0 Then 'form1 is not hide and form1's top is 0

'hide form

If p.Y Me.Height / 15 + Me.Top / 15 Or p.X Me.Width / 15 + Me.Left / 15 Or p.X Me.Left / 15 Then 'mouse is not over form1

Me.Top = 0 - Me.Height + 50

End If

'show form

If p.X Me.Left / 15 And p.X Me.Left / 15 + Me.Width / 15 And p.Y 3 Then 'mouse is over form

Me.Top = 0

End If

End If

If Me.Left = 0 Then ''form1 is not hide form1's left is 0

'hide form

If p.Y Me.Height / 15 + Me.Top / 15 Or p.Y Me.Top / 15 Or p.X Me.Width / 15 + Me.Left / 15 Then 'mouse is not over form1

Me.Left = 0 - Me.Width + 50

End If

'show form

If p.X 3 And p.Y Me.Top / 15 And p.Y Me.Height / 15 + Me.Top / 15 Then 'mouse is over form

Me.Left = 0

End If

End If

If Me.Left = Screen.Width - Me.Width Then

'hide form

If p.Y Me.Height / 15 + Me.Top / 15 Or p.Y Me.Top / 15 Or p.X Me.Left / 15 Then 'mouse is not over form1

Me.Left = Screen.Width - 50

End If

'show form

If p.X Screen.Width / 15 - 3 And p.Y Me.Top / 15 And p.Y Me.Height / 15 + Me.Top / 15 Then 'mouse is over form

Me.Left = Screen.Width - Me.Width

End If

End If

End Sub

VB.NET怎么做永远停靠在屏幕上的东西

本质是一个不规则形状的窗体,把窗体的 TopMost 属性设为 True 即可。


网站名称:vb.net窗体停靠 vb中窗体是什么意思
文章地址:http://myzitong.com/article/ddopoee.html