Results 1 to 15 of 15

Thread: VB6 - Transparent UserControls for XP/Vista

Hybrid View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2007
    Posts
    146

    VB6 - Transparent UserControls for XP/Vista

    Title : Transparent UserControls for XP/Vista
    Description : XpControls allow you to make real XP/Vista TabStrips.
    Feature list :
    • XpGroupbox with 5 different borderstyles
    • XpOptionCheck
    • XpDivider

    Screen-shots:
    Default VB TabStrip


    XpControls TabStrip


    See sample project for more.

    Author name: Jottum
    System Requirements: XP/Vista (W2K legacy support)
    License info: Freeware
    Attached Files Attached Files
    Last edited by Jottum; Aug 1st, 2007 at 02:14 AM.

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Jul 2007
    Posts
    146

    Re: VB6 - Transparent UserControls for XP/Vista

    Not sure how this happened, but the attached sample project has a few drawing errors when on W2K or if themes are disabled on XP/Vista.

    I've corrected this and attached the new project, I'm sorry for the inconvenience.
    Attached Files Attached Files
    Last edited by Jottum; Aug 1st, 2007 at 02:13 AM.

  3. #3

    Re: VB6 - Transparent UserControls for XP/Vista

    The controls you have given are not the transparent one's. But they are having the white color as the background when you are using the property as transparent & its of no use if you have the background color or image rather than just having the white color. Is it possible to make them actually transparent so that the text caption of the checkbox or radio button will be displayed even if on the image. Waiting for your reply though the post is too old. thanks in advance...

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jul 2007
    Posts
    146

    Re: VB6 - Transparent UserControls for XP/Vista

    Quote Originally Posted by SwapsRulez
    The controls you have given are not the transparent one's. But they are having the white color as the background when you are using the property as transparent & its of no use if you have the background color or image rather than just having the white color. Is it possible to make them actually transparent so that the text caption of the checkbox or radio button will be displayed even if on the image. Waiting for your reply though the post is too old. thanks in advance...
    Hi,

    Have you looked at the sample project?

    If you follow the few guidelines there are, they are transparent. Or better, they look as if they are.

    I wrote these controls to enable a programmer to create Tabbed dialogs with the XP gradient on a tab. (Vista no longer has a gradient TabBody)

    First, they don't work with the SP6 controls, because they are not theme aware. You'll have to use the SP5 TabStrip.

    Second, even the SP5 TabStrip doesn't paint the gradient on XP and to show it anyway I'm using a trick.

    I wrote a function called DrawTabStripCheat, this draws the gradient on the form the Tabstrip is on, precisely where the TabStrip is on the form.

    Each Transparent control has a UseParenFormhDC property and if you set that to True for each Transparent control, it will use that to paint its background, effectively rendering the control transparent.

    This means, if you draw anything else on the form and set UseParenFormhDC to True it will use that as its background. If that's what you're after, you shouldn't use the DrawTabStripCheat function of course.

    So, the steps you have to take:

    • Put a Tabstrip on a form
    • Use XpGroupBoxes with BorderStyle = None as your Tabpage containers
    • Place other XpGroupboxes with whatever borderstyle and the OptionCheckboxes on the TabPage containers and if what ever you want as transparent background is drawn on the form, set for each and every Transparent Control the UseParenFormhDC property to true.


    It works, as the sample project shows and this screenshot I just made on my XP box.



    HTH
    Jottum™
    XpVistaControls , (transparent) usercontrols for XP, Vista and 7 with W2K legacy support.

  5. #5

    Re: VB6 - Transparent UserControls for XP/Vista

    Hi there, thanks for that quick reply, but i think in the project controls were locked. I removed that lock. After that i've taken picture box control & put one of those radio button on that picture control. You can see here in the screenshot that the checkbox is having the white as the background color though i've selected the property as the transparent. see here the screenshots...

    The output window



    The VB IDE window



    Also my OS is Windows XP with that Vista Inspirat 2 theme, Waiting for your reply... thanks in advance...
    Last edited by SwapsRulez; Feb 3rd, 2008 at 02:53 PM.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jul 2007
    Posts
    146

    Re: VB6 - Transparent UserControls for XP/Vista

    Hi,

    Your'e welcom. I can't see it from your screenshots, but I think you didn't set the UseParentFormhDC to False for the checkbox you've put on that picturebox.

    Please note that in the IDE the result isn't always imidiatly visible, closing and opening the form again will solve that.

    Let me know if you can get it to work.
    Jottum™
    XpVistaControls , (transparent) usercontrols for XP, Vista and 7 with W2K legacy support.

  7. #7

    Re: VB6 - Transparent UserControls for XP/Vista

    it was set to false already, but i've set it once again. Saved the project. & Then run it. But still no chances, same output.
    After that i've closed the project & opened it again, as my bad luck, the project is showing again the same output with that UseParentFormhDC to False. Waiting for the reply. Thanks in advance.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Jul 2007
    Posts
    146

    Re: VB6 - Transparent UserControls for XP/Vista

    Quote Originally Posted by SwapsRulez
    it was set to false already, but i've set it once again. Saved the project. & Then run it. But still no chances, same output.
    After that i've closed the project & opened it again, as my bad luck, the project is showing again the same output with that UseParentFormhDC to False. Waiting for the reply. Thanks in advance.
    To be honest, I don't get it. I just did the same thing you have done on the same form and this is the result:



    If it works for me, but doesn't for you, I really don't know what else to advise you. I'm sorry. One more thing, you are using a Picturebox and not an Image control are you? It doesn't work with an Image control because it doesn't have DC.
    Jottum™
    XpVistaControls , (transparent) usercontrols for XP, Vista and 7 with W2K legacy support.

  9. #9

    Re: VB6 - Transparent UserControls for XP/Vista

    Can u send that project to me in the zip file. Really i swear... here its not working though i've tried with both the image & picture controls. Thanks in advance...

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Jul 2007
    Posts
    146

    Re: VB6 - Transparent UserControls for XP/Vista

    Quote Originally Posted by SwapsRulez
    Can u send that project to me in the zip file. Really i swear... here its not working though i've tried with both the image & picture controls. Thanks in advance...
    Sure, you can grab it here. Let me know if it works.
    Jottum™
    XpVistaControls , (transparent) usercontrols for XP, Vista and 7 with W2K legacy support.

  11. #11

    Re: VB6 - Transparent UserControls for XP/Vista

    mate.... hurray..... it worked.... but what was problem with mine. also the buttons are not working properly in your project also. Its ok though, i've switched to now Visual Studio VB.net 2008 Professional. By the way, thanks for that much help. But if this control is meant ot improve then lemme know. i'll work as beta tester. Thanks for all that help.

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Jul 2007
    Posts
    146

    Re: VB6 - Transparent UserControls for XP/Vista

    Quote Originally Posted by SwapsRulez
    mate.... hurray..... it worked.... but what was problem with mine. also the buttons are not working properly in your project also. Its ok though, i've switched to now Visual Studio VB.net 2008 Professional. By the way, thanks for that much help. But if this control is meant ot improve then lemme know. i'll work as beta tester. Thanks for all that help.
    Great! There's always a chance you accidently changed something, why your "version" didn't work. I used the same project, so it's a bit weird.

    The whole idea behind the XpControls is to enable VB6 programmers to create true theme aware Tab dialogs, like property pages, Option dialogs etc. That's why the "transparency" focuses on that and not just any background. It will work (eventually) tho.

    XpControls.ocx is a work in progress and much improved since I released the source you've tried. At the moment I'm working on a transparent scrollable lable, that looks just like a Textbox, but read only.

    I'm considering to add a Tab control as well, that way you'll have one control to create great looking themed dialogs.

    I wish you luck with VB 2008, I've been playing with it and the code hardly looks like VB6, it is more a new language all together.

    Take care,
    Jottum™
    XpVistaControls , (transparent) usercontrols for XP, Vista and 7 with W2K legacy support.

  13. #13
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: VB6 - Transparent UserControls for XP/Vista

    Hi Jottum.

    Firstly, thanks for these great controls.

    I am using the tabstrip, but I am having a problem with the colour. I have a white form, but the top of the tabstrip is still buttonface colour. I tried to change the backcolor but it wouldn't let me for some reason.

    I have tried to use the DrawTabStripCheat, but I get the error message Variable not defined PSZ_TAB

    I don't know if I am putting, or calling the code fom the right place?

    This is what I get:
    Attached Images Attached Images  
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  14. #14

    Thread Starter
    Addicted Member
    Join Date
    Jul 2007
    Posts
    146

    Re: VB6 - Transparent UserControls for XP/Vista

    Quote Originally Posted by aikidokid
    Hi Jottum.

    Firstly, thanks for these great controls.
    Hi aikidokid,

    You are welcome.

    Quote Originally Posted by aikidokid
    I am using the tabstrip, but I am having a problem with the colour. I have a white form, but the top of the tabstrip is still buttonface colour. I tried to change the backcolor but it wouldn't let me for some reason.
    I'm sorry to say this has nothing to do with my controls, the vbTabStrip draws its background in vbButtonFace internally and doesn't have a BackColor property.

    Quote Originally Posted by aikidokid
    I have tried to use the DrawTabStripCheat, but I get the error message Variable not defined PSZ_TAB
    Uhm... That's odd, all the PSZ_* should be declared in XpControls.bas.

    Code:
    ' General
    Public Type pszClassList
       PSZ_BUTTON As String
       PSZ_COMBOBOX As String
       PSZ_EDIT As String
       PSZ_EXPLORERBAR As String
       PSZ_HEADER As String
       PSZ_LISTVIEW As String
       PSZ_MENU As String
       PSZ_PAGE As String
       PSZ_PROGRESS As String
       PSZ_REBAR As String
       PSZ_SCROLLBAR As String
       PSZ_SPIN As String
       PSZ_STARTPANEL As String
       PSZ_STATUS As String
       PSZ_TAB As String
       PSZ_TASKBAND As String
       PSZ_TASKBAR As String
       PSZ_TASKBARCLOCK As String
       PSZ_TOOLBAR As String
       PSZ_TOOLTIPS As String
       PSZ_TRACKBAR As String
       PSZ_TRAYNOTIFY As String
       PSZ_TREEVIEW As String
    End Type
    ____________________________________
    
    Public Function ClassListItems() As pszClassList
    
       Dim tmpClassListItems As pszClassList
       
       With tmpClassListItems
          .PSZ_BUTTON = "Button"
          .PSZ_COMBOBOX = "ComboBox"
          .PSZ_EDIT = "Edit"
          .PSZ_EXPLORERBAR = "ExplorerBar"
          .PSZ_HEADER = "Header"
          .PSZ_LISTVIEW = "ListView"
          .PSZ_MENU = "Menu"
          .PSZ_PAGE = "Page"
          .PSZ_PROGRESS = "Progress"
          .PSZ_REBAR = "Rebar"
          .PSZ_SCROLLBAR = "Scrollbar"
          .PSZ_SPIN = "Spin"
          .PSZ_STARTPANEL = "StartPanel"
          .PSZ_STATUS = "Status"
          .PSZ_TAB = "Tab"
          .PSZ_TASKBAND = "TaskBand"
          .PSZ_TASKBAR = "TaskBar"
          .PSZ_TASKBARCLOCK = "Taskbar Clock"
          .PSZ_TOOLBAR = "Toolbar"
          .PSZ_TOOLTIPS = "Tooltips"
          .PSZ_TRACKBAR = "Trackbar"
          .PSZ_TRAYNOTIFY = "Tray Notify"
          .PSZ_TREEVIEW = "TreeView"
       End With
    
       ClassListItems = tmpClassListItems
    
    End Function
    Quote Originally Posted by aikidokid
    I don't know if I am putting, or calling the code fom the right place?
    When using a vbTabStrip you should use the DrawTabStripCheat function, or you want have the gradient body. (On Vista you wont see the difference, since Vista no longer has a gradient TabBody)

    The sample project - attached to my original post above - actually has two projects, XpControls.vbp and TabStripSample.vbp. Have a look at the last one to see how to use these controls with a vbTabStrip and how to use the TabStripCheat function.

    Please note: Set the form's Autoredraw to True when using TabStripCheat, and UseParentFormhDC to True for all XpControls you use on that TabStrip.

    Quote Originally Posted by aikidokid
    This is what I get:
    [...]

    Let me know if you can get it to work.

    HTH
    Jottum™
    XpVistaControls , (transparent) usercontrols for XP, Vista and 7 with W2K legacy support.

  15. #15
    New Member
    Join Date
    Mar 2011
    Location
    FL
    Posts
    2

    Re: VB6 - Transparent UserControls for XP/Vista

    Thanks for the tips. I will try later if I can make also transparent box.

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