Results 1 to 8 of 8

Thread: Change the way controls look

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2002
    Location
    Lexington, SC
    Posts
    586

    Change the way controls look

    Hey,
    How (if it's even possible) could I change the appearance of a control.

    Say a command button for instance, if I want to change how it appears so instead of the default grey button I could have a flat blue button with a black outline and white text, stuff like that?

    Is this even possible in any simple way with VB.. or I'd even be willing to know the hard way lol

    Thanks,

    Steven

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Change the way controls look

    You can change the backcolor of a CommandButton if you set the Style property to Graphical. You can also subclass and watch for messages like WM_PAINT to change the appearence, but for a custom styled button it would probably be easier to just create your own usercontrol.

  3. #3
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: Change the way controls look

    sure!

    Take a checkbox, make its style property to graphical.

    Back color blue, forecolor white : )

  4. #4
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Change the way controls look

    Two customizable User Controls by me:
    UniCommand
    UniLabel

    Allows you to use Unicode as well. You have to code a replacement code for DrawEdge though, if you want to change that what to you want (I think, haven't taken a look in the source in a while).

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Change the way controls look

    Anything with a click event can be used as a command button. You could use Image controls, or picture boxes with your own embedded images (providing you don't want to go the route of the UserControl.)

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2002
    Location
    Lexington, SC
    Posts
    586

    Re: Change the way controls look

    Well those solutions solve the problems of command buttons. But I mean't all controls, like another example that wouldn't be as simple, what if I wanted a textbox to look different. Instead of having a white background I wanted a black background with white text and didn't want the 3d edges on it. Just using a picture box there wouldn't really be acceptable. I'll look into intercepting the WM_PAINT, that might be a workable solution if I can figure it out.

  7. #7
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: Change the way controls look

    Just take the borders completely out of the textbox and use, well, DrawEdge to draw borders you like or just basic Line command. Or FillRect if you want to use API. It isn't even too hard to make it a user control, though that is a bit too much for so small changes.

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2002
    Location
    Lexington, SC
    Posts
    586

    Re: Change the way controls look

    Yeah it's not huge changes. A friend of mine needs a database frontend program, easy enough, the catch is she wants the entire thing to look and feel like a normal webpage hehe. I suppose if I really wanted to I could just write the entire thing as a local ASP webpage, but once I figure out how to change all the appearences and all it should be easy enough in VB.

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