Visual Basic, C & C++
분류 C & C++

Using C++Builder to list all available VCL styles in a ComboBox and apply a selected style using the ComboBoxChange event

페이지 정보


The C++ Application User Interface

For the application user interface I have a TButton (has code to populate the ComboBox with selected application styles) and a TComboBox (to display and allow selection of a style).

 C++ code
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include <Vcl.Themes.hpp>
#pragma package(smart_init)
#pragma resource "*.dfm"

TForm1 *Form1;
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
void __fastcall TForm1::Button1Click(TObject *Sender)
    // populate the ComboBox with VCL styles that are selected
    //    in Project | Options | Application | Appearance
        DynamicArray<String> styleNames = Vcl::Themes::TStyleManager::StyleNames;

        for(int i = 0; i < styleNames.Length; ++i) 
            String styleName = styleNames[i];
void __fastcall TForm1::ComboBox1Change(TObject *Sender)
    // set the style for the selected combobox item

The Application in Action

TComboBox populated with VCL styles selected Application Style Changed by TComboBox selection 


VCL Styles Overview

Project Options Application Appearance

VCL Styles Support for High-DPI Graphics

C++Builder Product Information

C++Builder Product Page – Native Apps that Perform. Build Windows C++ Apps 10x Faster with Less Code
C++Builder Product Editions – C++Builder is available in four editions – Professional, Enterprise, Architect and Community (free). C++Builder is also available as part of the RAD Studio development suite.


등록된 댓글이 없습니다.
Today's proverb
고개에 오르려고 하다가 꼭대기에 이르지 못했다 하더라도 얼마나 칭찬할 만한 일인가. 자기의 현재의 힘으로 자신을 되돌아보고, 애써 고매한 일을 하면서도 더 커다란 일을 그려본다는 것은 대단히 귀중한 일이다. (세네카)