473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 11504
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: daimler | last post by:
help!!!!!!!! i did a for i=1 to picture1.scaleheight/2 picture1.pset (i,i) next i and the pset is shown on the picture
4
by: Marcel | last post by:
Hello, Iīm trying to create a custom user control, but I didnīt wanted to put it inside a form, I wanted it to an object by itīs own.. I first created my class derived from Form, set the style to...
11
by: Noozer | last post by:
Does anyone know if we will be able to put transparent backgrounds on UserControls in VB 2004?
4
by: pcnerd | last post by:
I've been playing with "classic" VB since version 3. I have VB6 Learning Edition. Recently, I wanted to try VB.NET. I got a beginner's book with a CD with the software & installed it. There are...
2
by: gerry | last post by:
based on MSPress's ASP.NET 2.0 Applications Advaced Topics ( Table 12-3 p.472 ), and most events should be automatically wired up when @Control AutoEventWireup="true". ie. Page_InitComplete() {}...
5
by: Blue | last post by:
We have a custom word processing type editor built with C# and .NET 2.0 and we need to support typing in languages other than English. I want to be able to use the Windows IME to enter in text...
1
by: dragze | last post by:
Hi, On one of the pages of my site i use two javascripts, one makes transparency of png's work in IE, and the other embeds a flash player. Now use one of the scripts it works fine, use both and...
2
by: Joe | last post by:
Is it possible to inherit from a UserControl? If I try my user control class is not recognized. Thanks, Joe
8
HaLo2FrEeEk
by: HaLo2FrEeEk | last post by:
I'm working on an application that contains a UserControl that I made. I need this UserControl to have asemi-transparent background, but the controls need to stay 100% visible. Right now I'm using...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.