Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

SS Tab Caption

Posted on 1997-12-25
3
299 Views
Last Modified: 2008-02-01
Hi all,

I'm using VB 4 and on my form I have an SS tab with 6 tabs. I've set all the caption titles of the tabs to be the colour black however I want to make it so that when I run my program and click on one of the tabs it changes colour. For exmaple, lets says my tab titles are: tab1, tab2, tab3....etc and they're all black, however if i clicked on the tab titled tab2 the colour of the caption should change from black to red and then when I click on tab3, tab2 should change back to black and the caption of tab3 should become red and so on.

This is the code I have come up with:

Private Sub SSTab1_Click
SSTab1.ForeColor = &HFF&

However that changes ALL the tab labels to red where as I only want the active tab to have a red caption. Can anyone help?

Thanx
Belle
0
Comment
Question by:Belle
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 50 total points
ID: 1447326
You can calculate the position of the text manualy and print the text manualy using TextOut. This will allow you to use any color
0
 

Author Comment

by:Belle
ID: 1447327
I don't quite know how to do that.
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1447328
Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd As Long) As Long
Declare Function SetTextColor Lib "gdi32" Alias "SetTextColor" (ByVal hdc As Long, ByVal crColor As Long) As Long

Dim hDC as long
hDC = GetDC(sstab.hwnd)
SetTextColor(hdc, RGB(255,0.0)) 'Red Color
TextOut(hdc, x, y, "Caption", len("Caption"))


0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Pull multiple cvs files into one access table 28 69
VBA saving file message display 5 71
passing parameter in sql procedure 9 65
Copy a row 12 62
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question