Results 1 to 11 of 11

Thread: [RESOLVED] button property

  1. #1

    Thread Starter
    Lively Member FYRe's Avatar
    Join Date
    Aug 2005
    Location
    Singapore
    Posts
    102

    Resolved [RESOLVED] button property

    I'm not too sure is I should put this thread here, but anyway, referring to the 2 screenshots below, is it possible to have a button which has a much rounded edges, (in VB .NET) rather than having those edges which looks sharper?

    If it's possible, which property do I use? or how to do so?


    thks,
    FYRe
    Attached Images Attached Images   
    sOMEONE'S gONNA dO iT, wHY nOT yOU ?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: button property

    You need to enable visual styles to give your controls that WinXP look. You need to give your app a Main method and put code something like this within it:
    VB Code:
    1. Application.EnableVisualStyles()
    2. Application.DoEvents()
    3. Application.Run(New Form1)
    You would also need to set the FlatStyle property of any control that supports it to System.

    Note that are several short-comings in the visual style support provided by VS.NET 2003. These have been addressed in VS 2005, but for now you cannot place an image on a themed button, NumericUpDown controls do not support visual styles at all, TabControls do not display the correct BackColor, and various other things. To overcome these issues you could download the free Skybound VisualStyles component, that fixes the theme support for existing controls, or you could use inherited controls like those in the free Quantum Windows Forms Components library.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member FYRe's Avatar
    Join Date
    Aug 2005
    Location
    Singapore
    Posts
    102

    Re: button property

    Is there any possible way that need not require any downloading ?
    sOMEONE'S gONNA dO iT, wHY nOT yOU ?

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: button property

    You can enable visual styles with just those lines of code I posted. No need to download anything. The issues arise when you want to do things that are not supported, like put an image on a button. That's when you'd need to download something.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Lively Member FYRe's Avatar
    Join Date
    Aug 2005
    Location
    Singapore
    Posts
    102

    Re: button property

    Quote Originally Posted by jmcilhinney
    You need to enable visual styles to give your controls that WinXP look. You need to give your app a Main method and put code something like this within it:
    VB Code:
    1. Application.EnableVisualStyles()
    2. Application.DoEvents()
    3. Application.Run(New Form1)
    You would also need to set the FlatStyle property of any control that supports it to System.

    Note that are several short-comings in the visual style support provided by VS.NET 2003. These have been addressed in VS 2005, but for now you cannot place an image on a themed button, NumericUpDown controls do not support visual styles at all, TabControls do not display the correct BackColor, and various other things. To overcome these issues you could download the free Skybound VisualStyles component, that fixes the theme support for existing controls, or you could use inherited controls like those in the free Quantum Windows Forms Components library.
    Where do I exactly place the following lines of codes?
    in a function? or MainForm_Load? or somewhere else?


    Application.EnableVisualStyles()
    Application.DoEvents()
    Application.Run(New Form1)


    thks,
    FYRe
    sOMEONE'S gONNA dO iT, wHY nOT yOU ?

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: button property

    Am I posting in some other language today?
    Quote Originally Posted by jmcilhinney
    You need to give your app a Main method
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: button property

    OK... maybe you haven't come across a Main method before. Many people put them in a module, but unless you are using a module for something else already then there's no point. Just put this in your main form:
    VB Code:
    1. Shared Sub Main()
    2.     Application.EnableVisualStyles()
    3.     Application.DoEvents()
    4.     Application.Run(New Form1)
    5. End Sub
    If your main form is not called Form1 then make the change accordingly. This method will now be the entry point for your app, i.e. the first code executed.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8

    Thread Starter
    Lively Member FYRe's Avatar
    Join Date
    Aug 2005
    Location
    Singapore
    Posts
    102

    Re: button property

    Jm, I'm perfectly new to VB .NET. I picked up this language just like abt 2 months ago for my 3 month project in sch u know... (obviously you don't). And on top of all, I'll be having a presentation soon.

    So, pls, be a gd samaritian (which you have always been and will always) and help me out. What I'm trying to say is to explain to me in "layman's term".


    Ever since I became a member of this forum, I really do appreciate you help.
    thks man,

    So, back to my question: Where?



    FYRe
    sOMEONE'S gONNA dO iT, wHY nOT yOU ?

  9. #9
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: button property

    Hmmm...
    Quote Originally Posted by jmcilhinney
    Just put this in your main form:
    VB Code:
    1. Shared Sub Main()
    2.     Application.EnableVisualStyles()
    3.     Application.DoEvents()
    4.     Application.Run(New Form1)
    5. End Sub
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  10. #10

    Thread Starter
    Lively Member FYRe's Avatar
    Join Date
    Aug 2005
    Location
    Singapore
    Posts
    102

    Re: button property

    I guess, I didn't refresh my IE or was it that you and I wrote at the same time and submitted at the same time

    sorry....

    thks anyway.
    I placed the code you posted, however, the only difference when I run my form is the ComboBox and the NumericUpDown change to the XP style, but not the buttons.

    ???
    sOMEONE'S gONNA dO iT, wHY nOT yOU ?

  11. #11
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: button property

    Quote Originally Posted by jmcilhinney
    You would also need to set the FlatStyle property of any control that supports it to System.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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