Results 1 to 5 of 5

Thread: BackColor of Label

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    88
    Hi everybody.

    How can I make BackColor of Label object has the same color of the Active Title Bar color (2 colors in case of Win98/2000).

  2. #2
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    For setting it as a single color:

    Go to the Properties box for the label
    Find the BackColor property
    Click the down arrow to open the color pallette
    Click the System tab (instead of the Pallette tab)
    Find the item Active Title Bar
    Click it

    Your label will be set to the system's active title bar color.

    For the two colors:

    You need to find the two colors to use in the registry, then use the DrawGradient API to draw the gradient. One catch: it won't work on labels, so youd need to use a PictureBox instead.

    Hope that helps.
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

  3. #3
    Hyperactive Member
    Join Date
    Feb 2000
    Location
    Edgerton, WI
    Posts
    381
    mlewis,

    You stated in an in you reply to sanon:

    "For the two colors:

    You need to find the two colors to use in the registry, then use the DrawGradient API to draw the gradient. One catch: it won't work on labels, so youd need to use a PictureBox instead."

    Do you have an example of how to do this that you could make available? What I want to do is display a section at the top of several forms in my program that has a gradient background. For instance: white to light blue, white to light green, etc. Over top of this I want to overlay text with the function of the form, such as "Customer Registration."

    I am thinking about using the PictureBox in a manner simialar to what you have mentioned and overlaying that with a label with a transparent background, if that can be done. Any ideas and help here would be most welcomed.

    Thanks,
    Rev. Michael L. Burns

  4. #4
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    I don't have one available but I can send you some info if you like.

    I think the easiest way to continue this would be by email; my main address is [email protected]

    Talk to you soon.
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

  5. #5
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    sanon, here the sample code.

    Code:
    Option Explicit
    Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As Long
    Const COLOR_ACTIVECAPTION = 2
    
    Private Sub Command1_Click()
        Label1.BackColor = GetSysColor(COLOR_ACTIVECAPTION)
    End Sub
    To know more abt the GetSysColor juz take a look on this MSDN Library

    Chris

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