這個問題,如有可能你應當先把大的控件??吭诖绑w的某部分,其他的控件用form的resize事件觸發(fā)控件寬高的數值或控件位置坐標的數值。例:
創(chuàng)新互聯(lián)公司專注為客戶提供全方位的互聯(lián)網綜合服務,包含不限于做網站、成都網站建設、祁縣網絡推廣、小程序開發(fā)、祁縣網絡營銷、祁縣企業(yè)策劃、祁縣品牌公關、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運營等,從售前售中售后,我們都將竭誠為您服務,您的肯定,是我們最大的嘉獎;創(chuàng)新互聯(lián)公司為所有大學生創(chuàng)業(yè)者提供祁縣建站搭建服務,24小時服務熱線:028-86922220,官方網址:jinyejixie.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屬性
.Top 和 .Left
.Top 是距離屏幕頂端的距離,也就是Y坐標
.Left 是距離屏幕左邊的距離,也就是X坐標
例如
Private?Sub?Form_Load()
With?Me
.Top?=?0
.Left?=?0
End?With
End?Sub
把自己的位置調到最左上角
建立新的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
本質是一個不規(guī)則形狀的窗體,把窗體的 TopMost 屬性設為 True 即可。
網站欄目:vb.net窗體???vb中窗體是什么意思
URL網址:http://jinyejixie.com/article44/ddopoee.html
成都網站建設公司_創(chuàng)新互聯(lián),為您提供外貿建站、網站營銷、網頁設計公司、營銷型網站建設、品牌網站制作、小程序開發(fā)
聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)