vb.net调节屏幕亮度 win调节屏幕亮度
VB怎么做调节亮度的程序?代码
'下面是改变屏幕的亮度的代码。
创新互联专注于乐昌企业网站建设,响应式网站设计,商城系统网站开发。乐昌网站建设公司,为乐昌等地区提供建站服务。全流程定制制作,专业设计,全程项目跟踪,创新互联专业和态度为您提供的服务
'新建文本文档,复制下面代码,另存为form1.frm,然后双击打开。
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
vb.net 高亮度显示文本
选中就是高亮,首先得到你找到的文本字符的起始位置和长度,然后
TextBox.Select(start,length)
或
TextBox.SelectionStart = start
TextBox.SelectionLength = length
显示屏亮度怎么调节?显示屏亮度调节方法
显示屏亮度因使用环境的需要而进行调节,这样更有利于对我们眼睛的保护,那么如何进行 显示屏亮度调节 呢?今天就随我来看看 显示屏亮度调节 方法,以供大家参考哦。
一、显示屏亮度调节——台式机
1、 打开“控制面板”,双击相应的显示器管理程序,例如本经验中的“Inter GMA Driver”。
2、 在打开的“图像和媒体控制面板”窗口中,切换到“显示”选项卡。然后点击“颜色增强”项,接着就可以在右侧就可以看到亮度调节功能了,通过滑动”亮度调节滑块“就可以改变屏幕的亮度。
3、 其实,更为有效快捷的方法就是通过显示器上面的按键进行调节。
在显示器面板上,有一排按键,每个按键上都标有图案。其中标有“太阳光”图案的按键通常是用来调节屏幕亮度的。
4、 在调节屏幕亮度的过程中,会发现按键下方有一对方向相向的箭头,这说明通常按这一组键,可调整屏幕的亮度。
5、 对于显示器屏幕上 其它 按钮的调节方法,大家可以参考显示器说明书或指导手册来操作。
二、显示屏亮度调节——笔记本
1、 桌面空白处右键属性-在显示属性窗口,找到并单击设置选项框,在设置选项框中再次找到并单击高级按扭
2、 找到选项卡最右边的显卡选项卡,点击选项卡中的启动NVIDTA控制面板。或者在开始菜单-控制面板中也是可以找到NVIDIA控制面板是一样可以打开
3、 调整桌面颜色设置的设置,其中就有一项是亮度设置。这里是按百分比设置的,直接用鼠标拖即可立即生效。拖到自己调到的亮度即可。
4、注意事项: 笔记本自带的系统可以直接使用Fn+方向键上的亮度大小即可调节显示器亮度(有些电脑可能不是上下的方向键,可能是F5 F6具体可以查看键盘上的图标是小太阳+和-);如果不是笔记本自带的系统的话,而又没有NVIDTA控制面板,可以在重起电脑时,在还没有进入系统之前就直接按Fn+方向键即可调节显示器亮度
关于 显示屏亮度调节 的相关信息就为大家介绍到这里了,希望这篇文章对大家有所帮助。如果大家还有什么不明白的地方可以在下方给我留言哦,我们会尽快为您解答。
怎么调屏幕亮度?
可以通过以下三种方法调节屏幕亮度:
一、 在使用的操作系统中调节亮度的方法(以Win10为例):
【方法1】:点击开始菜单栏,然后依次选择 设置——系统——显示选项,右侧可以看到亮度级别,用鼠标左右拖动亮度条,可以调整屏幕的亮度。
【方法2】:点击任务栏右侧里的通知功能按钮,在弹出的界面找到亮度调节功能按钮,用鼠标左键点击亮度调节功能按钮,可以实现亮度25%,50%,75%,100%四个选项的修改。
二、 在使用的电脑类型中调节亮度的方法(以Lenovo笔记本为例):
【方法一:快捷键调节】
1、目前主流的Lenovo笔记本一般通过F11、F12快捷键调节屏幕亮度。如需增加亮度可按F12,降低亮度则按F11。
使用方法:如需增加亮度则按Fn+↑;如需降低亮度则按Fn+↓。
【方法二:使用系统电源选项调节屏幕亮度】
适用范围:Win10/8.1/8/7(注:Windows XP系统不支持)
1、在任务栏右下角找到电源状态图标并单击鼠标右键,在弹出的菜单中点击“调整屏幕亮度”。
2、在弹出的电源选项窗口,使用鼠标左键拖动底部“屏幕亮度”的滑杆进行调节。
三、 在使用的显卡类型中调节亮度的方法(以Intel显卡为例)
1、桌面空白处单击鼠标右键,点击“图形属性”;
2、调出界面后点击“显示器”;
3、进入显示器界面后点击“颜色设置”;
4、然后进行亮度等设置调整;
四、 如果以上方法都不能调节亮度,可能是显卡驱动未安装或驱动异常,可以重装显卡驱动。
vb改屏幕亮度
下面是改变屏幕的亮度的代码。
复制下面代码,保存为form1.frm,然后双击打开,并运行,即可看到效果。
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 = "设置"
Height = 495
Left = 240
TabIndex = 1
Top = 1920
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "恢复"
Height = 495
Left = 240
TabIndex = 0
Top = 1320
Width = 1215
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 = 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 = "全部调整"
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
文章题目:vb.net调节屏幕亮度 win调节屏幕亮度
当前网址:http://azwzsj.com/article/hjgihp.html