Results 1 to 32 of 32

Thread: Dealing With .NET Transparency Ctrls

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Angry Dealing With .NET Transparency Ctrls

    I like to graphically design some of my apps.
    But using .NET controls (picbox, label) is not to my liking.

    In VB6 I could put a label over any picture (on form or picturebx) and EVERYTHING under it would show.

    In .NET I have not found a way to do this.

    I've tried every transparency setting there is for label and picturebox, but still can not just do a simple task that was so easy in VB6.

    SEE ATTACHED PICTURE (below)

    It works fine if you just put it on a form... and thats it!
    It will work if you put a picture in the form. But the picture is tiled... so what about resizable forms where you only want the one instance of the picture to show... plus if you have a toolbar.... to bad...

    the top of the picture disappears under the toolbar!!

    What was MS thinking??

    How do they expect people to use these "transparency" on controls. The form color is really the transparent color!! duh

    THAT IS NOT TRANSPARENT!!

    I REPEAT...

    THAT IS NOT TRANSPARENT!!

    So, far I have liked .NET up to this point, but unless I can find some easily implementable methods to make ONE stupid label control "transparent" so that everything under it is VISIBLE....

    Then what is the point... Graphical interfaces are only do able if you create a graphic that shows it all.

    How will people make wizards that have labels of text over pictures that change frequently.

    COME ON MS.... WHAT ARE YOU THINKING!

    there, I am done ranting.

    Attached Images Attached Images  
    Last edited by epixelman; Mar 20th, 2005 at 12:59 PM.

  2. #2
    Junior Member
    Join Date
    Mar 2005
    Posts
    26

    Re: Disappointed With .NET Graphics

    if you want the label below other controls, make it first.
    might be a fix for the case after you've made all the controls and don't want to start over, but that's what i do.

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Disappointed With .NET Graphics

    Instead of a label control you could just use the graphics to draw the text on.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: Disappointed With .NET Graphics

    Choey,
    Ahh... great if I want to set the zorder.
    If you put the label behind the blue box... you won't see the label.

    I am talking about transparency.

    The label and picbox (dove) 's backcolor is set to Transparency.
    Do they look transparent to you?

    RobDog...
    I've tried that... but how do you put a whole paragraph from a textbox over a picture without sending each line one by one? Not to mention the re-painting of the text if another form goes over it.

    And how would you draw a transparent gif over the blue box?

    Thanks....

    But

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Disappointed With .NET Graphics

    There was a demo that would be perfect for you. I think it was be Wokawidget here in vb.net forum.
    I will look for it. Be back in a couple of hrs. Time to go home.

    Ewe, 9666 posts.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Disappointed With .NET Transparency Ctrls

    Found it! It was by wossname.

    ZOrder


    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: Disappointed With .NET Transparency Ctrls

    well.... that's nice.

    But, doesn't help a bit.

    How do I put a transparent gif on top of a picture box??
    How do I put a transparent paragraph of text on top of a picturebox??

    Is this to hard of a question?

    You can put these 2 controls on top of a form with a background picture and it will work. But you can't put them on top of a picture box or panel. (see below)

    As you can see with the 2nd pic... the transparency does not show the brick background of the picbox... but the form background.

    That is no TRUE transparency!!
    .
    Attached Images Attached Images  
    Last edited by epixelman; Mar 19th, 2005 at 07:17 AM.

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: Disappointed With .NET Transparency Ctrls

    If I could use just the form, that would be great.

    But you have no control over the background picture because...

    1) It only tiles the pictures. So if I needed to display just one picture (not tiled) then I would have to size the form to the size of the picture. Leaving me no choice but to use Single Fixed for borderstyle. So if the pic changes the border would have to change to.

    2) You can put a toolbar (or any other controls) on the form. But any picture you put in the background will be covered up by the other controls.

    How is anyone suppose to make a graphical application if they can't even use transparent controls that can be moved around.

    Very disappointed...


  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: Disappointed With .NET Transparency Ctrls

    I only see one way to get around the transparent label...

    and that is find a standlone OCX label that supports "TRUE" transparency that I can convert with a wrapper DLL to use in .NET

    Anyone know of an OCX label just like the one on the standard toolbox of VB6???

    I would really appreciate it.

    FYI... I did find a .NET label control off of PSC that someone tried to make. And it does work for one line only... it's buggy though. Doesn't wrap the text like a regular label control is suppose to. So I can't use it.

    I'd make one myself, but haven't got a clue how to.

    Thanks

  10. #10
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Disappointed With .NET Transparency Ctrls

    Have you tried making your own standalone OCX, with but a simple label on it? It is pretty easy, and you can do the resizing stuff in a few lines of code. "Inheriting" Properties from the OCX to the Label might be a trick...
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  11. #11
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Disappointed With .NET Transparency Ctrls

    OK, as the resident graphics boffin ...

    1. Its dead easy to draw a paragraph of text onto a picturebox (assuming it doesn't spill over onto another control. Just take a look at the Graphics.DrawString(...) overrides and you will find one that lets you specify a rectangle to draw the text inside. You can work out the rest.

    2. Transparency of controls can be accomplished but it is pretty low level. You may have to resort to blitting from a graphics object. I hate using bitblt because it is not framework.
    I don't live here any more.

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: Disappointed With .NET Transparency Ctrls

    Quote Originally Posted by Dave Sell
    Have you tried making your own standalone OCX, with but a simple label on it? It is pretty easy, and you can do the resizing stuff in a few lines of code. "Inheriting" Properties from the OCX to the Label might be a trick...
    I've never made a control in VB6 or .NET

    I could try in VB6... because the label is already made. I would just have to figure out how to add all those properties.

    Can you help me and get me started?

  13. #13

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: Disappointed With .NET Transparency Ctrls

    Quote Originally Posted by wossname
    OK, as the resident graphics boffin ...

    1. Its dead easy to draw a paragraph of text onto a picturebox (assuming it doesn't spill over onto another control. Just take a look at the Graphics.DrawString(...) overrides and you will find one that lets you specify a rectangle to draw the text inside. You can work out the rest.

    2. Transparency of controls can be accomplished but it is pretty low level. You may have to resort to blitting from a graphics object. I hate using bitblt because it is not framework.

    The paragraph text would always change and I would never know how long it would be. I have to contain the text in a given area that depends on the size of the area because the form is resized.

    I want to stay with true framework... no VB6 code.

  14. #14

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: Disappointed With .NET Transparency Ctrls

    If I did create my own OCX in VB6...

    The only properties I need to talk to would be...

    label1.backstyle
    label1.backcolor
    label1.forecolor
    label1.caption
    label1.alignment
    label1.Font
    label1.height
    label1.width
    label1.left
    label1..top
    label1.index
    label1.tag
    label1.visble
    label1.tooltip
    label1.wordwrap


    That's about it

  15. #15
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Disappointed With .NET Transparency Ctrls

    A bitblt demo in .net. Create a form and add a button to the bottom right corner. then add this code to the button's click event.

    With some tinkering, this could be used to simulate transparency.

    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.  
    3.  
    4.         Dim dest As Graphics = Me.CreateGraphics
    5.         Dim src As Graphics = Button1.CreateGraphics
    6.  
    7.         Dim destH As IntPtr = dest.GetHdc()
    8.         Dim srcH As IntPtr = src.GetHdc()
    9.  
    10.         BitBlt(destH.ToInt32, 10, 10, Button1.Width, Button1.Height, srcH.ToInt32, 0, 0, 13369376)
    11.  
    12.         dest.ReleaseHdc(destH)
    13.         src.ReleaseHdc(srcH)
    14.  
    15.     End Sub

    Anyway I'm busy now so this is the last i shall say on the subject for a while anyway.
    I don't live here any more.

  16. #16
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Disappointed With .NET Transparency Ctrls

    Quote Originally Posted by epixelman
    I would never know how long it would be.

    Graphics.MeasureString(...)
    I don't live here any more.

  17. #17
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Disappointed With .NET Transparency Ctrls

    I don't know when I'll have the time to mess around with this, but here are some useful links:

    http://blogs.msdn.com/ajma/articles/213868.aspx
    http://www.freevbcode.com/ShowCode.Asp?ID=1695

    It really should be pretty straigtforward if you use the "ActiveX Control Interface Wizard".

    Make a new ActiveX Control project, drop a Label on it, and run the wizard!

    I dunno if it includes this, but I like to use this too, if I'm just extending a single Control like you will be:

    VB Code:
    1. Private Sub UserControl_Resize()
    2.     Height = LabelControl.Height
    3.     Width = LabelControl.Width
    4.     LabelControl.Top = 0
    5.     LabelControl.Left = 0
    6. End Sub
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  18. #18

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: Disappointed With .NET Transparency Ctrls

    Thanks,

    I'll give it a try

  19. #19
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Disappointed With .NET Transparency Ctrls

    Quote Originally Posted by epixelman
    Thanks,
    I'll give it a try
    Cool, good luck! Also make sure to use Binary Compatibility:

    http://www.vbforums.com/showthread.p...=10+easy+steps

    If you get stuck, just ask! Might be better to pose new questions in the COM & ActiveX Forum.
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  20. #20

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: Disappointed With .NET Transparency Ctrls

    What Wizard??

  21. #21
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: Disappointed With .NET Transparency Ctrls

    ....
    Attached Images Attached Images  
    Nobody knows what software they want until after you've delivered what they originally asked for.

    Don't solve problems which don't exist.

    "If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)

    2 idiots don't make a genius.

  22. #22

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: Disappointed With .NET Transparency Ctrls

    Okay... got it.

    I play with this for awhile

    Do you know how I can make the UserControl transparent that will work on Win9x? I know it will work on XP

    Thanks

  23. #23
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Disappointed With .NET Transparency Ctrls

    Quote Originally Posted by epixelman
    Okay... got it.

    I play with this for awhile

    Do you know how I can make the UserControl transparent that will work on Win9x? I know it will work on XP

    Thanks
    i dont think transparency is supported at all in the 9x systems... i believe the first OS to include that in the API is 2000

  24. #24
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Disappointed With .NET Transparency Ctrls

    Quote Originally Posted by kleinma
    i dont think transparency is supported at all in the 9x systems... i believe the first OS to include that in the API is 2000
    I would think that any OS that can run the framework will be fine for transparencies as done in .net code.
    I don't live here any more.

  25. #25
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091

    Re: Disappointed With .NET Transparency Ctrls

    Quote Originally Posted by wossname
    I would think that any OS that can run the framework will be fine for transparencies as done in .net code.
    The documentation states that it only works on platforms that support layered windows, ie 2k, XP, and 2k3.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  26. #26

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: Disappointed With .NET Transparency Ctrls

    I have started a thread in the ActiveX - COM forum.

    I am developing a label control (VB6) that I will beable to use in .NET

    Go there to view more...
    http://www.vbforums.com/showthread.p...=1#post1953633
    Last edited by epixelman; Mar 19th, 2005 at 05:04 PM.

  27. #27

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: Disappointed With .NET Transparency Ctrls

    Part of the solution to this thread is the creation of an OCX file that will work in .NET

    At this time, I have it working but I have one problem I can't figure out.

    Please go to this thread (Com and ActiveX) to help fix my problem...

    http://www.vbforums.com/showthread.p...=1#post1953633

    P.S. I don't like posting in the "Com And ActiveX" forum (even though I have to) because people don't visit enough.... So I will post here concerning updates until this thread is solved.

    Thanks
    .
    Last edited by epixelman; Mar 19th, 2005 at 09:56 PM.

  28. #28

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: Disappointed With .NET Transparency Ctrls

    Okay... I am just a few feet to finding a solution for the .NET label transparency.

    I have one problem with the control I am making...

    See thread...

    http://www.vbforums.com/showthread.p...=1#post1953633

    .

  29. #29

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: Dealing With .NET Transparency Ctrls

    Okay... I got the control to work, but now I have a graphic look problem...

    JAGGIES

    Please see more at...

    http://www.vbforums.com/showthread.p...=1#post1953633

    .

  30. #30
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Disappointed With .NET Transparency Ctrls

    Quote Originally Posted by epixelman
    I am developing a label control (VB6) that I will beable to use in .NET
    That really isn't necessary...

    http://www.vbforums.com/showpost.php...1&postcount=12

    :smug:
    I don't live here any more.

  31. #31

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Posts
    1,005

    Re: Dealing With .NET Transparency Ctrls

    Hey Wossname

    How is that transparent label going?

    Thanks
    Frank

  32. #32
    Fanatic Member
    Join Date
    Jul 2003
    Posts
    830

    Re: Dealing With .NET Transparency Ctrls

    Start a project
    Put two picturebox's on the form
    Set the background picture of one form to whatever you like.
    Set the image property of the other picturebox to contain a transparent gif and set the backcolor to transparent.

    Now you want the transparent gif to show the background of the first picturebox and NOT the background of the form.

    Here it is.....one friggin line....


    PictureBox2.Controls.Add(PictureBox1)

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