Option Explicit
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 Sub Form_Load()
'----------------------------------------------------------------
Dim iCtr As Integer
Dim lVal As Long
'----------------------------------------------------------------
GetDeviceGammaRamp Me.hdc, Ramp1(0, 0)
For iCtr = 0 To 255
lVal = Int2Lng(Ramp1(iCtr, 0))
Ramp2(iCtr, 0) = Lng2Int(Int2Lng(Ramp1(iCtr, 0)) / 2)
'Die folgenden Zeilen für ROT auskommentieren:
Ramp2(iCtr, 1) = Lng2Int(Int2Lng(Ramp1(iCtr, 1)) / 2)
Ramp2(iCtr, 2) = Lng2Int(Int2Lng(Ramp1(iCtr, 2)) / 2)
Next iCtr
SetDeviceGammaRamp Me.hdc, Ramp2(0, 0)
'----------------------------------------------------------------
End Sub
Private Sub Form_Unload(Cancel As Integer)
'----------------------------------------------------------------
SetDeviceGammaRamp Me.hdc, Ramp1(0, 0)
'----------------------------------------------------------------
End Sub
Public Function Int2Lng(IntVal As Integer) As Long
'----------------------------------------------------------------
CopyMemory Int2Lng, IntVal, 2
'----------------------------------------------------------------
End Function
Public Function Lng2Int(Value As Long) As Integer
'----------------------------------------------------------------
CopyMemory Lng2Int, Value, 2
'----------------------------------------------------------------
End Function
对于循环里的运算是什么意思?我想使用拖动条控制 亮度怎么做呀?
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 Sub Form_Load()
'----------------------------------------------------------------
Dim iCtr As Integer
Dim lVal As Long
'----------------------------------------------------------------
GetDeviceGammaRamp Me.hdc, Ramp1(0, 0)
For iCtr = 0 To 255
lVal = Int2Lng(Ramp1(iCtr, 0))
Ramp2(iCtr, 0) = Lng2Int(Int2Lng(Ramp1(iCtr, 0)) / 2)
'Die folgenden Zeilen für ROT auskommentieren:
Ramp2(iCtr, 1) = Lng2Int(Int2Lng(Ramp1(iCtr, 1)) / 2)
Ramp2(iCtr, 2) = Lng2Int(Int2Lng(Ramp1(iCtr, 2)) / 2)
Next iCtr
SetDeviceGammaRamp Me.hdc, Ramp2(0, 0)
'----------------------------------------------------------------
End Sub
Private Sub Form_Unload(Cancel As Integer)
'----------------------------------------------------------------
SetDeviceGammaRamp Me.hdc, Ramp1(0, 0)
'----------------------------------------------------------------
End Sub
Public Function Int2Lng(IntVal As Integer) As Long
'----------------------------------------------------------------
CopyMemory Int2Lng, IntVal, 2
'----------------------------------------------------------------
End Function
Public Function Lng2Int(Value As Long) As Integer
'----------------------------------------------------------------
CopyMemory Lng2Int, Value, 2
'----------------------------------------------------------------
End Function
对于循环里的运算是什么意思?我想使用拖动条控制 亮度怎么做呀?
解决方案 »
- 怎样让窗口程序在最前端运行
- 在VB6.0中怎样动态创建FoxPro6.0的ODBC数据源
- 两个小问题
- 控件的问题
- 如何做一个增加系统DSN的过程
- 學習.
- 请帮我分析分析程序出错的原因,好吗?----Run-time error '429' and "380"
- ACCESS数据库的语句中如何用替换。REPLACE它不支持。
- 求教:怎么能读写TXT文件的指定行?(帮个忙,分不多,但肯定给)
- VB程序员们,进来交流一下吧。高级VB程序员是如何定义的,可以赚到多少钱?
- 为什么修改了CommandButton控件的BackColor属性以后没有发生变化呢?
- 请问怎么将日期格式yyyy:MM:dd 改为yyyy-MM-dd?
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 Sub Form_Load()
GetDeviceGammaRamp Me.hdc, Ramp1(0, 0)
With scl(0)
.Min = 1
.Max = 100
.LargeChange = 10
End With
With scl(1)
.Min = 1
.Max = 100
.LargeChange = 10
End With
With scl(2)
.Min = 1
.Max = 100
.LargeChange = 10
End With
End Sub
Private Sub Form_Unload(Cancel As Integer)
'----------------------------------------------------------------
SetDeviceGammaRamp Me.hdc, Ramp1(0, 0)
'----------------------------------------------------------------
End Sub
Public Function Int2Lng(IntVal As Integer) As Long
'----------------------------------------------------------------
CopyMemory Int2Lng, IntVal, 2
'----------------------------------------------------------------
End Function
Public Function Lng2Int(Value As Long) As Integer
'----------------------------------------------------------------
CopyMemory Lng2Int, Value, 2
'----------------------------------------------------------------
End FunctionSub SetGammaRamp()
'----------------------------------------------------------------
Dim iCtr As Integer
Dim lVal As Long
'----------------------------------------------------------------
For iCtr = 0 To 255
lVal = Int2Lng(Ramp1(iCtr, 0))
Ramp2(iCtr, 0) = Lng2Int(Int2Lng(Ramp1(iCtr, 0) * (1 / scl(0).Value)))
'Die folgenden Zeilen für ROT auskommentieren:
Ramp2(iCtr, 1) = Lng2Int(Int2Lng(Ramp1(iCtr, 1) * (1 / scl(1).Value)))
Ramp2(iCtr, 2) = Lng2Int(Int2Lng(Ramp1(iCtr, 2) * (1 / scl(2).Value)))
Next iCtr
SetDeviceGammaRamp Me.hdc, Ramp2(0, 0)
'----------------------------------------------------------------
End SubPrivate Sub scl_Change(Index As Integer)
Call SetGammaRamp
End Sub