基本プロジェクトにステータスバーを配置します。

ステータスバーの左端にプルダウンメニューがあるので
クリックしてステータスラベルを作成します。

プロパティの Spring を「True」にして、Text を
「ステータスバー」にします。
TextAlign を「MiddleRight」にします。

ビルドして実行してみましょう。

MyForm.cpp
#pragma comment(linker, "/SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup")
#include "MyForm.h"
using namespace Project1;
[STAThreadAttribute]
int main(){
MyForm ^form1 = gcnew MyForm;
form1->ShowDialog();
return 0;
}
|
MyForm.h
#pragma once
namespace Project1 {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// MyForm の概要
/// </summary>
public ref class MyForm : public System::Windows::Forms::Form
{
public:
MyForm(void)
{
InitializeComponent();
//
//TODO: ここにコンストラクター コードを追加します
//
}
protected:
/// <summary>
/// 使用中のリソースをすべてクリーンアップします。
/// </summary>
~MyForm()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::StatusStrip^ statusStrip1;
private: System::Windows::Forms::ToolStripStatusLabel^
toolStripStatusLabel1;
protected:
protected:
private:
/// <summary>
/// 必要なデザイナー変数です。
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// デザイナー サポートに必要なメソッドです。このメソッドの内容を
/// コード エディターで変更しないでください。
/// </summary>
void InitializeComponent(void)
{
this->statusStrip1 = (gcnew System::Windows::Forms::StatusStrip());
this->toolStripStatusLabel1 = (gcnew
System::Windows::Forms::ToolStripStatusLabel());
this->statusStrip1->SuspendLayout();
this->SuspendLayout();
//
// statusStrip1
//
this->statusStrip1->Items->AddRange(gcnew cli::array<
System::Windows::Forms::ToolStripItem^ >(1)
{this->toolStripStatusLabel1});
this->statusStrip1->Location = System::Drawing::Point(0, 239);
this->statusStrip1->Name = L"statusStrip1";
this->statusStrip1->Size = System::Drawing::Size(284, 22);
this->statusStrip1->TabIndex = 0;
this->statusStrip1->Text = L"statusStrip1";
//
// toolStripStatusLabel1
//
this->toolStripStatusLabel1->Name = L"toolStripStatusLabel1";
this->toolStripStatusLabel1->Size = System::Drawing::Size(238,
17);
this->toolStripStatusLabel1->Spring = true;
this->toolStripStatusLabel1->Text = L"ステータスバー";
this->toolStripStatusLabel1->TextAlign =
System::Drawing::ContentAlignment::MiddleRight;
//
// MyForm
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(284, 261);
this->Controls->Add(this->statusStrip1);
this->Name = L"MyForm";
this->Text = L"Hello C++/CLI World !!";
this->statusStrip1->ResumeLayout(false);
this->statusStrip1->PerformLayout();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
};
}
|
最終更新:2013年09月24日 20:13