'下面是改变屏幕的亮度的代码。
在泰州等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都网站设计、网站建设 网站设计制作按需设计网站,公司网站建设,企业网站建设,成都品牌网站建设,成都全网营销,外贸网站制作,泰州网站建设费用合理。
'新建文本文档,复制下面代码,另存为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
楼主您好!如果要设置
Picturebox
或
Imagebox
中图片的透明度,需要大量的代码和函数才能实现,我这里有一个现成的图像控件,它是一个强大的图像控件,支持JPG、GIF、PNG、ICO、CUR、TIFF、WMF等等众多的格式,而且能够保存图片的透明度信息,比如带透明的PNG图像。而且,它能够在属性框里直接设置图片的透明度、亮度、反相、旋转、镜像、阴影等众多属性。支持通过多种方法载入图像,从文件、从剪贴板,甚至从句柄。支持多种调节缩放图像的方式,而且能够保证图像的品质。
这是我最青睐的一款图像控件,因为它几乎是完美的,我已经积累了相关的使用经验。如果您需要,请加我Q,12530487,注明图像控件,我会把它发给你,并且给你一个使用例子。以下是预览图: 请QQ联系我
从网上下一个图片处理软件即可,推荐使用美图秀秀和光影魔术手,简单易操作。望采纳