VB6 – Yellow object on the form shows a click transparency

I have a problem that yellow objects “click” on multiple vb6 forms in my application:

The only possibility I can think of What affects it is the following (from VBForums, I used to make the cyan element transparent, as you can see in the image, but this has no effect on vbYellow.

Private Declare Function GetWindowLong Lib "user32" Alias ​​"GetWindowLongA" (_
ByVal hwnd As Long, _
ByVal nIndex As Long) As Long

Private Declare Function SetWindowLong Lib " user32" Alias ​​"SetWindowLongA" (_
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Private Declare Function SetLayeredWindowAttributes Lib "user32" (_
ByVal hwnd As Long, _
ByVal crKey As Long, _
ByVal bAlpha As Byte, _
ByVal dwFlags As Long) As Long

Private Const GWL_STYLE = (-16)
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_COLORKEY = &H1
Private Const LWA_ALPHA = &H2

Private Sub Form_Load()
Me.BackColor = vbCyan
SetWindowLong Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED
SetLayeredWindowAttributes Me.hwnd, vbCyan, 0&, LWA_COLORKEY
End Sub

I tried to replace the vbYellow shape with an image of the same color. This also has a click function, but in the end you will get the same result, not even triggering any set click Function.

I think the problem is that VB6 / Win32 sometimes uses different color codes. Sometimes just Switch from #RRGGBB(RGB) to #BBGGRR(BGR).

The good color to choose yellow is magenta, #FF00FF, because this color will work regardless of whether you switch red and blue components. Function.

Then you can use vbMagenta directly without problems.

I have a problem, there are many yellow objects in my application. “Click” on a vb6 form:

The only thing I can think of that might affect it is the following (from VBForums, I used to make the cyan element transparent, as you see in the image Like, but this has no effect on vbYellow.

Private Declare Function GetWindowLong Lib "user32" Alias ​​"GetWindowLongA" (_
ByVal hwnd As Long, _< br /> ByVal nIndex As Long) As Long

Private Declare Function SetWindowLong Lib "user32" Alias ​​"SetWindowLongA" (_
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Private Declare Function SetLayeredWindowAttributes Lib "user32" (_
ByVal hwnd As Long, _
ByVal crKey As Long, _
ByVal bAlpha As Byte, _
ByVal dwFlags As Long) As Long

Private Const GWL_STYLE = (-16)
Private Const GWL_EXSTYLE = ( -20)
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_COLORKEY = &H1
Private Const LWA_ALPHA = &H2

Private Sub Form_Load()
Me.BackColor = vbCyan
SetWindowLong Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED
SetLayeredWindowAttributes Me.hwnd, vbCyan, 0&, LWA_COLORKEY
End Sub

< I tried to replace the vbYellow shape with an image of the same color. This also has a click function, but in the end will get the same result, and it won't even trigger any set click function.

< p>I think the problem is that VB6/Win32 sometimes uses different color codes. Sometimes just switch from #RRGGBB(RGB) to #BBGGRR(BGR).

A good color for choosing yellow is Magenta, #FF00FF, because this color will work regardless of whether the red and blue components are switched.

Then you can use vbMagenta directly without problems.

< p>

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3421 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.