Need An Expert! Make A Usercontrol Transparent From A Picture In A Picturebox
any ideas?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Make A Picturebox Transparent...
Here an example to make a picturebox transparent... Is resulted from a bit searching with Google and something do handicraft with the attempt to agree imagebox transparent. A lot of fun while using... 8)
How Do You Make A Picturebox Transparent?
I am trying to make a picturebox, with the name label, Picture1 transparent. However not the pen marks that the user makes when they draw using the mouse clicks, etc.
However Picture1, only makes "Box" marks using the mouse and nothing else. Then select objects on Frame1, using Picture1.
The "Box" marks are made using the Picture1.Line... command.
Make A Color In A Picturebox Transparent
Hi,
I have got a picturebox with a picture inside.
The picture is an icon with a black (or other color) background.
I want to show the picture in such way that the background is invisible (such as a mask), thus I want to make a specific color transparent.
Ive googled alot, but couldnt find anything practical.
I would like an as short and simple code as possible.
Thanks,
psycix
Anyone Know :How To Make The Background Of A PictureBox Transparent ?
I have a transparent image in Picture2.pictureBox
Picture2.dragmode = Automatic
I move it to Picture1
Picture2.container = Picture1
I drag it around BUT the rectangular outline of Picture2 is VISIBLE !
How to make it Transparent ??
OR is this the same as deciding that e = mc*2 !
Don't ignore me... PLEASE !!!
Make Background Color Of Picturebox Transparent (in The Image)?
If I copy the data from a picture box to an image control, I get the background color of the picture box with the image and it looks really bad. Is there any way that make the background color transparent so that you can see what's underneith the image control?
How Make Image Picture = Picture Drawed In Picturebox
hi i need some help here friends
how can i make image.picture = drawed picturebox
this is my example
Code:
Option Explicit
Const DI_MASK = &H1
Const DI_IMAGE = &H2
Const DI_NORMAL = DI_MASK Or DI_IMAGE
Private Declare Function ExtractAssociatedIcon Lib "shell32.dll" Alias "ExtractAssociatedIconA" (ByVal hInst As Long, ByVal lpIconPath As String, lpiIcon As Long) As Long
Private Declare Function DrawIconEx Lib "user32.dll" (ByVal hdc As Long, ByVal xLeft As Long, ByVal yTop As Long, ByVal hIcon As Long, ByVal cxWidth As Long, ByVal cyWidth As Long, ByVal istepIfAniCur As Long, ByVal hbrFlickerFreeDraw As Long, ByVal diFlags As Long) As Long
Private Declare Function DestroyIcon Lib "user32.dll" (ByVal hIcon As Long) As Long
Private Sub Command1_Click()
Dim hIconHandle As Long
Dim sPath As String
sPath = (App.Path + "" + "1.txt")
hIconHandle = ExtractAssociatedIcon(Me.hWnd, sPath, 0)
p.Cls
If hIconHandle Then
Dim div As Long
p.ScaleMode = vbPixels
div = Screen.TwipsPerPixelX
ScaleMode = p
DrawIconEx p.hdc, 0, 0, hIconHandle, p.Width / div, p.Height / div, 0, 0, DI_NORMAL
DestroyIcon hIconHandle
End If
Exit Sub
Image1.Picture = p.Picture
End Sub
it did not work for image
Image1.Picture = p.Picture
thanks alot
How To Make A Picture Box Transparent
is there a way to make a picture box transparent? I know you can change the background color, but I can't figure out how to make it transparent. Thanks.
To Make Part Of The Picture Transparent
hey, every one.
if i load a picture directly to the form. is it possible to make part of the picture transparent? and is it possible that the loaded picture overlape whose shapes on the form???
How Do I Make A Picture With Transparent Background?
Im making a visual basic game just to test out some basics of programming.
Basically, its a game with tanks that can move around and shoot missiles at eachother to blow one-another up.
Anywho, the image box pictures are made in Paint.
So the tanks have a white background around them in the shape of a square.
Does anyone know how to get rid of that white backgroud?
Or how to make the white background transparent?
Maybe I need to use another drawing interface than paint?
Let me know, Thanks
How Do You Make Parts Of A Picture Transparent With BitBlt?
I want to make a certain color in a picture transparent for use in Vb. I don't know much about BitBlt, past knowing how to spell it. If I want to have transparent images in Vb, is BitBlt the way to go? If so, how do I make transparent images with BitBlt?
How Do You Make A Picturebox Keep It's Picture
Ok I have a Picture box and I am using the SetPixel API call to draw a picture in it, however if you minimize it or open something infront of it, or turn autorefresh on it or refresh the picture box, everything you have drawn on it disapears. I mean completely, if you try to do a get pixel color it doesn;t return what was there just you background spec, anyone no a work around for this.
I have downloaded tons of code from planet sourcecode and here and stuff and all of them do the same thing, when minimized or another form goes up on top or something everything in the pic box gets erased. At first I thought it was just me but after reviewing a ton of code on planet source code I find it isn;t just me.
Transparent UserControl, Transparent Label...problems
Hi all!!!
There is a strange problem with Transparent UserContrls and transparent Labels in VB 6.0. I developed ocx in VB 6.0 with a user control and a label. Added this control a vb form and run the application and in runtime the transparency for both, UserControl and Label. The problem is that the both controls dissapear....strange isnt it???
Is there somebody which have an ideea how we can solve this problem.
Attached you can find my example....
Thanks,
Leo
Expert Question: Why Is Blitting Slower In A Usercontrol?
I'm using bitblt for some animation in my program:
Call BitBlt(picStocksBuffer.hdc, 0, i% * iRowHeight, 600, iRowHeight, mvarRowPicture(iIndex).hdc, 0, 0, SRCCOPY)
Basically, I'm copying the picture of mvarRowPicture(iIndex) to the picture of picStocksBuffer (which are both pictureboxes).
Now when I execute this code in an .ocx usercontrol (with the pictureboxes on the usercontrol) instead of my standard form, it is slower about TEN times ! (about 0.08sec instead of 0.009 on the standard form).
Anybody has an explanation for this ?
Thanks a lot,
Felix
Usercontrol Properties - Needs Expert, Hack? Plendj? Ednidndisis?
Ok, I am dealing with property pages here...
If you look at a treeview/listviews property pages you can see that you can set an imagelist at designtime, via the property page...How is this possible? Or does it need complicated API or something else?
I tried the following, which didn't work...
VB Code:
Dim woof As Control For Each woof In SelectedControls(0).Parent 'ERROR: Object does not support this property or method...:mad: If TypeOf woof Is ImageList Then Combo1.AddItem woof.Name End If Next
Any ideas on how to assign an imagelist at design time?
Wokawoooo...
Transparent Label On A Transparent UserControl
Hi,
If you create a UserControl and make the BackStyle Transparent and then place a label control with a caption in it onto to the UserControl (as part of the UserControl) and make the label also Transparent, then if you place this UserControl on a form, the labels caption is not visible.
Any ideas why, or how to overcome this?
Thanks,
Rob D. ProIV Resource Centre www.proivrc.com
Transparent Usercontrol
I have a usercontrol with 9 image controls on it that make a card..., 8 of the controls are the border of the card...
there is a shadow and white at the corners that I would like to be transperant.., so it looks like the control is the shape of the card....
how can I do this?
thanx in advanced,
Byan
Transparent UserControl??
Using VB6, can I make a UserControl Form (OCX) transparent?
I want to make put a label (backstyle = transparent) on it too.
I am making (trying to anyways) a transparent label OCX.
And if I can make the UserControl transparent... will it work with Win9x. I know transparency work on XP.
Thanks
Transparent UserControl
What property must an item have to be able to show up on a transparent user control? I know that a command button will, but a line wont?
Transparent UserControl
How can i maintain transparency when i use an image control on my usercontrol? If i set the Controls BackStyle to transparent, it is transparent except for where the image control is. Is there a way around this?
Transparent UserControl
Hi!
I have a very big problem with my Control!
the background of the control should be transparent and the text written on the control by UserControl.print "Test"
should be visible. So it should look like the label-control.
I hope somebody can help me!
Thanx
Daniel
Problemes With Transparent Usercontrol
i made an user control that uses a mask picture to display the areas transparent and non transparent, it work in my computer fine, but when i made a setup using "inno2 setup", and installed it on another computer, the areas that may by transparent is showing, and all the areas is non-transparents.
Usercontrol Seen In IDE Transparent In Run/Compiled
hi there I'm got a quick question
I've finished My SMTP usercontrol, but I wanted a little tweak and thats when I run in a problem.
In the usercontrol their is an image this image is seen when the user places the control on the forum (like the winsock control).
The problem is when I run the control in a project I want the control surface to go transparent ( know i can use the Backstyle to transparent) but this is no good in the IDE where I want to see the image or possibly move the control.
If I remember You can check to see if you are runing in the IDE by err!! cannot remember but the IDE I think is called "ThunderBird". So what i would like is:
(A) In Desgn mode I see the image.
(B) run in IDE or Compiled and run image is transparent.
The pig..
Transparent Usercontrol Background!!!
Hello everybody, I recently developed an usercontrol in vb6 but the problem is I just can't make it transparent (only the background) so that it would display the background of the form (its backcolor or any picture) and not a button face rectangle. Please help.
Also can somebody tell me how to use picture in that usercontrol.
Drawing On A Transparent Usercontrol...
I need to be able to overlap usercontrols with userdrawn items on them. Unfortunately, the shapes I'm drawing get covered up by the other usercontrols. Is there a way to have a transparent control that still allows drawing code to work? I've tried setting the Windowless property to True, and it didn't do anything.
Making UserControl Transparent
Hi,
I'm creating a control that will inlude two properties:
- BackColor
- Transparent (BackStyle T/F)
I want to be able to change the BackColor of the control. That's not a problem. However how do I change the Transparent property so when I change it to True the control will be transparent, AND when I change it back to False, the control will get it's previously set BackColor?
I want EXACTLY the same behaviour that a regular label has (with respect to BackColor and BackStyle properties).
Please provide a sample.
Thanks
Expert On Vb Picture Box , Please Come In
I have a picture box called "picpaint" , in order to be able to load images larger than the picture box, I also have scroll bars and another picture box "picwindow"..
my program could draw on the picture box, it makes me frustrated because when I draw something at the far end right bottom corner of the picture box(using scroll bar and scroll to that area ,of course), and scroll back, then scroll to that far end corner again, the drawing is not there any more.
any idea how to fix this?
thanks
Transparent Usercontrol Background With Images
Hello. I'm trying to make a custom control that looks like a Mac OS X Panther button, and I need it to be shaped in the rounded shape so you can see what's behind it instead of the color of the usercontrol background. I don't know how to use BitBlt or any of that kind of stuff, so I was wondering if someone could give me an example of how to use that type of thing to create images from code, without having the actual images on the usercontrol. I have no idea how people do it, make images from scratch. Please help!
Translucent Usercontrol Appearing As Transparent
Hello,
When I place the SetLayeredWindowAttributes example code from AllAPI.net into a form it works perfectly. When I place it in a usercontrol, modifying accordingly, it doesn't work.
Does this not work in usercontrols?
Thanks
Code:
Const LWA_COLORKEY = &H1
Const LWA_ALPHA = &H2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
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 Sub UserControl_Initialize()
'KPD-Team 2000
'URL: [url]http://www.allapi.net/[/url]
'E-Mail: [email]KPDTeam@Allapi.net[/email]
Dim Ret As Long
'Set the window style to 'Layered'
Ret = GetWindowLong(UserControl.hWnd, GWL_EXSTYLE)
Ret = Ret Or WS_EX_LAYERED
SetWindowLong UserControl.hWnd, GWL_EXSTYLE, Ret
'Set the opacity of the layered window to 128
SetLayeredWindowAttributes UserControl.hWnd, 0, 128, LWA_ALPHA
End Sub
Transparent Usercontrol Doesn't Work For Me
I needed a simple control with transparent background, - caption (left), - icon (right),
+ ToolTipText prop. + Click event.
First I made a simplier icon-control, that has an Image control (with ToolTipText prop.),
and I have set the followings for UserControl:
BackStyle (0), MaskColor (&H00FFFFFF&), MaskPicture, AutoRedraw (true)
It's not enought. My control is not transparent.
Even worst, it was sometimes (2 days ago), but not now, and don't know why.
What's missing?
Any help? or Sample?
Thanks
PS: Dev: Win2k,Vb6prof; App: Win9x
Transparent Usercontrol && Special Keys
i was building a usercontrol (overlay grid) with backstyle=transparent
because it doesn't receive mousedown/mousemove events (except when on the gridlines) i had to make it Windowless as well
this usercontrol is used on a form (how amazing) where i do the key handling
but now some of the special keys (esp. cursor keys) won't work anymore (though keypreview is turned on)
is this a misconception of mine?
or is this a flaw in VB6sp6/Win2k?
RESOLUTION
yes indeed is it caused by VB
for some reason and under certain circumstances VB doesn't give you all KeyCodes in Form_KEYUP / Form_KEYDOWN
i got around this in basically three steps:
1 implement a low-level keyboard handler, and hook that into Windows (WH_KEYBOARD_LL)
2 determine which, if any, of my forms is active
3 reroute the detected keycode and shift state to that form
anybody interested in code can mail me, it is too much to post here
Wim
Edited by - Wimmie!! on 7/26/2006 9:55:23 AM
Draw A Transparent Image On A Usercontrol
I am making a little close button that draws a border when the cursor is over it. I took a screenshot of the X that closes the treeview in Explorer and created an icon. When I use UserControl.PaintPicture I can draw the button but I am getting a white background for some reason. Is there a way to draw the picture but ignore the background?
Just in case, I know that there must be a constant somewhere that I could use with the DrawFrame API that would draw the complete button. If somebody knows what it is I could skip the above question (I don't mean the standard close button, this is a mouse-over button)
God Bless America
Edited by - IDontKnow on 1/22/2004 11:35:24 AM
UserControl: Frame With Transparent Bkgd
I am trying to make a Frame with a transparent background, if i use a regular frame, it hides the backgroud images of my form (i'm using a skinned form)
I tried creating an empty usercontrol and setting its ControlContainer property to True, and it works, but it behaves funny when i set its background style to Transparent, some of the controls i paste inside it dissapear!!!
when it's not transparent, i can see those controls.
any suggestions?
How To Make A Transparent GIF With A Transparent Background?
Hi, im kinda new to VB and im trying to make nice form with a custom picture i designed. Since the picture isnt rectangular i have to use transparency so it doesnt stay ugly. If i just set the transparent GIF as a background the transparent section of the gif will show the form background and not the desktop (or whatever is behind the app) like this:
Form 1
Then i used this code to make the background transparent:
Code:
Option Explicit
Private Declare Function CreateRectRgn Lib _
"gdi32" (ByVal X1 As Long, ByVal Y1 As Long, _
ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function CombineRgn Lib _
"gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, _
ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Private Declare Function SetWindowRgn Lib _
"user32" (ByVal hWnd As Long, ByVal hRgn As Long, _
ByVal bRedraw As Boolean) As Long
Private Declare Function DeleteObject Lib _
"gdi32" (ByVal hObject As Long) As Long
' Constants used by the CombineRgn function
Private Const RGN_AND = 1
Private Const RGN_OR = 2
Private Const RGN_XOR = 3
Private Const RGN_DIFF = 4
Private Const RGN_COPY = 5
Private Sub Form_Activate()
Dim rgnForm As Long, rgnCombined As Long
Dim rgnControl As Long, x As Long
Dim formWidth As Single, formHeight As Single
Dim borderWidth As Single, titleHeight As Single
Dim ctlLeft As Single, ctlTop As Single
Dim ctlWidth As Single, ctlHeight As Single
Dim ctl As Control
' Calculate the form area
borderWidth = (Me.Width - Me.ScaleWidth) / 2
titleHeight = Me.Height - Me.ScaleHeight - borderWidth
' Convert to Pixels
borderWidth = ScaleX(borderWidth, vbTwips, vbPixels)
titleHeight = ScaleY(titleHeight, vbTwips, vbPixels)
formWidth = ScaleX(Me.Width, vbTwips, vbPixels)
formHeight = ScaleY(Me.Height, vbTwips, vbPixels)
' Create a region for the whole form
rgnForm = CreateRectRgn(0, 0, formWidth, formHeight)
rgnCombined = CreateRectRgn(0, 0, 0, 0)
' Make the graphical area transparent by combining the two regions
x = CombineRgn(rgnCombined, rgnForm, rgnForm, RGN_DIFF)
' Make the controls visible
For Each ctl In Controls
' Make the regions of controls whose container is the form visible
If TypeOf ctl.Container Is Form Then
ctlLeft = ScaleX(ctl.Left, vbTwips, vbPixels) + borderWidth
ctlTop = ScaleX(ctl.Top, vbTwips, vbPixels) + titleHeight
ctlWidth = ScaleX(ctl.Width, vbTwips, vbPixels) + ctlLeft
ctlHeight = ScaleX(ctl.Height, vbTwips, vbPixels) + ctlTop
rgnControl = CreateRectRgn(ctlLeft, ctlTop, ctlWidth, ctlHeight)
x = CombineRgn(rgnCombined, rgnCombined, rgnControl, RGN_OR)
End If
Next ctl
' Set the clipping area of the window using the resulting region
SetWindowRgn hWnd, rgnCombined, True
' Tidy up
x = DeleteObject(rgnCombined)
x = DeleteObject(rgnControl)
x = DeleteObject(rgnForm)
End Sub
The form stays transparent but the background picture of the form is invisible as well. Then i tried to add the background picture as a picture box but the transparent parts kept showing the form background color and not the desktop like this:
Form 2
This is how i want it to look:
Form 3
Any help would be greatly apreciated.
Thanks in advanced.
UserControl As Picturebox
I was just messing around with making activex controls so i thought i'd try making my own type of picturebox using just the Usercontrol as the picture container. Everything seams to be alright but as you know, a form or Usercontrol doesnt have AutoResize, to size the control to the picture. I thought i would make my own AutoResize but it isnt working. The only place i can get a picture Width and Height are in the Get and Set Picture property of the usercontrol code. The problem there is that the Height and Width properties differ from the accual bitmap i load into it. My bitmap is 960x512 and the control says the demensions are 20320x10837. Of course, when i resize the control to the picture size, it is more than double the size of the accual bitmap. I guess my question is, Do i need to convert what the control is telling me is the size of the picture from twips to pixels? If so, how do i do that? Thanks......
UserControl And PictureBox
I have never created a UserControl before and am working on my first one now. So I have two issues that I need help with. First, when you create a new UserControl, there are the intrisic properties that come along with it. How can I add to those properties so that when I call it from the UserControl's container form I can do it like this:
UserControl1.MyProperty = MyValue
???
Secondly, I am having trouble using pictureboxes on the UserContorl. Maybe I would have the same trouble if I used them in this way on a regurlar form too... I don't know. But anyway, this is what I am doing. I have two pictureboxes (picCon and picX). picX is a child of picCon. picX has four lines in it. When mouse moves over picX I want these lines to show... but when mouse moves over picCon I want these lines to be invisible. So this is the code that I have:
Private Sub picX_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
lin1.Visible = True
lin2.Visible = True
lin3.Visible = True
lin4.Visible = True
End Sub
Private Sub picCon_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
lin1.Visible = False
lin2.Visible = False
lin3.Visible = False
lin4.Visible = False
End Sub
Both events fire properly. I move my mouse cursor over picX and the lines show. However when I move my cursor out of picX and over picCon the lines still are visible. I set a breakpoint on Sub picCon_MouseMove and it breaks and executes the code properly and the lines disappear. With no breakpoint the lines will not disappear and they will not become invisible until I move my mouse cursor out of the UserControl and onto other areas of my container form. This leads me to believe that there is something I must change with the way the UserControl or the pictureboxes repaint, but I do not know what or how I should do it.
If you could help on this, I would greatly appreciate it... and thanks in advance.
|