📄 datacontrol.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "DataControl.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
TComControl *ComControl;
//---------------------------------------------------------------------------
__fastcall TComControl::TComControl()
{
pCb = NULL;
pEd = NULL;
pLb = NULL;
pCbx = NULL;
pShp = NULL;
ObjectID=0;
bZoom = 0;
bSign = 0;
bUsed = 0;
SizeLen = 0;
EditStyle = 0;
iPosCol = 0;
}
TComControl::~TComControl()
{
//
}
void __fastcall TComControl::SetParent(TWinControl *Owner)
{
pParent = Owner;
}
void __fastcall TComControl::SetEditPosition()
{
pCb->Left = ileft;
pCb->Top = itop+2;
pCb->Width = cbWidth-3;
pCb->Height = iheight-2;
pLb->Left = ileft+cbWidth;
pLb->Top = itop;
pLb->Width = lbWidth;
pLb->Height = iheight;
pEd->Left = ileft+cbWidth+lbWidth+2;
pEd->Top = itop;
pEd->Width = edWidth;
pEd->Height = iheight - 2;
}
void __fastcall TComControl::BuildEdit()
{
pCb = new TCheckBox(pParent);
pLb = new TEdit(pParent);
pEd = new TMaskEdit(pParent);
pCb->Parent = pParent;
pLb->Parent = pParent;
pEd->Parent = pParent;
pCb->Left = -200;
pLb->Left = -200;
pEd->Left = -200;
pCb->Top = 1000;
pLb->Top = 1000;
pEd->Top = 1000;
pCb->Caption = "";
pCb->Color = clWindow;
pLb->BorderStyle = bsNone;
pLb->Ctl3D = false;
pLb->AutoSize = false;
pLb->Color = clSilver;
pLb->TabStop = false;
pLb->ReadOnly = true;
pEd->BorderStyle=bsNone;
EditStyle = 0;
}
void __fastcall TComControl::SetCombPosition()
{
pCb->Left = ileft;
pCb->Top = itop+2;
pCb->Width = cbWidth-3;
pCb->Height = iheight-2;
pLb->Left = ileft+cbWidth;
pLb->Top = itop;
pLb->Width = lbWidth;
pLb->Height = iheight;
pCbx->Left = ileft+cbWidth+lbWidth+2;
pCbx->Top = itop;
pCbx->Width = edWidth;
pCbx->Height = iheight - 2;
}
void __fastcall TComControl::BuildComb()
{
pCb = new TCheckBox(pParent);
pLb = new TEdit(pParent);
pCbx = new TComboBox(pParent);
pCb->Parent = pParent;
pLb->Parent = pParent;
pCbx->Parent = pParent;
pCbx->Left = -200;
pCb->Left = -200;
pLb->Left = -200;
pCbx->Left = -200;
pCb->Top = 1000;
pLb->Top = 1000;
pCbx->Top = 1000;
pCb->Caption = "";
pCb->Color = clWindow;
pLb->BorderStyle = bsNone;
pLb->Ctl3D = false;
pLb->AutoSize = false;
pLb->Color = clSilver;
pLb->ReadOnly = true;
pLb->TabStop = false;
pCbx->Ctl3D = false;
pCbx->ItemIndex=1;
pCbx->Font->Size = 9;
pCbx->Style = csDropDownList;
EditStyle = 1;
}
void __fastcall TComControl::SetShapePosition()
{
pCb->Left = ileft;
pCb->Top = itop+2;
pCb->Width = cbWidth-3;
pCb->Height = iheight-2;
pLb->Left = ileft+cbWidth;
pLb->Top = itop;
pLb->Width = lbWidth;
pLb->Height = iheight;
pShp->Left = ileft+cbWidth+lbWidth+12;
pShp->Top = itop+5;
pShp->Width = 18;
pShp->Height = 10;
}
void __fastcall TComControl::BuildShape()
{
pCb = new TCheckBox(pParent);
pLb = new TEdit(pParent);
pShp = new TStaticText(pParent);
pCb->Parent = pParent;
pLb->Parent = pParent;
pShp->Parent = pParent;
pCb->Left = -200;
pLb->Left = -200;
pShp->Left = -200;
pCb->Top = 1000;
pLb->Top = 1000;
pShp->Top = 1000;
pCb->Caption = "";
pCb->Color = clWindow;
pLb->BorderStyle = bsNone;
pLb->Ctl3D = false;
pLb->AutoSize = false;
pLb->Color = clSilver;
pLb->ReadOnly = true;
pLb->TabStop = false;
pShp->Caption = "";
pShp->AutoSize = false;
pShp->Brush->Color = clGreen;
EditStyle = 2;
}
void __fastcall TComControl::SetPos(int aleft, int atop, int width1,int width2, int width3, int aheight)
{
ileft = aleft;
itop = atop;
cbWidth = width1;
lbWidth = width2;
edWidth = width3;
iheight = aheight;
}
void __fastcall TComControl::MakeEmpty()
{
if(pCb)
delete pCb;
if(pEd)
delete pEd;
if(pLb)
delete pLb;
if(pCbx)
delete pCbx;
if(pShp)
delete pShp;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -