Files
winapp/CodesFrameUnit.cpp
2026-11-18 10:24:38 +08:00

52 lines
1.5 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <System.StrUtils.hpp>
#include "CodesFrameUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TCodesFrame *CodesFrame = NULL;
//---------------------------------------------------------------------------
__fastcall TCodesFrame::TCodesFrame(TComponent* Owner)
: TFrame(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TCodesFrame::SetDesc(const String& src)
{
m_memDesc->Lines->Clear();
// TStringDynArray lines = SplitString(src, L";。;:"); // 或 ";",看 String 是 UnicodeString/AnsiString
// bool bAny = false;
// for (int i = 0; i < lines.Length; i++){ // TStringDynArray 0-based
// String s = lines[i].Trim();
// if (s.Length()) {
// m_memDesc->Lines->Add(s);
// bAny = true;
// }
// }
// if (!bAny)
// m_memDesc->Lines->Add("该实例暂无描述");
String cur;
for (int i = 1; i <= src.Length(); i++) {
cur += src[i];
if (src[i] == L';' || src[i] == L'。' || src[i] == L';' || src[i] == L':' ) {
m_memDesc->Lines->Add(cur); // cur 是 AnsiString,Add 接受 String
cur = "";
}
}
if (cur.Length())
m_memDesc->Lines->Add(cur);
if (m_memDesc->Lines->Count == 0)
m_memDesc->Lines->Add("该实例暂无描述");
}
//---------------------------------------------------------------------------