📄 baseviewunit.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "BaseViewUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TBaseViewFrm *BaseViewFrm;
//---------------------------------------------------------------------------
__fastcall TBaseViewFrm::TBaseViewFrm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TBaseViewFrm::OnNumOnlyEditChange(TObject *Sender)
{
TEdit* pEdit = (TEdit*)Sender;
SetWindowLong(pEdit->Handle, GWL_STYLE,GetWindowLong(pEdit->Handle,GWL_STYLE)|ES_NUMBER);
try
{
pEdit->Text.ToInt();
}
catch(...)
{
pEdit->Text = "";
}
}
//---------------------------------------------------------------------------
void __fastcall TBaseViewFrm::OnRecordInfoColumnClick(
TObject *Sender, TListColumn *Column)
{
ColumnToSortIndex = Column->Index;
((TCustomListView *)Sender)->AlphaSort();
}
//---------------------------------------------------------------------------
void __fastcall TBaseViewFrm::OnRecordInfoCompare(TObject *Sender,
TListItem *Item1, TListItem *Item2, int Data, int &Compare)
{
if (ColumnToSortIndex == 0) //选中的是序列号 列
{
int l1 = StrToInt(Item1->Caption);
int l2 = StrToInt(Item2->Caption);
if (l1>l2)
Compare = 1;
else if (l1 == l2)
Compare = 0;
else
Compare = -1;
}
else
{
int ix = ColumnToSortIndex -1;
Compare = CompareText(Item1->SubItems->Strings[ix], Item2->SubItems->Strings[ix]);
}
}
//---------------------------------------------------------------------------
void __fastcall TBaseViewFrm::ClearSpeedButtonCaption()
{
for(int i = 0;i < this->ComponentCount;i++)
{
//批命名日期按键
if(this->Components[i]->ClassNameIs("TSpeedButton"))
{
TSpeedButton* pBtn = (TSpeedButton*)this->Components[i];
if (pBtn->Parent->Name == "tbTools")
{
pBtn->Caption = "";
}
}
}
}
//---------------------------------------------------------------------------
void TBaseViewFrm::SetCaption(AnsiString iCaption)
{
this->Caption = iCaption;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -