Results 1 to 13 of 13

Thread: [2005] label transparencies (I have done my research...)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    95

    [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...?!
    Attached Images Attached Images    
    Last edited by squrrilslayer; Apr 13th, 2008 at 07:32 AM.

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: [2005] label transparencies (I have done my research...)

    Have you tried using GDI+ to draw text directly on the background image?

  3. #3
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    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
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    95

    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?

  5. #5
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2005] label transparencies (I have done my research...)

    Quote 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:
    1. e.Graphics.DrawString("Hello", Me.Font, Brushes.Black, 10, 10)
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  6. #6
    Frenzied Member circuits2's Avatar
    Join Date
    Sep 2006
    Location
    Kansas City, MO
    Posts
    1,027

    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).
    Show the love! Click (rate this post) under my name if I was helpful.

    My CodeBank Submissions: How to create a User Control | Move a form between Multiple Monitors (Screens) | Remove the MDI Client Border | Using Report Viewer with Visual Studio 2012 Express

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    95

    Re: [2005] label transparencies (I have done my research...)

    ok thanks. will try this out.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    95

    Re: [2005] label transparencies (I have done my research...)

    im having a bit of difficulty with this. I have this right:
    vb Code:
    1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         Dim I As Integer
    3.         For I = 0 To 5
    4.             Spell(I) = False
    5.             Spell2(I) = False
    6.         Next
    7.         P1DmgMulti = 1
    8.         P2DmgMulti = 1
    9.         P1Speed = 3
    10.         P2Speed = 3
    11.         P1NoSpell = 0
    12.         P2NoSpell = 0
    13.         P1Score = 0
    14.         P2Score = 0
    15.         SpellBoxNumbers()   <-- there is a blue squiggly line under this
    16.  
    17.  
    18.     End Sub
    19.  
    20.     Private Sub SpellBoxNumbers(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
    21.         e.Graphics.DrawString("1", Me.Font, Brushes.Black, 17, 70)
    22.  
    23.     End Sub

    something is not right.

  9. #9
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2005] label transparencies (I have done my research...)

    Quote Originally Posted by squrrilslayer
    ...
    vb Code:
    1. ...Handles Me.Paint
    Are you sure its the forms paint event you should handle?
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    95

    Re: [2005] label transparencies (I have done my research...)

    Quote 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.

  11. #11
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2005] label transparencies (I have done my research...)

    Quote 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

    Quote Originally Posted by Atheist
    In the PictureBox paint eventhandler:

    VB.NET Code:
    1. e.Graphics.DrawString("Hello", Me.Font, Brushes.Black, 10, 10)
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    95

    Re: [2005] label transparencies (I have done my research...)

    vb Code:
    1. 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.

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Mar 2008
    Posts
    95

    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
  •  



Click Here to Expand Forum to Full Width