⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.pas

📁 用delphi控制olymplus C7070相机的例子
💻 PAS
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, OleCtrls, RYENVLib_TLB, ComCtrls,ActiveX, RYELib_TLB;
type
  prye_custom_mode=^rye_custom_mode;
  rye_custom_mode=record
    nflashmode:Integer;  //flash mode
    nspotmacro:Integer;  //spot&macro
    //RYE_CUSTOM_MACOR_SPOT_OF
    //RYE_CUSTOM_MACRO_ON
    //RYE_CUSTOM_SPOT_ON
    nfocal_length_numerator:Integer; //focal length* nfocal_length_denomonator
    nfocal_length_denomonator:Integer; //10
    naperture_numerator:Integer;  //aperture value * naperture_denominator
    naperture_denominator:Integer; //10
    nexposuretime:Integer;  //exposure time in microsends
    nexposbias_numerator:Integer; //exposure bias value * nexpobias_denominator
    nexposbias_denominator:Integer; //10
    nfocusmode:integer; //focus mode
    //RYE_CUSTOM_AUTO
    //RYE_CUSTOM_MANUAL
    nwhiteblanacemode:Integer;//white blanace mode
    nisomode:Integer; //iso speed rate value
    nezoom:Integer;//digital zoom mode
    //RYE_CUSTOM_EZOOM_OFF
    //RYE_CUSTOM_EZOOM_ON
    nfunctionmode:Integer;//function mode
    //RYE_CUSTOM_FUNC_OFF
    //RYE_CUSTOM_FUNC_MONO
    //RYE_CUSTOM_FUNC_SEPIA
    //RYE_CUSTOM_FUNC_WBOARD
    //RYE_CUSTOM_FUNC_BBOARD
    nresolutionmode:Integer;//resolution mode
    //RYE_CUSTOM_RESO_HQ
    //RYE_CUSTOM_RESO_SHQ
    //RYE_CUSTOM_RESO_SQ1
    //RYE_CUSTOM_RESO_SQ2
    //RYE_CUSTOM_RESO_TIFF
    nprogrammode:Integer;//program mode
    //RYE_CUSTOM_PROGRAM_MANUAL=1
    //RYE_CUSTOM_PROGRAM_APERTURE_PRIORITY=3
    //RYE_CUSTOM_PROGRAM_SHUTTER_PRIORITY
    end;


type
  TForm1 = class(TForm)
    btn1: TButton;
    stat1: TStatusBar;
    Label1: TLabel;
    edt1: TEdit;
    btn2: TButton;
    trckbr1: TTrackBar;
    btn3: TButton;
    btn4: TButton;
    rynvcntrlry1: TRye;
    btn5: TButton;
    procedure btn1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure btn2Click(Sender: TObject);
    procedure btn3Click(Sender: TObject);
    procedure btn4Click(Sender: TObject);
    procedure trckbr1Change(Sender: TObject);
    procedure btn5Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  num:Integer;
  lcdon,flashon:Boolean;
  oldpara,newpara:prye_custom_mode;
implementation

{$R *.dfm}

procedure TForm1.btn1Click(Sender: TObject);
var
  count:Integer;
begin
    rynvcntrlry1.propFlash[0]:=0;
    rynvcntrlry1.propResolution[0]:=1;
    rynvcntrlry1.Capture(0);
    count:=rynvcntrlry1.PropPicCount[0];
    edt1.Text:=IntToStr(count);
    rynvcntrlry1.SetLcdMode(0,2);
    lcdon:=true;
//    rynvcntrlry1.DisConnect(0);

end;

procedure TForm1.FormCreate(Sender: TObject);
begin
    lcdon:=False;
    flashon:=True;
    if rynvcntrlry1.InitControl=0 then
    stat1.Panels[0].Text:='检测到数码相机';
    num:=rynvcntrlry1.PropCameraCount;
    if num<>0 then stat1.Panels[1].Text:='数量:'+inttostr(num);
          if rynvcntrlry1.Connect(0)<>0 then
      ShowMessage('连接错误!');
end;

procedure TForm1.btn2Click(Sender: TObject);
begin
  if lcdon then
  rynvcntrlry1.SetLcdMode(0,1)
  else
  rynvcntrlry1.SetLcdMode(0,2);
  lcdon:=not lcdon;
end;

procedure TForm1.btn3Click(Sender: TObject);
var
  bright:Integer;
//  buff:OleVariant;
begin
//  New(oldpara);
//   if rynvcntrlry1.Connect(0)=0 then
//   ShowMessage('ok');
//   buff:=VarArrayCreate([0,256],varByte);
//   VarArrayUnlock(buff);
//   rynvcntrlry1.GetCustomValue(0,buff);
//  if rynvcntrlry1.Connect(0)=0 then

//     rynvcntrlry1.propFocusPosition[0]:=20;
//     rynvcntrlry1.DisConnect(0);
      bright:=rynvcntrlry1.propOpticalZoom[0];
      ShowMessage(IntToStr(bright));
//      Dec(bright);
//      if rynvcntrlry1.InitControl=0 then
//     rynvcntrlry1.propOpticalZoom[0]:=90;
//     rynvcntrlry1.Preview(0);
//     rynvcntrlry1.DisConnect(0);






end;

procedure TForm1.btn4Click(Sender: TObject);
var
bright:Integer;
begin
      bright:=rynvcntrlry1.propOpticalZoom[0];
      Dec(bright);
      if rynvcntrlry1.InitControl=0 then
     rynvcntrlry1.propOpticalZoom[0]:=bright;
end;

procedure TForm1.trckbr1Change(Sender: TObject);
//var
//  bright:Integer;
begin
//      bright:=rynvcntrlry1.propOpticalZoom[0];
//  if rynvcntrlry1.InitControl=0 then
     rynvcntrlry1.propOpticalZoom[0]:=trckbr1.Position;
end;

procedure TForm1.btn5Click(Sender: TObject);
begin
//  if flashon then
//   rynvcntrlry1.propFocusMode[0]:=1
//   else
   rynvcntrlry1.propFocusMode[0]:=3;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -