Solved

SS Tab Caption

Posted on 1997-12-25
3
295 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
Comment Utility
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
Comment Utility
I don't quite know how to do that.
0
 
LVL 8

Expert Comment

by:MikeP090797
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now