小编wit*_*rup的帖子

Delphi XE LiveBindings - 比特到字节

我刚刚发现了Delphi的实时绑定.并创建了我的第一个组件来处理变频器的控制字.它自己的组件似乎可以很好地在表单设计器中测试它.但是,编译和运行应用程序的东西不起作用.像这样的livbindings的屏幕截图:

Livebindings截图

这是组件的代码

unit cBits2Byte;

interface

uses
  System.SysUtils, System.Classes;

type
  TBits2Byte = class(TComponent)
  private
    { Private declarations }
    fBit00, fBit01, fBit02, fBit03, fBit04, fBit05, fBit06, fBit07: Boolean;
    function bitstate(sfr, bit: Byte): Boolean;
    function ReadByte: Byte;
    procedure WriteByte(aByte: Byte);
  published
    { Published declarations }
    property char: byte read ReadByte write WriteByte;

    property Bit00: Boolean read fBit00 write fBit00;
    property Bit01: Boolean read fBit01 write fBit01;
    property Bit02: Boolean read fBit02 write fBit02;
    property Bit03: Boolean read fBit03 write fBit03;
    property Bit04: Boolean …
Run Code Online (Sandbox Code Playgroud)

delphi bit-shift livebindings delphi-xe7

3
推荐指数
1
解决办法
314
查看次数

Delphi 将字节数组转换为 TBytes - UDP 重定向?

procedure TForm1.UDPUDPRead(AThread: TIdUDPListenerThread; 
                              AData: array of Byte; ABinding: TIdSocketHandle);
var
  buffer : TBytes;
begin
  SetLength(buffer, Length(AData));
  buffer := @AData[0];
 end;
Run Code Online (Sandbox Code Playgroud)

此代码导致访问冲突。

什么是要转换的正确方法字节数组TB的在Delphi XE3?

delphi udp casting type-conversion delphi-xe3

2
推荐指数
1
解决办法
6020
查看次数

Delphi - 映射函数意外输出

在Arduino库中找到了这个天才地图功能.和Delphi写的一样:

procedure TForm1.Button1Click(Sender: TObject);
function map(x, in_min, in_max, out_min, out_max: Integer): extended;
begin
  result := (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
end;
var
  y, in_min, in_max, out_min, out_max: Integer;
  i: integer;
  m: extended;
begin
  in_min := 0;
  in_max := 6406963;
  out_min := 0;
  out_max := 474;
  y := 0;

  for i := in_min to in_max do begin
    m := map(i, in_min, in_max, out_min, out_max);
    if round(m) <> y then begin
        y …
Run Code Online (Sandbox Code Playgroud)

python delphi mapping floating-point range

1
推荐指数
1
解决办法
191
查看次数