Ticket #14492: TransCheckBoxStaticText.diff

File TransCheckBoxStaticText.diff, 2.2 KB (added by wxBen, 6 years ago)

TransCheckBoxStaticText.diff

  • wxWidgets/samples/ribbon/ribbondemo.cpp

     
    3131#include "wx/combobox.h"
    3232#include "wx/tglbtn.h"
    3333#include "wx/wrapsizer.h"
     34#include "wx/checkbox.h"
     35#include "wx/stattext.h"
    3436
    3537// -- application --
    3638
     
    419421        bar->AddButton(ID_REMOVE_PAGE, wxT("Remove"), wxArtProvider::GetBitmap(wxART_DELETE, wxART_OTHER, wxSize(24, 24)));
    420422        bar->AddButton(ID_HIDE_PAGES, wxT("Hide Pages"), ribbon_xpm);
    421423        bar->AddButton(ID_SHOW_PAGES, wxT("Show Pages"), ribbon_xpm);
     424
     425        //Demonstrate transparent additional controls:
     426        panel = new wxRibbonPanel(page, wxID_ANY, wxT("Transparency"), ribbon_xpm);
     427        wxCheckBox* checkBox = new wxCheckBox(panel, wxID_ANY, wxT("Checkbox"), wxDefaultPosition, wxDefaultSize, wxTRANSPARENT_WINDOW);
     428        wxStaticText* text = new wxStaticText(panel, wxID_ANY, wxT("StaticText"), wxDefaultPosition, wxDefaultSize, wxTRANSPARENT_WINDOW);
     429#       if defined(__WXMSW__)
     430           //This may be required in some situations:
     431           checkBox->MSWMakeOwnerDrawn(true);
     432#       endif
     433        wxSizer *s = new wxBoxSizer(wxVERTICAL);
     434        s->Add(checkBox);
     435        s->Add(text);
     436        panel->SetSizer(s); 
    422437    }
    423438    new wxRibbonPage(m_ribbon, wxID_ANY, wxT("Highlight Page"), empty_xpm);
    424439    m_ribbon->AddPageHighlight(m_ribbon->GetPageCount()-1);
  • wxWidgets/src/msw/control.cpp

     
    427427
    428428WXHBRUSH wxControl::MSWControlColor(WXHDC pDC, WXHWND hWnd)
    429429{
     430    DWORD dwExStyle = ::GetWindowLong(hWnd, GWL_EXSTYLE);
     431    if (dwExStyle & WS_EX_TRANSPARENT)
     432    {
     433        wxColour fgColour = GetForegroundColour();
     434        ::SetTextColor((HDC)pDC, RGB(fgColour.Red(), fgColour.Green(), fgColour.Blue()));
     435        ::SetBkMode((HDC)pDC, TRANSPARENT);
     436        return (WXHBRUSH)GetStockObject(HOLLOW_BRUSH);
     437    }
     438
    430439    if ( HasTransparentBackground() )
    431440        ::SetBkMode((HDC)pDC, TRANSPARENT);
    432441