unit2.cpp
来自「一个串口测试程序」· C++ 代码 · 共 41 行
CPP
41 行
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "stdio.h"
#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// 串口数据
void __fastcall TForm2::FormCreate(TObject *Sender)
{
FILE *fp;
fp=fopen(".\\串口数据.txt","w");
fprintf(fp,"%s","");
fclose(fp);
Form2->Memo1->Lines->LoadFromFile("串口数据.txt");
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Timer1Timer(TObject *Sender)
{
Form2->Memo1->Lines->LoadFromFile("串口数据.txt");
}
//---------------------------------------------------------------------------
void __fastcall TForm2::FormCanResize(TObject *Sender, int &NewWidth,
int &NewHeight, bool &Resize)
{
Memo1->Width=Form2->Width;
Memo1->Height=Form2->Height;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?