본문 바로가기

반응형

전체 글

Polyfit - 다차항 보상 When you make measured data from Excel into a line chart and identify the characteristics of this data, you can create a trend line to analyze it and predict what the result value will look like when there is a value between the measured data. At this time, there are multiple-order terms among the functions of the trend line. This can be obtained by Delphi code. 측정된 데이터를 엑셀에서 라인차트로 만들고 이 데이터의 특성.. 더보기
stringgrid를 마우스로 드레그하여 선택한 다음 병합하는 코드 마우스로 StringGrid 드래그를 구현한 다음 선택한 셀을 병합하려면 OnMouseDown, OnMouseMove 및 OnMouseUp 이벤트를 사용하여 마우스 이동을 추적하고 사용자가 선택한 셀을 확인할 수 있다. var Dragging: Boolean; DragRect: TRect; MergeLeft, MergeTop: Integer; MergeText: string; procedure TForm1.GridMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if (Button = mbLeft) and not (ssShift in Shift) then begin Dragging := Tru.. 더보기
stringgrid의 셀 병합하는 코드 Delphi StringGrid에서 셀을 병합하려면 OnDrawCell 이벤트를 사용하여 셀의 모양을 사용자 지정하고 병합된 셀처럼 보이게 할 수 있다. procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); var Grid: TStringGrid; Text: string; R: TRect; I, J: Integer; begin Grid := Sender as TStringGrid; if (ACol = 1) and (ARow = 1) then begin // Draw the merged cell Grid.Canvas.Font := Grid.Font; Grid.C.. 더보기
stringgrid에 체크박스 삽입하는 코드 procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); var Grid: TStringGrid; CheckBoxRect: TRect; begin Grid := Sender as TStringGrid; // Set checkbox for cell in column 2 if ACol = 2 then begin CheckBoxRect.Left := Rect.Left + ((Rect.Right - Rect.Left) - 13) div 2; CheckBoxRect.Top := Rect.Top + ((Rect.Bottom - Rect.Top) - 13) div 2; Che.. 더보기
stringgrid의 특정 셀의 색상을 변경하는 코드 procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); var Grid: TStringGrid; begin Grid := Sender as TStringGrid; // Set color for cell in row 2 and column 3 if (ACol = 3) and (ARow = 2) then begin Grid.Canvas.Brush.Color := clRed; Grid.Canvas.FillRect(Rect); end; // Draw cell contents Grid.Canvas.Font := Grid.Font; Grid.Canvas.TextRect(R.. 더보기
Stringgrid의 숫자 포멧 설정 stringgrid의 셀에서 숫자의 실수형의 포멧을 지정하는 방법 procedure TForm1.StringGrid1GetEditText(Sender: TObject; ACol, ARow: Integer; var Value: string); begin // Set format for real numbers in column 2 if (ACol = 2) and TryStrToFloat(Value, Value) then Value := FormatFloat('#,##0.00', StrToFloat(Value)); end; 더보기
Stringgrid의 셀의 폰트와 정렬 Stringgrid의 셀에서 폰트와 가운데 정렬 등을 할 때 아래와 같은 코드를 사용한다. procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); var S: string; Grid: TStringGrid; Font: TFont; TextWidth: Integer; begin Grid := Sender as TStringGrid; // Get cell contents S := Grid.Cells[ACol, ARow]; // Create font Font := TFont.Create; Font.Size := 12; Font.Name := 'Arial'; if AR.. 더보기
HPF & LPF 가속도센서는 HPF를 사용하고 기울기 센서는 LFP를 사용한다. 1. HPF procedure HighPassFilter(var input, output: TArray; const freq, fs: Double); var i: Integer; RC, dt, alpha, y1: Double; begin // Calculate filter constants RC := 1 / (2 * PI * freq); dt := 1 / fs; alpha := RC / (RC + dt); // Apply filter to input signal y1 := input[0]; for i := 1 to High(input) do begin output[i] := alpha * (output[i-1] + input[i] - inp.. 더보기

반응형