真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

包含vbnet改自適應(yīng)的詞條

vb.net 怎樣將窗體和所有控件根據(jù)電腦分辨率固定?

使用SplitContainer1控件不就行了,SplitContainer1控件的Fixedpanel屬性設(shè)置為Panel1\x0d\x0aSplitContainer1的Panel2里面再放置一個(gè)SplitContainer2\x0d\x0aSplitContainer2控件的Fixedpanel屬性設(shè)置為Panel2\x0d\x0a二個(gè)SplitContainer設(shè)置為水平折為器方向\x0d\x0a至于播放器控件就放在SplitContainer2控件Panel1里面\x0d\x0a播放器控件DOCK設(shè)置為FILL\x0d\x0a\x0d\x0a這樣不管放大縮小界面,播放器控件總是自適應(yīng)窗體大小而菜單按鈕總是在最邊緣

創(chuàng)新互聯(lián)是專業(yè)的盤州網(wǎng)站建設(shè)公司,盤州接單;提供網(wǎng)站制作、成都做網(wǎng)站,網(wǎng)頁(yè)設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行盤州網(wǎng)站開發(fā)網(wǎng)頁(yè)制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!

vb.net 如何使得控件隨著窗體大小 的改變而改變呢,大家?guī)兔o想想,最好有代碼的哦

Public Class Form1

Dim 初始化控件自動(dòng)大小調(diào)整與窗口的寬度比例 As Integer

Dim 初始化控件自動(dòng)大小調(diào)整與窗口的高度比例 As Integer

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

初始化控件自動(dòng)大小調(diào)整與窗口的寬度比例 = Me.Width / 控件自動(dòng)大小調(diào)整.Width

初始化控件自動(dòng)大小調(diào)整與窗口的高度比例 = Me.Height / 控件自動(dòng)大小調(diào)整.Height

顯示控件的位置坐標(biāo)()

End Sub

Private Sub Form1_ResizeEnd(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ResizeEnd

' Form1_ResizeEnd? 這個(gè)事件是 窗口大小變化完成后 再進(jìn)行操作的

控件自動(dòng)大小調(diào)整.Location = New Point(控件自動(dòng)大小調(diào)整.Left, 控件自動(dòng)大小調(diào)整.Top)

'設(shè)置控件的初始左位置坐標(biāo)? 與? 上位置坐標(biāo)

控件自動(dòng)大小調(diào)整.Size = New Point(Int(Me.Width / 初始化控件自動(dòng)大小調(diào)整與窗口的寬度比例), Int(Me.Height / 初始化控件自動(dòng)大小調(diào)整與窗口的高度比例))

'更改控件的大小? 按第一次窗口的比例 進(jìn)行調(diào)整

顯示控件的位置坐標(biāo)()

End Sub

Private Sub 顯示控件的位置坐標(biāo)()

Label1.Text = "控件的上邊距坐標(biāo): " 控件自動(dòng)大小調(diào)整.Top

Label2.Text = "控件的左邊距坐標(biāo): " 控件自動(dòng)大小調(diào)整.Left

Label3.Text = "控件的寬度大小: " 控件自動(dòng)大小調(diào)整.Width

Label4.Text = "控件的高度大?。?" 控件自動(dòng)大小調(diào)整.Height

End Sub

End Class

還有好多方法? 慢慢研究吧兄弟 希望能幫到你

VB 窗體控件分辨率自適應(yīng)問題

Public Type CONTROLRECT Left As Single Top As Single Width As Single Height As SingleEnd Type Public Const HORZRES = 8Public Const VERTRES = 10Public Declare Function GetDesktopWindow Lib "user32" () As LongPublic Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As LongPublic Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As LongPublic Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long '取得界面原始控件的位置及大小,并保存到數(shù)組里Public Sub GetSourcePos(this As Object, rc() As CONTROLRECT, Optional bigFont As Boolean = True)

'On Error Resume Next

Dim tempX As Integer, tempY As IntegertempX = this.ScaleWidth '1024tempY = this.ScaleHeight '768 '此處原來如果在1024*768分辨率下顯示正常的話,就可以直接賦值1024和768 Dim temp As Control Dim nSum As Integer nSum = 0 For Each temp In this '此處要注意,有些控件沒有width,height等屬性,在此要做出判斷 If TypeOf temp Is ComboBox Then With rc(nSum) .Left = temp.Left / tempX .Width = temp.Width / tempX .Top = temp.Top / tempY End With ElseIf TypeOf temp Is Timer Then' 'none' ElseIf TypeOf temp Is StatusBar Then' 'none Else With rc(nSum) .Left = temp.Left / tempX .Width = temp.Width / tempX .Top = temp.Top / tempY .Height = temp.Height / tempY End With End If nSum = nSum + 1 NextEnd Sub '根據(jù)比例調(diào)整控件的大小Public Sub SetNewPos(this As Object, rc() As CONTROLRECT)

'On Error Resume Next Dim tempX As Integer, tempY As Integer tempX = this.ScaleWidth '1024 tempY = this.ScaleHeight '768 ' '如果初始界面顯示始終是以最大化的方式顯示的話,此處就可以調(diào)用系統(tǒng)分辨率進(jìn)行設(shè)置tempx,tempy' hwnd = GetDesktopWindow()' ' Get the device context for the desktop' hdc = GetWindowDC(hwnd)' If hdc Then' Dim a As Long, b As Long' a = GetDeviceCaps(hdc, HORZRES)' b = GetDeviceCaps(hdc, VERTRES)' tempX = a' tempY = b' End If' ReleaseDC hwnd, hdc Dim temp As Control '//用于取各種控件 Dim nSum As Integer nSum = 0 For Each temp In this '此處要注意,有些控件沒有width,height等屬性,在此要做出判斷 If TypeOf temp Is ComboBox Then temp.Left = rc(nSum).Left * tempX temp.Width = rc(nSum).Width * tempX temp.Top = rc(nSum).Top * tempY ElseIf TypeOf temp Is Timer Then 'none 'ElseIf TypeOf temp Is StatusBar Then 'none Else temp.Left = rc(nSum).Left * tempX temp.Width = rc(nSum).Width * tempX temp.Top = rc(nSum).Top * tempY temp.Height = rc(nSum).Height * tempY End If nSum = nSum + 1 Next End Sub

VB窗體控件自動(dòng)適應(yīng)窗體大小

Dim?f_size(1)?As?Long,?fist_re?As?Boolean??'用來存放窗體默認(rèn)大小?以及?是否第一次初始化,全局變量,可在?模塊中public聲明

Private?Sub?Form_Resize()

If?Me.WindowState??1?Then?'必須排除最小化的狀態(tài)

If?fist_re?=?False?Then?'窗體初始化只記錄窗體大小

f_size(0)?=?Me.Height:?f_size(1)?=?Me.Width

fist_re?=?True

Else?'否則開始適應(yīng)屏幕變化

For?Each?a?In?Form1.Controls

On?Error?Resume?Next

a.Width?=?a.Width?*?(Me.Width?/?f_size(1))

a.Height?=?a.Height?*?(Me.Height?/?f_size(0))

a.Top?=?a.Top?*?(Me.Height?/?f_size(0))

a.Left?=?a.Left?*?(Me.Width?/?f_size(1))

Next

f_size(0)?=?Me.Height:?f_size(1)?=?Me.Width?'重新記錄窗口大小,用于下次運(yùn)算

End?If

End?If

End?Sub

''對(duì)于一些控件??如listbox的高度不適宜?呵呵

VS2013 VB.NET窗口控件怎么做自適應(yīng)

窗體在改變大小時(shí)會(huì)有一個(gè)size事件的,在這個(gè)事件中寫代碼獲取窗體的高度和寬度再根據(jù)窗體的高度和寬度的比例來效果自己的控件的高度寬度比例

VB.net TreeView 展開節(jié)點(diǎn)自適應(yīng)寬度

'控制樹狀選單自動(dòng)調(diào)整寬度

Private Sub tvMenu_AfterExpand(sender As Object, e As TreeViewEventArgs) Handles tvMenu.AfterExpand, tvMenu.AfterCollapse

Dim iMaxWidth As Integer = 0

For Each tn As TreeNode In tvMenu.Nodes

Dim iCurPos As Integer = tn.Bounds.X

Dim iCurWidth As Integer = iCurPos + tn.Bounds.Width

If tn.IsExpanded Then

iCurWidth = GetTreeViewMaxWidth(tn)

End If

If iMaxWidth iCurWidth Then

iMaxWidth = iCurWidth

Me.gbMenu.Width = iCurPos + iMaxWidth

End If

Next

End Sub

'取得目前樹狀選單節(jié)點(diǎn)下展開的最大寬度

Private Function GetTreeViewMaxWidth(tn As TreeNode) As Integer

Dim iMaxWidth As Integer = 0

For Each tnItem As TreeNode In tn.Nodes

Dim iCurPos As Integer = tnItem.Bounds.X

Dim iCurWidth As Integer = iCurPos + tnItem.Bounds.Width

If tnItem.IsExpanded Then

iCurWidth = GetTreeViewMaxWidth(tnItem)

End If

If iMaxWidth iCurWidth Then

iMaxWidth = iCurWidth

End If

Next

Return iMaxWidth

End Function


當(dāng)前題目:包含vbnet改自適應(yīng)的詞條
文章源于:http://weahome.cn/article/dscijpi.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部