Solved

SS Tab Caption

Posted on 1997-12-25
3
301 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
[X]
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
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

707 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