'下面是改變屏幕的亮度的代碼。
創(chuàng)新互聯(lián)專(zhuān)注于樂(lè)昌企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站設(shè)計(jì),商城系統(tǒng)網(wǎng)站開(kāi)發(fā)。樂(lè)昌網(wǎng)站建設(shè)公司,為樂(lè)昌等地區(qū)提供建站服務(wù)。全流程定制制作,專(zhuān)業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,創(chuàng)新互聯(lián)專(zhuān)業(yè)和態(tài)度為您提供的服務(wù)
'新建文本文檔,復(fù)制下面代碼,另存為form1.frm,然后雙擊打開(kāi)。
VERSION?5.00
Begin?VB.Form?Form1?
Caption?????????=???"Form1"
ClientHeight????=???1890
ClientLeft??????=???120
ClientTop???????=???420
ClientWidth?????=???5775
LinkTopic???????=???"Form1"
ScaleHeight?????=???1890
ScaleWidth??????=???5775
StartUpPosition?=???3?'窗口缺省
Begin?VB.HScrollBar?HScroll1?
Height??????????=???495
Left????????????=???240
Max?????????????=???255
TabIndex????????=???2
Top?????????????=???480
Value???????????=???128
Width???????????=???5295
End
Begin?VB.CommandButton?Command2?
Caption?????????=???"Exit"
Height??????????=???615
Left????????????=???2880
TabIndex????????=???1
Top?????????????=???1080
Width???????????=???2655
End
Begin?VB.CommandButton?Command1?
Caption?????????=???"Reset"
Height??????????=???615
Left????????????=???240
TabIndex????????=???0
Top?????????????=???1080
Width???????????=???2655
End
End
Attribute?VB_Name?=?"Form1"
Attribute?VB_GlobalNameSpace?=?False
Attribute?VB_Creatable?=?False
Attribute?VB_PredeclaredId?=?True
Attribute?VB_Exposed?=?False
Option?Explicit
'Private?Declare?Function?GetDeviceGammaRamp?Lib?"GDI32.DLL"?(ByVal?hDC?As?Long,?lpRamp?As?Any)?As?Long
Private?Declare?Function?SetDeviceGammaRamp?Lib?"GDI32.DLL"?(ByVal?hDC?As?Long,?lpRamp?As?Any)?As?Long
Private?Type?Word
HiByte?As?Byte
LoByte?As?Byte
End?Type
Private?Type?Dword
HiWord?As?Word
LoWord?As?Word
End?Type
Private?Type?iLong
Value?As?Long
End?Type
Private?Sub?Command1_Click()
HScroll1.Value?=?128
End?Sub
Private?Sub?Command2_Click()
Unload?Me
End?Sub
Function?SetBrightness(ByVal?hDC?As?Long,?ByVal?wBrightness?As?Integer)?As?Long
Dim?GammaArray(255,?2)?As?Word
Dim?hGammaDC?As?Long,?nIndex?As?Long
Dim?wValue?As?iLong,?dValue?As?Dword
hGammaDC?=?hDC
If?hDC?=?0?Then?hGammaDC?=?Me.hDC
If?hGammaDC?Then
For?nIndex?=?0?To?255
wValue.Value?=?nIndex?*?(wBrightness?+?128)
If?wValue.Value??65533?Then?wValue.Value?=?65533
LSet?dValue?=?wValue
GammaArray(nIndex,?0)?=?dValue.HiWord
GammaArray(nIndex,?1)?=?dValue.HiWord
GammaArray(nIndex,?2)?=?dValue.HiWord
Next
SetBrightness?=?SetDeviceGammaRamp(hGammaDC,?GammaArray(0,?0))
End?If
End?Function
Private?Sub?Form_Unload(Cancel?As?Integer)
Call?Command1_Click
End?Sub
Private?Sub?HScroll1_Change()
Call?SetBrightness(Me.hDC,?HScroll1.Value)
Me.Caption?=?HScroll1.Value
End?Sub
選中就是高亮,首先得到你找到的文本字符的起始位置和長(zhǎng)度,然后
TextBox.Select(start,length)
或
TextBox.SelectionStart = start
TextBox.SelectionLength = length
顯示屏亮度因使用環(huán)境的需要而進(jìn)行調(diào)節(jié),這樣更有利于對(duì)我們眼睛的保護(hù),那么如何進(jìn)行 顯示屏亮度調(diào)節(jié) 呢?今天就隨我來(lái)看看 顯示屏亮度調(diào)節(jié) 方法,以供大家參考哦。
一、顯示屏亮度調(diào)節(jié)——臺(tái)式機(jī)
1、 打開(kāi)“控制面板”,雙擊相應(yīng)的顯示器管理程序,例如本經(jīng)驗(yàn)中的“Inter GMA Driver”。
2、 在打開(kāi)的“圖像和媒體控制面板”窗口中,切換到“顯示”選項(xiàng)卡。然后點(diǎn)擊“顏色增強(qiáng)”項(xiàng),接著就可以在右側(cè)就可以看到亮度調(diào)節(jié)功能了,通過(guò)滑動(dòng)”亮度調(diào)節(jié)滑塊“就可以改變屏幕的亮度。
3、 其實(shí),更為有效快捷的方法就是通過(guò)顯示器上面的按鍵進(jìn)行調(diào)節(jié)。
在顯示器面板上,有一排按鍵,每個(gè)按鍵上都標(biāo)有圖案。其中標(biāo)有“太陽(yáng)光”圖案的按鍵通常是用來(lái)調(diào)節(jié)屏幕亮度的。
4、 在調(diào)節(jié)屏幕亮度的過(guò)程中,會(huì)發(fā)現(xiàn)按鍵下方有一對(duì)方向相向的箭頭,這說(shuō)明通常按這一組鍵,可調(diào)整屏幕的亮度。
5、 對(duì)于顯示器屏幕上 其它 按鈕的調(diào)節(jié)方法,大家可以參考顯示器說(shuō)明書(shū)或指導(dǎo)手冊(cè)來(lái)操作。
二、顯示屏亮度調(diào)節(jié)——筆記本
1、 桌面空白處右鍵屬性-在顯示屬性窗口,找到并單擊設(shè)置選項(xiàng)框,在設(shè)置選項(xiàng)框中再次找到并單擊高級(jí)按扭
2、 找到選項(xiàng)卡最右邊的顯卡選項(xiàng)卡,點(diǎn)擊選項(xiàng)卡中的啟動(dòng)NVIDTA控制面板?;蛘咴陂_(kāi)始菜單-控制面板中也是可以找到NVIDIA控制面板是一樣可以打開(kāi)
3、 調(diào)整桌面顏色設(shè)置的設(shè)置,其中就有一項(xiàng)是亮度設(shè)置。這里是按百分比設(shè)置的,直接用鼠標(biāo)拖即可立即生效。拖到自己調(diào)到的亮度即可。
4、注意事項(xiàng): 筆記本自帶的系統(tǒng)可以直接使用Fn+方向鍵上的亮度大小即可調(diào)節(jié)顯示器亮度(有些電腦可能不是上下的方向鍵,可能是F5 F6具體可以查看鍵盤(pán)上的圖標(biāo)是小太陽(yáng)+和-);如果不是筆記本自帶的系統(tǒng)的話(huà),而又沒(méi)有NVIDTA控制面板,可以在重起電腦時(shí),在還沒(méi)有進(jìn)入系統(tǒng)之前就直接按Fn+方向鍵即可調(diào)節(jié)顯示器亮度
關(guān)于 顯示屏亮度調(diào)節(jié) 的相關(guān)信息就為大家介紹到這里了,希望這篇文章對(duì)大家有所幫助。如果大家還有什么不明白的地方可以在下方給我留言哦,我們會(huì)盡快為您解答。
可以通過(guò)以下三種方法調(diào)節(jié)屏幕亮度:
一、 在使用的操作系統(tǒng)中調(diào)節(jié)亮度的方法(以Win10為例):
【方法1】:點(diǎn)擊開(kāi)始菜單欄,然后依次選擇 設(shè)置——系統(tǒng)——顯示選項(xiàng),右側(cè)可以看到亮度級(jí)別,用鼠標(biāo)左右拖動(dòng)亮度條,可以調(diào)整屏幕的亮度。
【方法2】:點(diǎn)擊任務(wù)欄右側(cè)里的通知功能按鈕,在彈出的界面找到亮度調(diào)節(jié)功能按鈕,用鼠標(biāo)左鍵點(diǎn)擊亮度調(diào)節(jié)功能按鈕,可以實(shí)現(xiàn)亮度25%,50%,75%,100%四個(gè)選項(xiàng)的修改。
二、 在使用的電腦類(lèi)型中調(diào)節(jié)亮度的方法(以L(fǎng)enovo筆記本為例):
【方法一:快捷鍵調(diào)節(jié)】
1、目前主流的Lenovo筆記本一般通過(guò)F11、F12快捷鍵調(diào)節(jié)屏幕亮度。如需增加亮度可按F12,降低亮度則按F11。
使用方法:如需增加亮度則按Fn+↑;如需降低亮度則按Fn+↓。
【方法二:使用系統(tǒng)電源選項(xiàng)調(diào)節(jié)屏幕亮度】
適用范圍:Win10/8.1/8/7(注:Windows XP系統(tǒng)不支持)
1、在任務(wù)欄右下角找到電源狀態(tài)圖標(biāo)并單擊鼠標(biāo)右鍵,在彈出的菜單中點(diǎn)擊“調(diào)整屏幕亮度”。
2、在彈出的電源選項(xiàng)窗口,使用鼠標(biāo)左鍵拖動(dòng)底部“屏幕亮度”的滑桿進(jìn)行調(diào)節(jié)。
三、 在使用的顯卡類(lèi)型中調(diào)節(jié)亮度的方法(以Intel顯卡為例)
1、桌面空白處單擊鼠標(biāo)右鍵,點(diǎn)擊“圖形屬性”;
2、調(diào)出界面后點(diǎn)擊“顯示器”;
3、進(jìn)入顯示器界面后點(diǎn)擊“顏色設(shè)置”;
4、然后進(jìn)行亮度等設(shè)置調(diào)整;
四、 如果以上方法都不能調(diào)節(jié)亮度,可能是顯卡驅(qū)動(dòng)未安裝或驅(qū)動(dòng)異常,可以重裝顯卡驅(qū)動(dòng)。
下面是改變屏幕的亮度的代碼。
復(fù)制下面代碼,保存為form1.frm,然后雙擊打開(kāi),并運(yùn)行,即可看到效果。
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3660
ClientLeft = 60
ClientTop = 450
ClientWidth = 5865
LinkTopic = "Form1"
ScaleHeight = 3660
ScaleWidth = 5865
StartUpPosition = 3 '窗口缺省
Begin VB.VScrollBar Vb
Height = 375
Left = 4920
TabIndex = 9
Top = 1680
Width = 255
End
Begin VB.VScrollBar Vg
Height = 375
Left = 4920
TabIndex = 8
Top = 1200
Width = 255
End
Begin VB.VScrollBar vr
Height = 375
Left = 4920
TabIndex = 7
Top = 720
Width = 255
End
Begin VB.VScrollBar vAll
Height = 375
Left = 4920
TabIndex = 6
Top = 240
Width = 255
End
Begin VB.TextBox tBlue
Height = 375
Left = 4200
TabIndex = 5
Top = 1680
Width = 735
End
Begin VB.TextBox tGreen
Height = 375
Left = 4200
TabIndex = 4
Top = 1200
Width = 735
End
Begin VB.TextBox tRed
Height = 375
Left = 4200
TabIndex = 3
Top = 720
Width = 735
End
Begin VB.TextBox rgbAll
Height = 375
Left = 4200
TabIndex = 2
Top = 240
Width = 735
End
Begin VB.CommandButton Command2
Caption = "設(shè)置"
Height = 495
Left = 240
TabIndex = 1
Top = 1920
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "恢復(fù)"
Height = 495
Left = 240
TabIndex = 0
Top = 1320
Width = 1215
End
Begin VB.Label Label1
Caption = "藍(lán)"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = H00FF0000
Height = 375
Index = 3
Left = 3480
TabIndex = 13
Top = 1680
Width = 375
End
Begin VB.Label Label1
Caption = "綠"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = H0000C000
Height = 375
Index = 2
Left = 3480
TabIndex = 12
Top = 1200
Width = 375
End
Begin VB.Label Label1
Caption = "紅"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = H000000FF
Height = 375
Index = 1
Left = 3480
TabIndex = 11
Top = 720
Width = 375
End
Begin VB.Label Label1
Caption = "全部調(diào)整"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 3000
TabIndex = 10
Top = 240
Width = 975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'Gamma Type
Private Type Gamma
Red As Integer
Green As Integer
Blue As Integer
End Type
Private GammaDay As Gamma 'Day Gamma
Private GammaNight As Gamma 'Night Gamma
'Gamma APIs
Private Ramp1(0 To 255, 0 To 2) As Integer
Private Ramp2(0 To 255, 0 To 2) As Integer
Private Declare Function GetDeviceGammaRamp Lib "gdi32" (ByVal hdc As Long, lpv As Any) As Long
Private Declare Function SetDeviceGammaRamp Lib "gdi32" (ByVal hdc As Long, lpv As Any) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
'Set Gamma
Public Sub SetGamma(ByVal intRed As Integer, ByVal intGreen As Integer, ByVal intBlue As Integer)
Dim i As Integer
Dim ScrDC As Long
'Get Screen's DC
ScrDC = GetDC(GetDesktopWindow)
intRed = intRed / 2
intGreen = intGreen / 2
intBlue = intBlue / 2
'Change Ramp
For i = 0 To 255
If intRed 0 Then Ramp2(i, 0) = ConvToSignedValue(ConvToUnSignedValue(Ramp1(i, 0)) * (100 - Abs(intRed)) / 100)
If intRed = 0 Then Ramp2(i, 0) = Ramp1(i, 0)
If intRed 0 Then Ramp2(i, 0) = ConvToSignedValue(65535 - ((65535 - ConvToUnSignedValue(Ramp1(i, 0))) * (100 - intRed) / 100))
If intGreen 0 Then Ramp2(i, 1) = ConvToSignedValue(ConvToUnSignedValue(Ramp1(i, 1)) * (100 - Abs(intGreen)) / 100)
If intGreen = 0 Then Ramp2(i, 1) = Ramp1(i, 1)
If intGreen 0 Then Ramp2(i, 1) = ConvToSignedValue(65535 - ((65535 - ConvToUnSignedValue(Ramp1(i, 1))) * (100 - intGreen) / 100))
If intBlue 0 Then Ramp2(i, 2) = ConvToSignedValue(ConvToUnSignedValue(Ramp1(i, 2)) * (100 - Abs(intBlue)) / 100)
If intBlue = 0 Then Ramp2(i, 2) = Ramp1(i, 2)
If intBlue 0 Then Ramp2(i, 2) = ConvToSignedValue(65535 - ((65535 - ConvToUnSignedValue(Ramp1(i, 2))) * (100 - intBlue) / 100))
Next
'Set Gamma
SetDeviceGammaRamp ScrDC, Ramp2(0, 0)
End Sub
'Save Gamma
Public Sub SaveGamma()
Dim ScrDC As Long
'Get Screen's DC
ScrDC = GetDC(GetDesktopWindow)
'Reset it
GetDeviceGammaRamp ScrDC, Ramp1(0, 0)
End Sub
'RestoreGamma
Public Sub RestoreGamma()
Dim ScrDC As Long
'Get Screen's DC
ScrDC = GetDC(GetDesktopWindow)
'Reset it
SetDeviceGammaRamp ScrDC, Ramp1(0, 0)
End Sub
Private Function ConvToSignedValue(lngValue As Long) As Integer
'Cheezy method for converting to signed integer
If lngValue = 32767 Then
ConvToSignedValue = CInt(lngValue)
Exit Function
End If
ConvToSignedValue = CInt(lngValue - 65535)
End Function
Private Function ConvToUnSignedValue(intValue As Integer) As Long
'Cheezy method for converting to unsigned integer
If intValue = 0 Then
ConvToUnSignedValue = intValue
Exit Function
End If
ConvToUnSignedValue = intValue + 65535
End Function
Private Sub Command1_Click()
rgbAll.Text = 0
Command2_Click
'GammaDay.Red = 0
'GammaDay.Green = 0
'GammaDay.Blue = 0
'SetGamma GammaDay.Red, GammaDay.Green, GammaDay.Blue
End Sub
Private Sub Command2_Click()
GammaNight.Red = Val(tRed.Text)
GammaNight.Green = Val(tGreen.Text)
GammaNight.Blue = Val(tBlue.Text)
SetGamma GammaNight.Red, GammaNight.Green, GammaNight.Blue
End Sub
Private Sub Form_Load()
SaveGamma
rgbAll.Text = vAll.Value
tRed.Text = vr.Value
tGreen.Text = Vg.Value
tBlue.Text = Vb.Value
End Sub
Private Sub Form_Unload(Cancel As Integer)
RestoreGamma
End Sub
Private Sub rgbAll_Change()
tRed.Text = rgbAll.Text
tGreen.Text = rgbAll.Text
tBlue.Text = rgbAll.Text
End Sub
Private Sub vAll_Change()
rgbAll.Text = vAll.Value
End Sub
Private Sub vr_Change()
tRed.Text = vr.Value
End Sub
Private Sub vg_Change()
tGreen.Text = Vg.Value
End Sub
Private Sub vb_Change()
tBlue.Text = Vb.Value
End Sub