|
-
Apr 13th, 2008, 06:39 AM
#1
Thread Starter
Lively Member
[2005] label transparencies (I have done my research...)
ok. I did my homework on this, and i cant believe its so difficult to do such a small thing.
So i need a label to have a transparent background over a picture.
however, setting the background to transparent and setting the parent to the picture box just wields weird results...
ill let the pictures explain. (the blue background screeny is the build)
what is going on...?!
Last edited by squrrilslayer; Apr 13th, 2008 at 07:32 AM.
-
Apr 13th, 2008, 08:24 AM
#2
Re: [2005] label transparencies (I have done my research...)
Have you tried using GDI+ to draw text directly on the background image?
-
Apr 13th, 2008, 08:45 AM
#3
Re: [2005] label transparencies (I have done my research...)
Apparently it is not simple. My understanding is just to paint the text of the label onto your picture.
as I am writing stanav beats me to it
-
Apr 13th, 2008, 05:22 PM
#4
Thread Starter
Lively Member
Re: [2005] label transparencies (I have done my research...)
sorry for the late reply, when i posted this i was getting no replys so i went to bed.
I saw alot of this drawing in/with GDI, just i never understood how to do so.
directions?
-
Apr 13th, 2008, 05:36 PM
#5
Re: [2005] label transparencies (I have done my research...)
 Originally Posted by squrrilslayer
sorry for the late reply, when i posted this i was getting no replys so i went to bed.
I saw alot of this drawing in/with GDI, just i never understood how to do so.
directions?
In the PictureBox paint eventhandler:
VB.NET Code:
e.Graphics.DrawString("Hello", Me.Font, Brushes.Black, 10, 10)
-
Apr 13th, 2008, 05:59 PM
#6
Re: [2005] label transparencies (I have done my research...)
Just to elaborate on Atheist's post, the PictureBox is not intended to be a container, that is, it is not meant to be the parent of other controls. Therefore, as Atheist suggested, you either need to draw the text on the image during PictureBox's paint event, or you could use a panel instead of a PictureBox (Use the Panel's BackgroundImage property).
-
Apr 13th, 2008, 07:01 PM
#7
Thread Starter
Lively Member
Re: [2005] label transparencies (I have done my research...)
ok thanks. will try this out.
-
Apr 13th, 2008, 10:12 PM
#8
Thread Starter
Lively Member
Re: [2005] label transparencies (I have done my research...)
im having a bit of difficulty with this. I have this right:
vb Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim I As Integer
For I = 0 To 5
Spell(I) = False
Spell2(I) = False
Next
P1DmgMulti = 1
P2DmgMulti = 1
P1Speed = 3
P2Speed = 3
P1NoSpell = 0
P2NoSpell = 0
P1Score = 0
P2Score = 0
SpellBoxNumbers() <-- there is a blue squiggly line under this
End Sub
Private Sub SpellBoxNumbers(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
e.Graphics.DrawString("1", Me.Font, Brushes.Black, 17, 70)
End Sub
something is not right.
-
Apr 14th, 2008, 12:27 AM
#9
Re: [2005] label transparencies (I have done my research...)
 Originally Posted by squrrilslayer
Are you sure its the forms paint event you should handle?
-
Apr 14th, 2008, 12:35 AM
#10
Thread Starter
Lively Member
Re: [2005] label transparencies (I have done my research...)
 Originally Posted by Atheist
Are you sure its the forms paint event you should handle?
im not to sure... this is something i have never done before. All i need is numbers to display ontop of pictureboxes... without having ugly backgrounds.
-
Apr 14th, 2008, 12:36 AM
#11
Re: [2005] label transparencies (I have done my research...)
 Originally Posted by squrrilslayer
im not to sure... this is something i have never done before. All i need is numbers to display ontop of pictureboxes... without having ugly backgrounds.
Alright then, have a look at my last post
 Originally Posted by Atheist
In the PictureBox paint eventhandler:
VB.NET Code:
e.Graphics.DrawString("Hello", Me.Font, Brushes.Black, 10, 10)
-
Apr 14th, 2008, 12:50 AM
#12
Thread Starter
Lively Member
Re: [2005] label transparencies (I have done my research...)
vb Code:
e.Graphics.DrawString("Hello", Me.Font, Brushes.Black, 10, 10)
thats all good however how do i use it?
putting it in form load does not work, and having in painteventargs, i cant seem to use it.
whoa, another thing:
me.font is not what i want. I need the writing small.
-
Apr 14th, 2008, 02:41 AM
#13
Thread Starter
Lively Member
Re: [2005] label transparencies (I have done my research...)
can someone just write out a quick couple lines of code which writes something onto the form on form_load?
i keep getting null reference errors.
my lack of progress on such a seemingly simple thing is annoying me.
thanks~
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
|