Results 1 to 10 of 10

Thread: Font color of command button caption

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2007
    Posts
    132

    Font color of command button caption

    How the font color of commnd button cation is changed? In properties no such method found. Anyclue.

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

    Re: Font color of command button caption

    Easy way is to change the buttons Style property to Graphical but then you will lose any XP / Vista theming.

    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

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2007
    Posts
    132

    Re: Font color of command button caption

    thanks for the reply. I am using the style property as Graphical and inserted picture, so I want to change the font color of the caption from black to blue or anyother suitable color.

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

    Re: Font color of command button caption

    Sorry it should be an Option Button and set its Forecolor property with the Style being graphical.
    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

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

    Re: Font color of command button caption

    See "Setting A Command buttons Forecolor on this link" Change Command Button Forecolor

  6. #6
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236

    Re: Font color of command button caption

    Or you could use Threed32.ocx its on the VB6 CD. You can set the button Forecolor to any colour or shade you want too.

    You know this ocx has some really good controls and properties, its a pity people don't use it now, I do.

    Edit: Just thinking about it you could add pictures/icons to Command buttons 13 years ago with Threed16.ocx and Threed32.ocx. I can't remember if you could add them in VB5, its been a long time since I've used that.
    Last edited by Keithuk; Dec 4th, 2007 at 02:25 PM.
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

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

    Re: Font color of command button caption

    I never seen that control. Where is the path location for it?
    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

  8. #8
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236

    Re: Font color of command button caption

    Quote Originally Posted by RobDog888
    I never seen that control. Where is the path location for it?
    Rob: its in Common\Tools\Vb\Controls. There are
    Anibtn32.ocx for make animated buttons.
    Dbgrid32.ocx which is an earlier version of the current Dbgrid32.
    Gauge32.ocx where you can simulate different gauges, you just have to make you own pictures for the gauge background.
    Graph32.ocx the earlier graph making control.
    Grid32.ocx is the earlier version of MSFlxGrd.
    Keysta32.ocx shows if the Caps Lock, Num Lock and I think Scroll Lock are switches on graphically.
    Mschart.ocx the earlier graph making control.
    Msoutl32.ocx I think it shows a Explorer type layout with folders and files.
    Spin32.ocx is the earlier version of the current Up/Down control.
    Threed32.ocx has the normal VB controls, Frame, Command button, Option button, Checkbox with an addition of Panel. All these controls have additional features like coloured button captions.

    These are the older ActiveX controls that VB used to use.
    You register these ocx's as normal in the Win\Sys folder then in the Controls folder there are 3 reg files what will give extra registration needed for these files, dbgrid.reg, mschart.reg and the important one vbctrls.reg. Without this last reg you won't get the controls loaded initially.

    As I've said I don't know why some of these controls are used anymore.

    If you want an app that will show these controls working then have a look Old Visual Basic OCX Demo that I made 3 years ago.
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

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

    Re: Font color of command button caption

    I've created a button control that allows you to change ForeColor. It also has a Flat property so you can create Toolbar like buttons, it also has a DrawFocusRect property which if set to False doesn't draw the focus rectangle when the button has the focus. It can display an image either to the left of the text or above it (just set the TextAlignment property, this property is ignored if the Picture property is not set). To keep it simple I haven't implemented any MaskColor property so use icons if you want transparent images.

    Besides the above it works pretty much like the regular CommandButton and expose the same events (for which of course the Click event is the most important). It supports the Default and Cancel properties and it also expose a Click method which will raise the Click event when called.

    The UserControl is a pure user-drawn control (it doesn't contain any other controls, everything is drawn in the Paint event) so it's very light-weight. I have included it in an ActiveX Control project so you can compile it to an OCX if you like, but you can just as well simply include the UserControl directly into your Standard EXE file if you don't want to distribute another OCX file with your project.

    Attached Images Attached Images  
    Attached Files Attached Files

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

    Re: Font color of command button caption

    Top notch work Joacim
    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

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