C++Builder How To Use The Comprehensive Form Properties In C++ VCL Apps

FireWind

Свой
Регистрация
2 Дек 2005
Сообщения
1,957
Реакции
1,199
Credits
4,009
How To Use The Comprehensive Form Properties In C++ VCL Apps
By Yilmaz Yoru August 4, 2021

Для просмотра ссылки Войди или Зарегистрируйся is the easiest and fastest C and C++ IDE for building simple or professional applications on the Windows, MacOS, iOS & Android operating systems. It is also easy for beginners to learn with its wide range of samples, tutorials, help files and LSP support for code. C++ Builder comes with Rapid Application Development Studio, also known as RAD Studio, and C++ Builder is one of the most professional IDE’s that work under RAD Studio. It is the oldest IDE (it began as Для просмотра ссылки Войди или Зарегистрируйся in 1990 and was later renamed Для просмотра ссылки Войди или Зарегистрируйся). Under the Для просмотра ссылки Войди или Зарегистрируйся brand it comes with new versions, features, updates and support. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs. There is a free C++ Builder Community Edition for students, beginners and startups.
You can download the free C++ Builder Community Edition here: Для просмотра ссылки Войди или Зарегистрируйся.
Professional developers can use the Professional, Architect or Enterprise versions of C++ Builder. Please visit Для просмотра ссылки Войди или Зарегистрируйся.

Forms (TForm) in VCL Framework and Its Properties​

Для просмотра ссылки Войди или Зарегистрируйся represents a standard application Form window. When we create forms in the Form designer at design time, they are implemented as descendants of Для просмотра ссылки Войди или Зарегистрируйся. Forms can represent the application’s main window, or dialog boxes, or MDI children. A form can contain other objects, such as TButton, TCheckBox, and TComboBox objects. All the Properties of Forms in FireMonkey frame work can be found Для просмотра ссылки Войди или Зарегистрируйся and Methods of Forms can be found Для просмотра ссылки Войди или Зарегистрируйся in official DocWiki.

1628143528468.png

Let’s give some examples of its properties. We can set or change properties (Caption, WindowsState, Color, TransparentColor, Visible, ShowHint, Tag, and more) of Forms on design with Object Inspector panel and on runtime, For example, we can set Caption or Hint of Forms on runtime. Here is an example to set some of the properties that we mostly used,

C++:
#include <vcl.h>
#pragma hdrstop
 
#include "Form_Properties_VCL_Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
{
 Form1->Caption = L"This is my Form Title in Unicode";
 Form1->Hint = L"This is my Form Hint in Unicode";
 
 // Form1->Quality = TCanvasQuality::HighQuality;
 Form1->WindowState = wsMaximized;
 
 
 Form1->Color = clLime;
 
 Form1->ShowHint = true;
 Form1->Visible =true;
 
 Form1->TransparentColorValue=clBlack;
 Form1->TransparentColor = false;
 
 Form1->Tag = 1;
}
We can also get some information about our Form that we set on design time or they can be changed on run time because of Windows State, Border Kind, Alignments, FullScreen property, etc. Here is an example to get Caption, ClientWidth, ClientHeight, Width, Height of the form.
C++:
#include <vcl.h>
#pragma hdrstop
 
#include "Form_Properties_VCL_Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
{
 Memo1->Lines->Add("Form Text:" + Form1->Caption);
 Memo1->Lines->Add("Form Position:" + IntToStr( Form1->Left) +","+ IntToStr(Form1->Top) );
 Memo1->Lines->Add("Form Client Size:" + IntToStr( Form1->ClientWidth) +"x"+ IntToStr(Form1->ClientHeight) );
 Memo1->Lines->Add("Form Size:" + IntToStr( Form1->Width) +"x"+ IntToStr(Form1->Height) );
}
We can use Hide() and Show() methods to hide and show our forms. We can use SendToBack() and BringtoFront() methods, to send our form to the back or to bring to front. There are many methods and properties that we can use. All the Properties of Forms in FireMonkey frame work can be found Для просмотра ссылки Войди или Зарегистрируйся and Methods of Forms can be found Для просмотра ссылки Войди или Зарегистрируйся in official DocWiki.

Forms are one of the most important parts of our applications, so each property may change your application behavior. Some details about your forms may improve your quality of images, animations and speed of drawings.
1628143581952.png
Another great feature of Forms are Styles that works on all official UI elements of VCL Framework as a skin. You can easily apply skins to your forms and components on it. You can also create your own style with the Style Manager. We explained in our posts before that how you can apply Для просмотра ссылки Войди или Зарегистрируйся and Для просмотра ссылки Войди или Зарегистрируйся.