-1

This question was generated by a response to another question: Common Controls on a Transparent Window?.

Apparently, there is a way to only paint the background without a control painting itself again This would solve the problem of having common control buttons on a transparent background.

So my question is, how do I paint only the background around a common control after the common control has painted itself?

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
user3161924
  • 1,849
  • 18
  • 33
  • I don't see anything in the post you linked (including the comments to it) or the answer that is posted there related to what you've stated here. – Ken White Jun 21 '19 at 03:04
  • You mean, for example, to redraw a RoundRect button, and then you just need to redraw the redundant white border around the button. – Strive Sun Jun 21 '19 at 05:48
  • yes. How did someone get the description of the link to show up? – user3161924 Jun 21 '19 at 06:25
  • I don't know if my answer will help you. If it helps, please mark my answer.This can be beneficial to other community members reading this thread. – Strive Sun Jun 24 '19 at 05:22
  • does it work to fill all areas, say it was so rounded it was round, is it going to fill the entire square? How about for transparent background, can you have an inverse invalidated path? – user3161924 Jun 24 '19 at 17:14
  • @user3161924 I think another way is to re-register a window class and customize the drawing of a button. You can control the drawing of the whole area, whether it's RounRect or transparent background area. – Strive Sun Jun 25 '19 at 10:05

1 Answers1

1

About how to redraw visible borders.

The rounded rectangle drawn by RoundRect is used as representative

The FrameRgn function draws a border around the specified region by using the specified brush.

Simple code demonstration:

HRGN hRegion = ::CreateRoundRectRgn (0, 0, ClientWidth, ClientHeight,12,12);
Canvas->Brush->Style = bsSolid;
Canvas->Brush->Color = RGB(96, 96, 96);
::FrameRgn(Canvas->Handle, hRegion, Canvas->Brush->Handle, 2, 2);
::DeleteObject(hRegion); // Don't leak a GDI object

Link you need: Redraw Border

Strive Sun
  • 5,988
  • 1
  • 9
  • 26