📄 comset.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "ComSet.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TSetCom *SetCom;
//---------------------------------------------------------------------------
__fastcall TSetCom::TSetCom(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TSetCom::Button2Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TSetCom::Button1Click(TObject *Sender)
{
MainForm->Comm->StopComm();
MainForm->Comm->CommName=ComName->Text;
MainForm->Comm->BaudRate=BaudRate->Text.ToIntDef(9600);
MainForm->Comm->ByteSize=ByteSize->Text.ToIntDef(_8);
MainForm->Comm->StopBits=StopBits->Text.ToIntDef(_1);
try
{
MainForm->Comm->StartComm();
Close();
}
catch(...)
{
Application->MessageBoxA("串口通信参数设置错误!\n现在串口停止工作。","串口错误",0);
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -