procedure TForm1.FormCreate(Sender: TObject);
begin
rc.Height := PaintBox1.Height;
rc.Width := PaintBox1.Width;
PaintBox1.canvas.Brush.Color := clBlack;
PaintBox1.canvas.FillRect(rc);
FillChar(m_nCH1Data, sizeOf(m_nCH1Data), #0);
FillChar(m_nCH2Data, sizeOf(m_nCH2Data), #0);
StatusBar1.Panels[0].Text := '
Disconnected';
m_nDevIndex := rgDevice.ItemIndex;
m_nCH1VoltDIV := 5
{ DIV1V };
// 1V/DIV
m_nCH2VoltDIV := 5
{ DIV1V };
// 1V/DIV
m_nTimeDIV := 14
{ t1MSa };
// 1MSa/s
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
PaintBox1.Free;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
PaintBox1Paint(Sender);
end;
procedure TForm1.PaintBox1Paint(Sender: TObject);
Procedure Draw;
var
nTrigLevel: SmallInt;
nSlope: SmallInt;
nHTrigPos: SmallInt;
nTrigPoint: Cardinal;
nRe: SmallInt;
begin
nTrigLevel := 64;
nSlope := 0;
// 0:Rise; 1: Fall
nHTrigPos := 50;
// 0 ~ 100
nTrigPoint := 0;
nRe := dsoReadHardData(m_nDevIndex, @m_nCH1Data, @m_nCH2Data, mReadLen,
@m_nCalData, m_nCH1VoltDIV, m_nCH2VoltDIV, 0
{ TrigAuto } ,
0
{ TrigSCh1 } , nTrigLevel, nSlope, m_nTimeDIV, nHTrigPos, mDrawLen,
@nTrigPoint, 0);
if (nRe > 0)
then
begin
// Draw Grid
HTDrawGrid(PaintBox1.canvas.Handle, rc.Left, rc.Top, rc.Right, rc.Bottom,
10, 5, 500, 900);
// Draw Border
HTDrawGridBorder(PaintBox1.canvas.Handle, rc.Left+3, rc.Top+3, rc.Right-3,
rc.Bottom-3);
// Draw CH1
HTDrawWaveInYT(PaintBox1.canvas.Handle, rc,
RGB(255, 255, 0), 0,
@m_nCH1Data, mReadLen, mDrawLen, mReadLen
div 2, 64, 1.0, 1.0, 1, 0);
// Draw CH2
HTDrawWaveInYT(PaintBox1.canvas.Handle, rc,
RGB(0, 255, 0), 0,
@m_nCH2Data, mReadLen, mDrawLen, mReadLen
div 2, 192, 1.0, 1.0, 1, 0);
end;
end;
// Procedure Draw;
begin
Draw;
end;
procedure TForm1.rgDeviceClick(Sender: TObject);
begin
m_nDevIndex := rgDevice.ItemIndex;
end;