LoginSignup
0
1

More than 5 years have passed since last update.

C++ Builder > TForm > タイトルバーのないウィンドウ(サイズ変更可能)の実装 > ソフト起動時

Last updated at Posted at 2018-11-09
動作環境
C++ Builder XE4

背景

多数のウィンドウを表示するソフトにおいて、タイトルバーの表示を隠したい。

情報

情報感謝です。

実装

Unit1.h
//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:    // IDE で管理されるコンポーネント
private:    // ユーザー宣言
public:     // ユーザー宣言
    __fastcall TForm1(TComponent* Owner);
    void __fastcall CreateParams(Controls::TCreateParams &Params);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
Unit1.cpp
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
    this->Position = poScreenCenter; // 画面中央に表示
}
//---------------------------------------------------------------------------
void __fastcall TForm1::CreateParams(Controls::TCreateParams &Params)
{
    TForm::CreateParams(Params);
    Params.Style = WS_POPUP | WS_BORDER | WS_THICKFRAME;
}

動作例

2018-11-09_14h45_56.png

  • サイズ変更可能
  • 移動はできない
    • サイズ変更を工夫すると移動に近い操作は可能
      • 右を伸ばして、左を縮める、など

用途例

  • 画面をN分割
  • それぞれの位置においてサイズを適宜変更したい

検索用キーワード

  • override
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1