469,328 Members | 1,280 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,328 developers. It's quick & easy.

VB6.0 UserControl Transparency with PSet issues

I'm trying to create a multi-user interactive whiteboard
that has the ability to load a 'background' image to draw
ontop of.

The client/server needs to load a transparent layer for
each user that connects.
This is so the individual user layers can be cleared.

Each layer is painted on by the user it is assigned to,
so the layer must respond to mouse events.
(mousedown/mousemove)

I have tried creating my own control, and setting BackStyle
to transparent, which works all the way up until I use .PSet,
or .Line on the transparent control. The control's backcolor
instantly shows, and the map underneath is covered up.

debug.print shows that BackStyle is still transparent.

Ive also tried SetWindowLongA from user32:
SetWindowLong(ctlControl.hWnd, _
GWL_EXSTYLE, _
WS_EX_TRANSPARENT)
but this doesn't work either.

Does anyone have any idea how to get around this issue?


Jul 17 '05 #1
5 11306
On Fri, 26 Sep 2003 18:23:11 GMT, "C. Alexander"
<ca********@nospam.yahoo.com> wrote:
I'm trying to create a multi-user interactive whiteboard
that has the ability to load a 'background' image to draw
ontop of.

The client/server needs to load a transparent layer for
each user that connects.
This is so the individual user layers can be cleared.

Each layer is painted on by the user it is assigned to,
so the layer must respond to mouse events.
(mousedown/mousemove)


That sounds odd

Have you tried playing with the MaskColor and the MaskPicture ?

Could you strip down the problem and post a simple example ?

I've normally found UserControls fairly reliable, but have not tried
layering different instances of the same thing on top of each other

- look at the MaskPicture stuff ...

.... also make sure the ScaleMode is vbPixels
- Twips are a nightmare when setting Pixels
Jul 17 '05 #2
I didn't test any of the following.
Just some copy/past/modify concepts...
'-----------------------------------------------------
' In UserControl.ctl
'-----------------------------------------------------
' Properties:
AutoRedraw=True;BackStyle=Transparent;BorderStyle= None;WindowLess=True
'
Public Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y
As Single)
Public Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y
As Single)

Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
RaiseEvent MouseDown(Button, Shift, X, Y)
End Sub

Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
RaiseEvent MouseMove(Button, Shift, X, Y)
End Sub

Public Sub SetPixColor(X As Single, Y As Single, Color As Long)
PSet (X, Y), Color
End Sub
'-----------------------------------------------------
'In Form1.frm
'-----------------------------------------------------

'
' Add a Image Control and set the Picture value to any image.
' Add the UserControl and place it over the Image Control
' Run the program, and click/drag on the area of the UserControl.
'
' The UserControl should turn from transparent, to the default background.
'

Private Sub UserControl1_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
If (Button = 1) Then
UserControl1.SetPixColor X, Y, 0
End If
End Sub

Private Sub UserControl1_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
If (Button = 1) Then
UserControl1.SetPixColor X, Y, 0
End If
End Sub

"J French" <er*****@nowhere.com> wrote in message
news:3f***************@news.btclick.com...
On Fri, 26 Sep 2003 18:23:11 GMT, "C. Alexander"
<ca********@nospam.yahoo.com> wrote:
I'm trying to create a multi-user interactive whiteboard
that has the ability to load a 'background' image to draw
ontop of.

The client/server needs to load a transparent layer for
each user that connects.
This is so the individual user layers can be cleared.

Each layer is painted on by the user it is assigned to,
so the layer must respond to mouse events.
(mousedown/mousemove)


That sounds odd

Have you tried playing with the MaskColor and the MaskPicture ?

Could you strip down the problem and post a simple example ?

I've normally found UserControls fairly reliable, but have not tried
layering different instances of the same thing on top of each other

- look at the MaskPicture stuff ...

... also make sure the ScaleMode is vbPixels
- Twips are a nightmare when setting Pixels

Jul 17 '05 #3
Oh, also need HitTest to activate the mouse events.
Add:

' In UserControl.ctl
Private Sub UserControl_HitTest(X As Single, Y As Single, HitResult As
Integer)
If HitResult = vbHitResultOutside Then
HitResult = vbHitResultHit
End If
End Sub

Original:

'-----------------------------------------------------
' In UserControl.ctl
'-----------------------------------------------------
' Properties:
AutoRedraw=True;BackStyle=Transparent;BorderStyle= None;WindowLess=True
'
Public Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y
As Single)
Public Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y
As Single)

Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
RaiseEvent MouseDown(Button, Shift, X, Y)
End Sub

Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
RaiseEvent MouseMove(Button, Shift, X, Y)
End Sub

Public Sub SetPixColor(X As Single, Y As Single, Color As Long)
PSet (X, Y), Color
End Sub
'-----------------------------------------------------
'In Form1.frm
'-----------------------------------------------------

'
' Add a Image Control and set the Picture value to any image.
' Add the UserControl and place it over the Image Control
' Run the program, and click/drag on the area of the UserControl.
'
' The UserControl should turn from transparent, to the default background.
'

Private Sub UserControl1_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
If (Button = 1) Then
UserControl1.SetPixColor X, Y, 0
End If
End Sub

Private Sub UserControl1_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
If (Button = 1) Then
UserControl1.SetPixColor X, Y, 0
End If
End Sub

"J French" <er*****@nowhere.com> wrote in message
news:3f***************@news.btclick.com...
On Fri, 26 Sep 2003 18:23:11 GMT, "C. Alexander"
<ca********@nospam.yahoo.com> wrote:
I'm trying to create a multi-user interactive whiteboard
that has the ability to load a 'background' image to draw
ontop of.

The client/server needs to load a transparent layer for
each user that connects.
This is so the individual user layers can be cleared.

Each layer is painted on by the user it is assigned to,
so the layer must respond to mouse events.
(mousedown/mousemove)


That sounds odd

Have you tried playing with the MaskColor and the MaskPicture ?

Could you strip down the problem and post a simple example ?

I've normally found UserControls fairly reliable, but have not tried
layering different instances of the same thing on top of each other

- look at the MaskPicture stuff ...

... also make sure the ScaleMode is vbPixels
- Twips are a nightmare when setting Pixels

Jul 17 '05 #4
Oh, also need HitTest to activate the mouse events.
Add:

' In UserControl.ctl
Private Sub UserControl_HitTest(X As Single, Y As Single, HitResult As
Integer)
If HitResult = vbHitResultOutside Then
HitResult = vbHitResultHit
End If
End Sub

"C. Alexander" <ca********@nospam.yahoo.com> wrote in message
news:%M******************@fe2.columbus.rr.com...
I didn't test any of the following.
Just some copy/past/modify concepts...
'-----------------------------------------------------
' In UserControl.ctl
'-----------------------------------------------------
' Properties:
AutoRedraw=True;BackStyle=Transparent;BorderStyle= None;WindowLess=True
'
Public Event MouseDown(Button As Integer, Shift As Integer, X As Single, Y
As Single)
Public Event MouseMove(Button As Integer, Shift As Integer, X As Single, Y
As Single)

Private Sub UserControl_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
RaiseEvent MouseDown(Button, Shift, X, Y)
End Sub

Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
RaiseEvent MouseMove(Button, Shift, X, Y)
End Sub

Public Sub SetPixColor(X As Single, Y As Single, Color As Long)
PSet (X, Y), Color
End Sub
'-----------------------------------------------------
'In Form1.frm
'-----------------------------------------------------

'
' Add a Image Control and set the Picture value to any image.
' Add the UserControl and place it over the Image Control
' Run the program, and click/drag on the area of the UserControl.
'
' The UserControl should turn from transparent, to the default background.
'

Private Sub UserControl1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (Button = 1) Then
UserControl1.SetPixColor X, Y, 0
End If
End Sub

Private Sub UserControl1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (Button = 1) Then
UserControl1.SetPixColor X, Y, 0
End If
End Sub

"J French" <er*****@nowhere.com> wrote in message
news:3f***************@news.btclick.com...
On Fri, 26 Sep 2003 18:23:11 GMT, "C. Alexander"
<ca********@nospam.yahoo.com> wrote:
I'm trying to create a multi-user interactive whiteboard
that has the ability to load a 'background' image to draw
ontop of.

The client/server needs to load a transparent layer for
each user that connects.
This is so the individual user layers can be cleared.

Each layer is painted on by the user it is assigned to,
so the layer must respond to mouse events.
(mousedown/mousemove)


That sounds odd

Have you tried playing with the MaskColor and the MaskPicture ?

Could you strip down the problem and post a simple example ?

I've normally found UserControls fairly reliable, but have not tried
layering different instances of the same thing on top of each other

- look at the MaskPicture stuff ...

... also make sure the ScaleMode is vbPixels
- Twips are a nightmare when setting Pixels


Jul 17 '05 #5
On Fri, 26 Sep 2003 19:51:23 GMT, "C. Alexander"
<ca********@nospam.yahoo.com> wrote:
I didn't test any of the following.


Hmm - HitTest - VB6 only

- maybe someone else can see something

- I think I would stick with MaskColor and MaskImage
Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Marcel | last post: by
4 posts views Thread by pcnerd | last post: by
2 posts views Thread by gerry | last post: by
2 posts views Thread by Joe | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.