求delphi翻译成C#
Ruoch 2018-11-08 11:13:32 unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, MMSYSTEM, ComCtrls, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Timer1: TTimer;
TrackBar1: TTrackBar;
TrackBar2: TTrackBar;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
Button2: TButton;
Memo1: TMemo;
RadioButton3: TRadioButton;
RadioButton4: TRadioButton;
RadioButton5: TRadioButton;
RadioButton6: TRadioButton;
procedure Timer1Timer(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
b1,b2:Integer;
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
var
MyJoy: TJoyInfo;
ErrorResult: MMRESULT;
begin
Timer1.Enabled:=False;
ErrorResult := joyGetPos(joystickid1, @MyJoy);
if ErrorResult = JOYERR_NOERROR then
begin
TrackBar1.Position := MyJoy.wypos;
TrackBar2.Position := MyJoy.wxpos;
RadioButton1.Checked := (MyJoy.wbuttons and joy_button1) > 0;
RadioButton2.Checked := (MyJoy.wbuttons and joy_button2) > 0;
RadioButton3.Checked := (MyJoy.wbuttons and joy_button3) > 0;
RadioButton4.Checked := (MyJoy.wbuttons and joy_button4) > 0;
RadioButton5.Checked := (MyJoy.wbuttons and joy_button5) > 0;
RadioButton6.Checked := (MyJoy.wbuttons and joy_button6) > 0;
if RadioButton1.Checked then begin
inc(b1);
memo1.Lines.Add('button1--'+IntToStr(b1));
end;
if RadioButton2.Checked then begin
inc(b2);
memo1.Lines.Add('button2--'+IntToStr(b2));
end;
Timer1.Enabled:=True;
end
else
case ErrorResult of
MMSYSERR_NODRIVER: ShowMessage('No Joystick driver present');
MMSYSERR_INVALPARAM: ShowMessage('Invalid Joystick Paramameters');
JOYERR_UNPLUGGED: ShowMessage('Joystick is Unplugged');
else
ShowMessage('Unknown error with Joystick');
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
b1:=0;
b2:=0;
Timer1.Enabled:=True;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
b1:=0;
b2:=0;
end;
end.
-----------------------------以上是delphi的代码 这个代码的作用是调用一种叫做图像采集手柄的,求翻译 (我用的是广东医疗行业常见的蓝韵采集手柄)