1
Visual Basic 6 / Re:BackGroud Color
« en: Agosto 25, 2013, 09:41:40 pm »
Thank you very much
Esta sección te permite ver todos los posts escritos por este usuario. Ten en cuenta que sólo puedes ver los posts escritos en zonas a las que tienes acceso en este momento.
Private Declare Function GetDC Lib "user32.dll" (ByVal hwnd As Long) As Long
Private Declare Function CreateCompatibleDC Lib "gdi32.dll" (ByVal hdc As Long) As Long
Private Declare Function SelectObject Lib "gdi32.dll" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function BitBlt Lib "gdi32.dll" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function CreateCompatibleBitmap Lib "gdi32.dll" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function SetPixelV Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Byte
Private Declare Function CreateSolidBrush Lib "gdi32.dll" (ByVal crColor As Long) As Long
Private Declare Function GetSysColorBrush Lib "user32" (ByVal nIndex As Long) As Long
Private Declare Function SetBkMode Lib "gdi32" (ByVal hdc As Long, ByVal nBkMode As Long) As Long
Private Declare Function CreateDIBSection Lib "gdi32.dll" (ByVal hdc As Long, pBitmapInfo As BITMAPINFO, ByVal un As Long, ByRef lplpVoid As Any, ByVal handle As Long, ByVal dw As Long) As Long
Private Type BITMAPINFOHEADER
biSize As Long
biWidth As Long
biHeight As Long
biPlanes As Integer
biBitCount As Integer
biCompression As Long
biSizeImage As Long
biXPelsPerMeter As Long
biYPelsPerMeter As Long
biClrUsed As Long
biClrImportant As Long
End Type
Private Type BITMAPINFO
bmiHeader As BITMAPINFOHEADER
bmiColors() As Long
End Type
Private m_hDC As Long
Private Sub Command1_Click()
Dim hBitmap As Long
Dim DC As Long
Dim BI As BITMAPINFO
DC = GetDC(0)
m_hDC = CreateCompatibleDC(DC)
With BI.bmiHeader
.biSize = Len(BI.bmiHeader)
.biBitCount = 32
.biWidth = Picture1.ScaleWidth
.biHeight = Picture1.ScaleHeight
.biPlanes = 1
.biSizeImage = .biWidth * .biHeight * (.biBitCount / 8)
End With
hBitmap = CreateDIBSection(m_hDC, BI, DIB_RGB_COLORS, ByVal 0, 0, 0)
OldhBitmap = SelectObject(m_hDC, hBitmap)
Call BitBlt(Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, m_hDC, 0, 0, vbSrcCopy)
End Sub

Case WM_KEYUP
If (wParam And &H7FFF&) = &H74 Or (wParam And &H7FFF&) = &H2E Then
RaiseEvent KeyPress(wParam And &H7FFF&)
End If
RaiseEvent KeyUp(wParam And &H7FFF&, pvShiftState())
whether the code that I made this modification has been good. or there is a better?
