carr 帅 | 1 Sep 2009 14:00
Picon
Favicon

WM_CTLCOLORBTN message

hello, everyone.
I create a dialog project, then i put a radio button on it.
after that, i put a BMP picture on the dialog's background.
the radio button's background is grey, i want to remove its background.

in order to set the radio button's background transparent, i handle the 
WM_CTLCOLORBTN message in dialog. eg. MSG_WM_CTLCOLORBTN

but, it seems,  i can't receive the message.

so, how to set the control's background transparent ??
thanks.

      ___________________________________________________________ 
  好玩贺卡等你发,邮箱贺卡全新上线! 
http://card.mail.cn.yahoo.com/

[Non-text portions of this message have been removed]

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
(Continue reading)

Jim Barry | 1 Sep 2009 14:28

Re: WM_CTLCOLORBTN message

Radio buttons actually send WM_CTLCOLORSTATIC, not WM_CTLCOLORBTN.

-- 
Jim Barry, Microsoft MVP

--------------------------------------------------
From: "carr 帅" <shuaixh@...>
Sent: Tuesday, September 01, 2009 1:00 PM
To: <wtl@...>
Subject: [wtl] WM_CTLCOLORBTN message

> hello, everyone.
> I create a dialog project, then i put a radio button on it.
> after that, i put a BMP picture on the dialog's background.
> the radio button's background is grey, i want to remove its background.
>
> in order to set the radio button's background transparent, i handle the
> WM_CTLCOLORBTN message in dialog. eg. MSG_WM_CTLCOLORBTN
>
> but, it seems,  i can't receive the message.
>
> so, how to set the control's background transparent ??
> thanks. 

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/
(Continue reading)

carr 帅 | 1 Sep 2009 16:07
Picon
Favicon

Re: WM_CTLCOLORBTN message


--- 09年9月1日,周二, Jim Barry <j.barry@...> 写道:

发件人: Jim Barry <j.barry@...>
主题: Re: [wtl] WM_CTLCOLORBTN message
收件人: wtl@...
日期: 2009年9月1日,周二,下午8:28

 

    
                  Radio buttons actually send WM_CTLCOLORSTATIC, not WM_CTLCOLORBTN.

oh, yes.  but i still fail to set the radio button's background transparent;
my codes:
 //Create a null brush
m_brush.m_hBrush = (HBRUSH)::GetStockObject(HOLLOW_BRUSH);
//the message map
MSG_WM_CTLCOLORSTATIC(OnCtlColorDlg)

// message handler
HBRUSH CMainDlg::OnCtlColorDlg(CDCHandle dc, CWindow wnd)
{
    dc.SetBkMode(TRANSPARENT);
    dc.SetTextColor(RGB(255, 255, 255));

    return m_brush;
}------------------------the above codes works well with a STATIC control.but leave the radio buttons a
black background ,not transparent.

(Continue reading)

Jim Barry | 1 Sep 2009 18:44

Re: WM_CTLCOLORBTN message

"carr 帅" wrote:
> oh, yes.  but i still fail to set the radio button's background 
> transparent;
> my codes:
[...]
> the above codes works well with a STATIC control.but leave the radio 
> buttons a black background ,not transparent.

Are you doing your dialog background painting in WM_PAINT? If so, try doing 
it in WM_ERASEBKGND instead.

--

-- 
Jim Barry, Microsoft MVP 

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:wtl-digest@... 
(Continue reading)

Constantin Bryzgalin | 1 Sep 2009 18:47
Picon

Re: WM_CTLCOLORBTN message

Hello,

> the above codes works well with a STATIC
> control.but leave the radio buttons a black background ,not transparent.

it's really a problem with most common controls: they don't deal well
with transparency. what you really need to do is capture a part of the
background picture that lies underneath the radiobutton, create a
pattern brush from it and let it use that to 'paint' background.

or alternatively you may paint captured picture part in WM_CTLCOLOR
handler and return NULL_BRUSH. this may be a little bit easier to
code.

p.s. after messing with radiobutton transparency for several days I
just asked our UI designer to always make radiobutton background solid
whenever possible. :-)

--

-- 
Constantin Bryzgalin
http://www.oneclicktools.com

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
(Continue reading)

Jim Barry | 1 Sep 2009 19:26

Re: WM_CTLCOLORBTN message

Constantin Bryzgalin wrote:
> it's really a problem with most common controls: they don't deal well
> with transparency. what you really need to do is capture a part of the
> background picture that lies underneath the radiobutton, create a
> pattern brush from it and let it use that to 'paint' background.

That's what v6 "themed" common controls do - they send WM_PRINTCLIENT to 
draw the parent background into a buffer, then composite the control on top. 
Unfortunately, it doesn't work properly with all themes. For example, the 
Zune theme doesn't send WM_PRINTCLIENT when compositing buttons, so they 
have a nasty light-coloured edge when shown on anything other than the 
default dialog background :(

--

-- 
Jim Barry, Microsoft MVP

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)

(Continue reading)

domehead100 | 1 Sep 2009 19:38
Picon

Re: WM_CTLCOLORBTN message

--- In wtl@..., carr 帅 <shuaixh <at> ...> wrote:
>the above codes works well with a STATIC control.but leave the radio >buttons a black background ,not transparent.

See if this helps... The samples are in MFC, but the actual helper class the article describes is not if I
recall correctly:

http://www.codeproject.com/KB/dialog/transparent-control.aspx

~Mike

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:wtl-digest@... 
    mailto:wtl-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    wtl-unsubscribe@...
(Continue reading)

mmartinsson123 | 13 Sep 2009 20:33
Picon

Refelecting Messages to child window

Hi,

i have a custom CommandBarCtrl and i want handle all messages especially command onces in my own control.
But putting 

REFLECTED_COMMAND_ID_HANDLER(ID_FILE_NEW, OnFileNew) and DEFAULT_REFLECTION_HANDLER()

in my message has not worked.

What i doing wrong?

Thanks
Martin

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:wtl-digest@... 
(Continue reading)

Konstantin Mironovich | 13 Sep 2009 21:40
Favicon

Re: Refelecting Messages to child window

put REFLECT_NOTIFICATIONS() redirector at the end of parental MSG map

-km

  ----- Original Message ----- 
  From: mmartinsson123
  To: wtl@...
  Sent: Sunday, September 13, 2009 10:33 PM
  Subject: [wtl] Refelecting Messages to child window

    Hi,

  i have a custom CommandBarCtrl and i want handle all messages especially 
command onces in my own control. But putting

  REFLECTED_COMMAND_ID_HANDLER(ID_FILE_NEW, OnFileNew) and 
DEFAULT_REFLECTION_HANDLER()

  in my message has not worked.

  What i doing wrong?

  Thanks
  Martin

[Non-text portions of this message have been removed]

------------------------------------

Yahoo! Groups Links
(Continue reading)

mmartinsson123 | 14 Sep 2009 02:11
Picon

Reflecting Messages to child window

Hi,

i have a custom CommandBarCtrl and i want handle all messages especially command onces in my own control.
But putting 

REFLECTED_COMMAND_ID_HANDLER(ID_FILE_NEW, OnFileNew) and DEFAULT_REFLECTION_HANDLER()

in my message has not worked.

What i doing wrong?

Thanks
Martin

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:wtl-digest@... 
(Continue reading)


Gmane