SDockMMB1_0_0_1binary.zip をダウンロードします。
http://sdock.codeplex.com/
解凍して、サンプルの SDockMMB.exe を起動してみましょう。
ドッキングウインドウを作成したり、配色を変えたりできます。

では、実際に、このライブラリを使ってみましょう。
基本プロジェクトを立ち上げます。
ツールのツールボックスアイテムの選択をクリックします。

参照をクリックしてyukilib.dllを選択します。


SDockBayとSDockPaneが追加されていればOKです。
(他にも色々追加されていますが。)

MyForm のプロパティの Size を Width 640、Height 480にします。

MyForm に SDockBay を配置します。

プロパティの Dock を Fill にします。

SDockBay上で右クリックするとメニューが出てくるので
新規Paneを下にドッキングを選択します。

すると、下の方にドッキングウインドウが作成されました。

また、SDockBay上で右クリックし、新規Paneを右にドッキングをクリックします。

こんな感じになりました。

ビルドして実行してみましょう。
ドッキングウインドウはメインウインドウから外す事もできます。
これでGUIのレイアウトが、かなり自由にできるようになりましたね。

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: Yukichika::Controls::SDockBay^ sDockBay1;
protected:
private: Yukichika::Controls::SDockPane^ sDockPane1;
private: Yukichika::Controls::SDockTabPage^ sDockTabPage1;
private: Yukichika::Controls::SDockPane^ sDockPane2;
private: Yukichika::Controls::SDockTabPage^ sDockTabPage2;
protected:
private:
/// <summary>
/// 必要なデザイナー変数です。
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// デザイナー サポートに必要なメソッドです。このメソッドの内容を
/// コード エディターで変更しないでください。
/// </summary>
void InitializeComponent(void)
{
this->sDockBay1 = (gcnew Yukichika::Controls::SDockBay());
this->sDockPane1 = (gcnew Yukichika::Controls::SDockPane());
this->sDockTabPage1 = (gcnew Yukichika::Controls::SDockTabPage());
this->sDockPane2 = (gcnew Yukichika::Controls::SDockPane());
this->sDockTabPage2 = (gcnew Yukichika::Controls::SDockTabPage());
this->sDockBay1->SuspendLayout();
this->sDockPane1->SuspendLayout();
this->sDockPane2->SuspendLayout();
this->SuspendLayout();
//
// sDockBay1
//
this->sDockBay1->BackColor =
System::Drawing::SystemColors::Control;
this->sDockBay1->Controls->Add(this->sDockPane1);
this->sDockBay1->Controls->Add(this->sDockPane2);
this->sDockBay1->Dock = System::Windows::Forms::DockStyle::Fill;
this->sDockBay1->Location = System::Drawing::Point(0, 0);
//
// sDockBay1.MainPane
//
this->sDockBay1->MainPane->BackColor =
System::Drawing::SystemColors::Control;
this->sDockBay1->MainPane->Location = System::Drawing::Point(0,
0);
this->sDockBay1->MainPane->Name = L"MainPane";
this->sDockBay1->MainPane->Size = System::Drawing::Size(419,
296);
this->sDockBay1->MainPane->TabFirstVisibleIndex = 0;
this->sDockBay1->MainPane->TabIndex = 0;
this->sDockBay1->Name = L"sDockBay1";
this->sDockBay1->Size = System::Drawing::Size(624, 441);
this->sDockBay1->TabIndex = 0;
this->sDockBay1->Text = L"sDockBay1";
//
// sDockPane1
//
this->sDockPane1->BackColor =
System::Drawing::SystemColors::Control;
this->sDockPane1->Controls->Add(this->sDockTabPage1);
this->sDockPane1->DockDireWithMainPane =
Yukichika::Controls::SDockDirection::Bottom;
this->sDockPane1->Location = System::Drawing::Point(0, 296);
this->sDockPane1->Name = L"sDockPane1";
this->sDockPane1->SelectedTab = this->sDockTabPage1;
this->sDockPane1->Size = System::Drawing::Size(624, 145);
this->sDockPane1->TabFirstVisibleIndex = 0;
this->sDockPane1->TabIndex = 9;
//
// sDockTabPage1
//
this->sDockTabPage1->Location = System::Drawing::Point(3, 20);
this->sDockTabPage1->Name = L"sDockTabPage1";
this->sDockTabPage1->Size = System::Drawing::Size(618, 122);
this->sDockTabPage1->Text = L"sDockTabPage1";
//
// sDockPane2
//
this->sDockPane2->BackColor =
System::Drawing::SystemColors::Control;
this->sDockPane2->Controls->Add(this->sDockTabPage2);
this->sDockPane2->DockDireWithMainPane =
Yukichika::Controls::SDockDirection::Right;
this->sDockPane2->Location = System::Drawing::Point(419, 0);
this->sDockPane2->Name = L"sDockPane2";
this->sDockPane2->SelectedTab = this->sDockTabPage2;
this->sDockPane2->Size = System::Drawing::Size(205, 296);
this->sDockPane2->TabFirstVisibleIndex = 0;
this->sDockPane2->TabIndex = 10;
//
// sDockTabPage2
//
this->sDockTabPage2->Location = System::Drawing::Point(3, 20);
this->sDockTabPage2->Name = L"sDockTabPage2";
this->sDockTabPage2->Size = System::Drawing::Size(199, 272);
this->sDockTabPage2->Text = L"sDockTabPage2";
//
// MyForm
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(624, 441);
this->Controls->Add(this->sDockBay1);
this->Name = L"MyForm";
this->Text = L"Hello C++/CLI World !!";
this->sDockBay1->ResumeLayout(false);
this->sDockPane1->ResumeLayout(false);
this->sDockPane2->ResumeLayout(false);
this->ResumeLayout(false);
}
#pragma endregion
};
}
|
最終更新:2013年10月02日 10:55