⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rttiinspectordemomain.cpp

📁 delphi的的三方控件
💻 CPP
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "RTTIInspectorDemoMain.h"
#include "RTTIInspectorDemoData.h"
#include "RTTIInspectorDemoVGEditor.h"
#include "cxExportVGLink.hpp"
#include "cxImageComboBox.hpp"
#include <assert.h>
#include <ImgList.hpp>
#include "RTTIInspectorDemoPropEditors.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "cxClasses"
#pragma link "cxControls"
#pragma link "cxCustomData"
#pragma link "cxData"
#pragma link "cxDBData"
#pragma link "cxEdit"
#pragma link "cxFilter"
#pragma link "cxGraphics"
#pragma link "cxStyles"
#pragma link "cxLookAndFeels"
#pragma link "DemoBasicMain"
#pragma link "cxDBVGrid"
#pragma link "cxInplaceContainer"
#pragma link "cxOI"
#pragma link "cxVGrid"
#pragma resource "*.dfm"
TRTTIInspectorDemoMainForm *RTTIInspectorDemoMainForm;
//---------------------------------------------------------------------------

PTypeInfo cxGetTypeInfo(PTypeInfo ATypeInfo, String APropName)
{
  PPTypeInfo Temp;
  Temp = GetPropInfo(ATypeInfo, APropName)->PropType;
  assert(Temp != NULL);
  return *Temp;
}

__fastcall TRTTIInspectorDemoMainForm::TRTTIInspectorDemoMainForm(TComponent* Owner)
  : TDemoBasicMainForm(Owner)
{
  PTypeInfo AInfo = cxGetTypeInfo(__typeinfo(TcxCustomEditorRowProperties),
    "EditPropertiesClassName");
  cxRegisterPropertyEditor(AInfo, __classid(TcxCustomEditorRowProperties),
    "EditPropertiesClassName", NULL);
  AInfo = cxGetTypeInfo(__typeinfo(TcxCustomEditorRowProperties), "ImageIndex");
  cxRegisterPropertyEditor(AInfo , __classid(TcxCustomEditorRowProperties),
    "ImageIndex", __classid(TcxImageIndexProperty));
  cxRegisterEditPropertiesClass(__classid(TcxImageIndexProperty),
    __classid(TcxImageComboBoxProperties));
}
//---------------------------------------------------------------------------

void __fastcall TRTTIInspectorDemoMainForm::actVGEditExecute(TObject *Sender)
{
  GetVerticalGridEditor(cxDBVerticalGrid, FSelectedObjectEvent)->Show();
}
//---------------------------------------------------------------------------

void __fastcall TRTTIInspectorDemoMainForm::FormCreate(TObject *Sender)
{
  FSelectedObjectEvent = ObjectSelected;
  ObjectSelected(cxDBVerticalGrid);
}
//---------------------------------------------------------------------------

void __fastcall TRTTIInspectorDemoMainForm::cxRTTIInspectorPropertyChanged(TObject *Sender)
{
  if (((TcxEditorRow*)((TcxRTTIInspector*)Sender)->FocusedRow)->Properties->Caption == "Name")
    GetVerticalGridEditor(cxDBVerticalGrid, FSelectedObjectEvent)->DoItemsModified();
}
//---------------------------------------------------------------------------

void __fastcall TRTTIInspectorDemoMainForm::cxVerticalGridClick(TObject *Sender)
{
  ObjectSelected(Sender);
}
//---------------------------------------------------------------------------

void __fastcall TRTTIInspectorDemoMainForm::actExportVGToHTMLExecute(TObject *Sender)
{
  cxExportVGToHTML("temp.html", cxDBVerticalGrid, false, 8, "html");
  OpenWebPage("temp.html");
}
//---------------------------------------------------------------------------

void __fastcall TRTTIInspectorDemoMainForm::actExportVGToExcelExecute(TObject *Sender)
{
  cxExportVGToExcel("temp.xls", cxDBVerticalGrid, false, true, 8, "xls");
  ShellExecute(Handle, "OPEN", "temp.xls", NULL, NULL, SW_SHOWMAXIMIZED);
}
//---------------------------------------------------------------------------

void __fastcall TRTTIInspectorDemoMainForm::cxDBVerticalGridLayoutChanged(TObject *Sender)
{
  GetVerticalGridEditor(cxDBVerticalGrid, FSelectedObjectEvent)->DoItemsModified();
}
//---------------------------------------------------------------------------

void __fastcall TRTTIInspectorDemoMainForm::actShowCustomizeExecute(TObject *Sender)
{
  cxDBVerticalGrid->Customizing->Visible = true;
}
//---------------------------------------------------------------------------

void __fastcall TRTTIInspectorDemoMainForm::actAboutExecute(TObject *Sender)
{
  ShowAbout(false, true);
}
//---------------------------------------------------------------------------

void __fastcall TRTTIInspectorDemoMainForm::ObjectSelected(TObject *Sender)
{
  cxRTTIInspector->InspectedObject = (TPersistent*)Sender;
  UpdateLabel((TComponent*)Sender);
}
//---------------------------------------------------------------------------

void __fastcall TRTTIInspectorDemoMainForm::UpdateLabel(TComponent *AObject)
{
  if (AObject != NULL) {
    lbInspectedObject->Caption = AObject->Name + ": " + AObject->ClassName();
  } else {
    lbInspectedObject->Caption = "<not selected>";
  }
}
//---------------------------------------------------------------------------


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -