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

  • SEARCH
  • Home
  • 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 9087555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:43:15+00:00 2026-06-16T21:43:15+00:00

I have a custom control created using CreateWindowEx with the WS_BORDER style. Everything works

  • 0

I have a custom control created using CreateWindowEx with the WS_BORDER style. Everything works fine apart from the border appearing in a different colour to other controls in the dialog box. The border in my control is black, the other controls have a blue border. I’ve tried calling EnableThemeDialogTexture(_dialogHandle, ETDT_ENABLE) after creating the control, as well as the logic from http://www.patchou.com/projects/richedit/ but to no avail. I’m using C++ and the Winapi. ie. no MFC, no .Net. Any guidance very much appreciated.

EDIT: Here’s the logic that worked for me:

HDC hdc = GetWindowDC(hwnd);
HTHEME themeHandle = OpenThemeData(hwnd, L"Edit");
if(themeHandle)
{
    int cxBorder = GetSystemMetrics(SM_CXBORDER);
    int cyBorder = GetSystemMetrics(SM_CYBORDER);
    RECT rc;
    GetClientRect(hwnd, &rc);                   
    OffsetRect(&rc, cxBorder, cyBorder);
    ExcludeClipRect(hdc, rc.left, rc.top, rc.right, rc.bottom);
    InflateRect(&rc, cxBorder, cyBorder);
    DrawThemeBackground(themeHandle, hdc, 0, 0, &rc, NULL);
    CloseThemeData(themeHandle);
 }

ReleaseDC(hwnd, hdc);
  • 1 1 Answer
  • 0 Views
  • 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-06-16T21:43:17+00:00Added an answer on June 16, 2026 at 9:43 pm

    You have to draw the border yourself, using the theme from another control (for example, the listview or treeview control). For a custom child control, drawing the border is quite easy – simply handle the WM_NCPAINT message. The part ID and state ID when you draw the border should both be 0.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a custom control inheriting from a panel in .NET 3.5 The
I have created a custom control using VB.NET in Visual Studio 2008 that gives
I am new in using custom controls. I have created a custom control in
I have created a custom control which derives from Panel. I use it to
i have created a custom user control which im using on my main xaml
I have a custom nginx build for my project and everything works fine except
I have a custom button control created using ATL. This control is used by
I have created a custom server control, deriving from System.Web.Contols.CheckBoxList to customize how a
I have created a custom style for my WPF datagrid by overriding its control
I have created a custom server control and trying to add an image using

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.