zoukankan      html  css  js  c++  java
  • Android实例-闪光灯的控制(XE8+小米2)

     1 unit Unit1;
     2 
     3 interface
     4 
     5 uses
     6   System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
     7   FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Media,
     8   FMX.Controls.Presentation, FMX.StdCtrls;
     9 
    10 type
    11   TForm1 = class(TForm)
    12     CameraComponent1: TCameraComponent;//闪光灯的控制控件
    13     Button1: TButton;
    14     procedure FormCreate(Sender: TObject);
    15     procedure Button1Click(Sender: TObject);
    16   private
    17     { Private declarations }
    18   public
    19     { Public declarations }
    20   end;
    21 
    22 var
    23   Form1: TForm1;
    24 
    25 implementation
    26 
    27 {$R *.fmx}
    28 {$R *.NmXhdpiPh.fmx ANDROID}
    29 
    30 procedure TForm1.Button1Click(Sender: TObject);
    31 begin
    32   if Button1.Text = '' then
    33   begin
    34     CameraComponent1.TorchMode := TTorchMode.tmModeOn;//开灯
    35     Button1.Text := '';
    36   end
    37   else
    38   begin
    39     CameraComponent1.TorchMode := TTorchMode.tmModeOff;//关灯
    40     Button1.Text := '';
    41   end;
    42 end;
    43 
    44 procedure TForm1.FormCreate(Sender: TObject);
    45 begin
    46   Button1.Enabled := CameraComponent1.HasFlash;//如果没有闪光灯,则按钮不起作用
    47   CameraComponent1.Active := True;
    48 end;
    49 
    50 end.
  • 相关阅读:
    [机房测试]11.11
    题解——[AHOI2013]作业(莫队)
    [机房测试]11.7
    [机房测试]11.6
    [机房测试]11.5
    [机房测试]11.4
    [机房测试]10.29
    [机房测试]10.28
    初学SPFA
    神奇的游戏
  • 原文地址:https://www.cnblogs.com/FKdelphi/p/4745831.html
Copyright © 2011-2022 走看看