-
Mar 28th, 2021, 01:57 AM
#1
Thread Starter
PowerPoster
Transparent Activex Control,WS_EX_LAYERED on child controls
Last edited by xiaoyao; Mar 30th, 2021 at 08:25 AM.
-
Mar 28th, 2021, 03:41 AM
#2
Thread Starter
PowerPoster
Re: WS_EX_LAYERED on child controls(Transparent Activex Control)
where is Transparent text control (can put on commandbutton,change zorder). Is there a way to add another file box to the custom control and set the transparent color to white?
-
Mar 28th, 2021, 03:49 AM
#3
Fanatic Member
Re: WS_EX_LAYERED on child controls(Transparent Activex Control)
Why do you copy the code from dilettante? The code you posted is meaningless
-
Mar 28th, 2021, 04:14 AM
#4
Thread Starter
PowerPoster
Re: WS_EX_LAYERED on child controls(Transparent Activex Control)
form(PngControl.frm):
Code:
PngOcx_Layer1.Do_LoadPng App.Path & "\02button.png"
PngOcx_Layer2.Do_LoadPng App.Path & "\01Alpha_Png.png"
add a UserControl :PngOcx_Layer.ctl,code here:
Code:
Public Event Click()
Function Do_LoadPng(PngFile As String)
LoadPng PngFile, UserControl.hwnd
End Function
Private Sub UserControl_Click()
PngControl.Caption = "ocx-click " & Now
RaiseEvent Click
End Sub
Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then
Call ReleaseCapture
SendMessage UserControl.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End If
End Sub
Last edited by xiaoyao; Mar 28th, 2021 at 04:38 AM.
-
Mar 28th, 2021, 04:20 AM
#5
Re: WS_EX_LAYERED on child controls(Transparent Activex Control)
There is no PngOcx_Layer.ctl user-control in the sample project. This is faking it by re-parenting a transparent form to simulate the fake child "flower control".
Since commit ea789f6 "Add transparency for containers lacking windowless controls support" of the poor man's AlphaBlendImage control you can add the single-file user control to a project and set Windowless = False from properties window for a true WS_EX_LAYERED transparency on a true VB6 user-control.
This requires Win8+ to work and a proper manifest for the final executable (and VBIDE).
cheers,
</wqw>
-
Mar 28th, 2021, 04:36 AM
#6
Thread Starter
PowerPoster
Re: WS_EX_LAYERED on child controls(Transparent Activex Control)
Originally Posted by wqweto
There is no PngOcx_Layer.ctl user-control in the sample project. This is faking it by re-parenting a transparent form to simulate the fake child "flower control".
Since commit ea789f6 "Add transparency for containers lacking windowless controls support" of the poor man's AlphaBlendImage control you can add the single-file user control to a project and set Windowless = False from properties window for a true WS_EX_LAYERED transparency on a true VB6 user-control.
This requires Win8+ to work and a proper manifest for the final executable (and VBIDE).
cheers,
</wqw>
use AlphaBlendImage,when add a button can't show.
My final thought: add multiple PNG images with transparent channels to the control or independent new form, support zorder sequence operation. You can control the relationship between the upper and lower layers, there used to be the simplest set image1.picture=**(from png ), this can only be in the same Z order as the label control, and cannot be overwritten to the button control or Picturebox and other controls
-
Mar 28th, 2021, 05:03 AM
#7
Thread Starter
PowerPoster
Re: WS_EX_LAYERED on child controls(Transparent Activex Control)
If you just want to make the picturebox transparent, you can try the simplest way: take out the client area coordinates of the picture box, and then hide the control.
Take a screenshot from the screen or the form, set it as the back view of the picture box, and then display the control (move off the screen, or set the width and height to 0)
It would be great if there were fewer lines of code.
I saw a transparent Picturebox control before, and found that the picture displayed in high DPI was incomplete.
There is another way, if there are 2 other controls on the Picturebox, you can hollow out the other vacant places (CreateRectRgn),
This is truly transparent. If you move the Picturebox, you can see the real situation of other forms or controls below.
-
Mar 28th, 2021, 05:10 AM
#8
Re: WS_EX_LAYERED on child controls(Transparent Activex Control)
Originally Posted by xiaoyao
use AlphaBlendImage,when add a button can't show.
Yes, it can! This is possible since latest commit ea789f6 which implements WS_EX_LAYERED transparency on the user-control.
You just have to double-click on AlphaBlendImage.ctl in sources treeview to open the control's designer and in Properties Window set Windowless = False so that the control is *not* windowless. Since latest commit when the control is marked windowed it automagically uses WS_EX_LAYERED transparency and can overlap buttons, listviews, labels and every other control on the form.
cheers,
</wqw>
Last edited by wqweto; Mar 28th, 2021 at 05:20 AM.
-
Mar 28th, 2021, 05:52 AM
#9
Re: Transparent Activex Control,WS_EX_LAYERED on child controls
Just for the record...
For nested Alpha-layering to work properly (on each and every existing Form or Control),
the underlying Form- and Widget-engine has to support it from the ground up.
And by using the RC5/RC6 Form+Widget-engine, the VB6 community can do "proper nested alpha" for nearly a decade now -
(without using any Win32-APIs, fully DPI-aware and down to Windows-XP and older systems).
The above shot is a fully interactive demo - with working TextBox-controls in the little moveable "frosted window-widgets".
Code for the above output was shown here:
https://www.vbforums.com/showthread....=1#post5252719
Olaf
-
Mar 28th, 2021, 05:52 AM
#10
Thread Starter
PowerPoster
Re: Transparent Activex Control,WS_EX_LAYERED on child controls
[vb6] Transparent PictureBox - Page 2-VBForums
https://www.vbforums.com/showthread....ctureBox/page2
can use usercontrol to replace Picture for "Transparent-PictureBox"
-
Mar 28th, 2021, 07:47 AM
#11
Thread Starter
PowerPoster
Re: Transparent Activex Control,WS_EX_LAYERED on child controls
Originally Posted by Schmidt
Just for the record...
For nested Alpha-layering to work properly (on each and every existing Form or Control),
the underlying Form- and Widget-engine has to support it from the ground up.
And by using the RC5/RC6 Form+Widget-engine, the VB6 community can do "proper nested alpha" for nearly a decade now -
(without using any Win32-APIs, fully DPI-aware and down to Windows-XP and older systems).
The above shot is a fully interactive demo - with working TextBox-controls in the little moveable "frosted window-If there is a visual form designer, it is too much, or directly convert the control form of VB6 into widgets code".
Code for the above output was shown here:
https://www.vbforums.com/showthread....=1#post5252719
Olaf
IF THE MAIN FORM,ALL CONTROLS ,ALL support alpha Transparent ,that's funny.
by miniblink.dll
all webpage in webkit,all is Transparent .
like a Transparent clock on desktop ,screen,it's only by js,miniblink.dll
IF WE CAN DESIGN WINDOW LIKE usercontrol,
Last edited by xiaoyao; Mar 28th, 2021 at 07:51 AM.
-
Mar 28th, 2021, 08:17 AM
#12
Thread Starter
PowerPoster
-
Mar 28th, 2021, 09:53 AM
#13
Thread Starter
PowerPoster
Re: Transparent Activex Control,WS_EX_LAYERED on child controls
Hierarchical window transparent method and several issues using this method, for the above questions, in order to improve or avoid the above method, I have been looking for methods that make the child's window transparent, can't use the hollow painted brush, which makes me Suddenly realize: hollow hollow_brush is equal to null_brush, the meaning is not to use the painting, that is, not to draw a brush, not filling is actually transparent,
hook message
Just intercept the ON_WM_CTLCOLOR message, then return to the empty painting brush in this processing function is Return (Hbrush) getStockObject (Hollow_brush); that, this window is transparent [this window is specified as a sub-window for other windows. After that, the sub-window is also transparent]
transparent textbox by hook,subclasd
https://blog.csdn.net/qq2399431200/a...tails/10991917
Last edited by xiaoyao; Mar 28th, 2021 at 10:00 AM.
-
Mar 28th, 2021, 10:44 AM
#14
Re: Transparent Activex Control,WS_EX_LAYERED on child controls
-
Mar 29th, 2021, 01:53 AM
#15
Thread Starter
PowerPoster
Re: Transparent Activex Control,WS_EX_LAYERED on child controls
Transparent textbox by WS_EX_LAYERED (should be included as a manifest file)
Code:
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 WS_EX_LAYERED = &H80000
Private Const GWL_EXSTYLE = (-20)
Private Const LWA_ALPHA = &H2
Private Const LWA_COLORKEY = &H1
Function SetAlphaColor(hwnd As Long, Optional AlphaColor As Long = vbBlue) As Long
Dim rtn As Long
rtn = GetWindowLong(hwnd, GWL_EXSTYLE)
rtn = rtn Or WS_EX_LAYERED
SetWindowLong hwnd, GWL_EXSTYLE, rtn
SetLayeredWindowAttributes hwnd, AlphaColor, 0, LWA_COLORKEY
SetAlphaColor = rtn
End Function
Private Sub Form_Load()
Text1.ForeColor = vbYellow
Text1.BackColor = vbBlue
SetAlphaColor Text1.hwnd, vbBlue
Me.Picture = LoadPicture("01.jpg")
Timer1.Interval = 500
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Text1.Left = Text1.Left + 50
End Sub
-
Mar 29th, 2021, 06:14 PM
#16
Thread Starter
PowerPoster
Re: Transparent Activex Control,WS_EX_LAYERED on child controls
Originally Posted by The trick
Programming Challenge:How to make Picturebox1 control truly transparent.Remove the background color, set the transparency of the PNG channel as a background image function.
Code:
SetWindowLong Picturebox1.hwnd, GWL_EXSTYLE, GetWindowLong(Picturebox1.hwnd, GWL_EXSTYLE) Or WS_EX_TRANSPARENT
Set mSubclass = New clsTrickSubclass
mSubclass.Hook Me.hwnd
VB6 Transparent Textbox By API(WM_CTLCOLOREDIT)
https://www.vbforums.com/showthread.php?891144-VB6-Transparent-Textbox-By-API(WM_CTLCOLOREDIT)
-
Mar 30th, 2021, 06:25 AM
#17
Thread Starter
PowerPoster
Re: Transparent Activex Control,WS_EX_LAYERED on child controls
Transparency effect function that took a day to study
Code:
TransparentWithHdc Picture1.hwnd,Picture1.Hdc
Project 1:
VB6 Transparent Textbox By API(WM_CTLCOLOREDIT)-VBForums
https://www.vbforums.com/showthread...._CTLCOLOREDIT)
-
Mar 2nd, 2024, 05:02 PM
#18
New Member
Re: Transparent Activex Control,WS_EX_LAYERED on child controls
Originally Posted by xiaoyao
Excuse me where is this Dll File
xiaoyao
-
Mar 4th, 2024, 05:26 PM
#19
Thread Starter
PowerPoster
Re: Transparent Activex Control,WS_EX_LAYERED on child controls
Can't I open the URL above? Download it from the official website.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|