vb.net自適應(yīng)屏幕的簡(jiǎn)單介紹

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

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

成都創(chuàng)新互聯(lián)服務(wù)項(xiàng)目包括信豐網(wǎng)站建設(shè)、信豐網(wǎng)站制作、信豐網(wǎng)頁(yè)制作以及信豐網(wǎng)絡(luò)營(yíng)銷(xiāo)策劃等。多年來(lái),我們專(zhuān)注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢(shì)、行業(yè)經(jīng)驗(yàn)、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,信豐網(wǎng)站推廣取得了明顯的社會(huì)效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶(hù)以成都為中心已經(jīng)輻射到信豐省份的部分城市,未來(lái)相信會(huì)繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶(hù)的支持與信任!

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

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 '此處原來(lái)如果在1024*768分辨率下顯示正常的話,就可以直接賦值1024和768 Dim temp As Control Dim nSum As Integer nSum = 0 For Each temp In this '此處要注意,有些控件沒(méi)有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 '此處要注意,有些控件沒(méi)有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.net中怎么可以讓窗體全屏顯示?

Me.Height = My.Computer.Screen.Bounds.Height

Me.Width = My.Computer.Screen.Bounds.Width

這是設(shè)置窗體的長(zhǎng)寬和屏幕的分辨率一樣大小,相當(dāng)于全屏。

如果Me.WindowState=FormWindowState.Maximized的話,只是單純的將窗體最大化,但恢復(fù)窗口大小后窗體的大小實(shí)際上還和原來(lái)一樣大。

VB.NET的特點(diǎn)

1.真正成為面向?qū)ο笠约爸С掷^承性的語(yǔ)言。

2.窗體設(shè)計(jì)器支持可視化繼承,并且包含了許多新的特性,比如自動(dòng)改變窗體大小、資源本地化支持、數(shù)據(jù)類(lèi)工具內(nèi)在支持XML數(shù)據(jù)。

3.直接建立在.NET的框架結(jié)構(gòu)上,因此開(kāi)發(fā)人員可以充分利用所有.NET平臺(tái)特性,也可以與其他的.NET語(yǔ)言交互。

4.為Windows應(yīng)用程序提供了XCOPY部署,開(kāi)發(fā)者不再需要為DLL的版本問(wèn)題擔(dān)憂。

網(wǎng)站題目:vb.net自適應(yīng)屏幕的簡(jiǎn)單介紹
新聞來(lái)源:http://muchs.cn/article16/dohhhgg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供虛擬主機(jī)、軟件開(kāi)發(fā)App開(kāi)發(fā)、商城網(wǎng)站、域名注冊(cè)、做網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站建設(shè)