Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1958228
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T08:16:55+00:00 2026-05-17T08:16:55+00:00

I have a tab-based application for windows, which I am developing by myself. I

  • 0

I have a tab-based application for windows, which I am developing by myself.

I would like to add a subtle gradient to the background of my tab control. How would I go around doing this? What is the best method for me to use?

I think that implementing a custom control that takes up the space of the tab control would work, but how would I then draw a gradient using GDI?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T08:16:55+00:00Added an answer on May 17, 2026 at 8:16 am

    To use GDI you’ll need the GradientFill function. You can also use GDI+ to get gradients. Here’s a plain GDI example:

    TRIVERTEX        vert[2] ;
    GRADIENT_RECT    gRect;
    vert [0] .x      = 0;
    vert [0] .y      = 0;
    vert [0] .Red    = 0x0000;
    vert [0] .Green  = 0x0000;
    vert [0] .Blue   = 0x0000;
    vert [0] .Alpha  = 0x0000;
    
    vert [1] .x      = 100;
    vert [1] .y      = 32; 
    vert [1] .Red    = 0x0000;
    vert [1] .Green  = 0x0000;
    vert [1] .Blue   = 0xff00;
    vert [1] .Alpha  = 0x0000;
    
    gRect.UpperLeft  = 0;
    gRect.LowerRight = 1;
    GradientFill(hdc,vert,2,&gRect,1,GRADIENT_FILL_RECT_H);
    

    As for the tab control, you could sub-class the control and override its non-client and client drawing handlers to render the gradient.

    To sub class a control, first create the control and then replace its WNDPROC function:

    OldWndProc = (WNDPROC)SetWindowLongPtr (hControl, GWLP_WNDPROC, (LONG_PTR)NewWndProc);
    

    then, in your new WNDPROC:

    NewWndProc (usual args)
    {
      switch message
      {
      case paint:
        draw gradient
        return result
    
      default:
        return CallWindowProc (OldWndProc, ..args..); <- important!
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a tab bar based application in which I am trying to add
I have written a tab based iPad application which has done well. I never
I have tab based application which also have Navigation controllers, When the user in
I have a tab based application in which one tab is available in both
I'm developing a tab based android application,I have seen that TabActivity class is deprecated
Hi i have a tab based application what i have done is put another
I have a TabController-based storyboard application with 4 different navigationController, one each tab. The
I have a tab delimited file which looks like this: CHROM <TAB> POS <TAB>
Windows 7 and Windows Vista have a Region and Language control panel which contains
I have a tab bar controller (its a tab bar based application, so tab

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.