ColorControl.pas
上传用户:hylc_2004
上传日期:2014-01-23
资源大小:46800k
文件大小:3k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. unit ColorControl;
  2. interface
  3. uses
  4.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  5.   Dialogs, Buttons, StdCtrls, ComCtrls, ExtCtrls;
  6. type
  7.   TColorControlForm = class(TForm)
  8.     Shape1: TShape;
  9.     Label1: TLabel;
  10.     TrackBar1: TTrackBar;
  11.     Label2: TLabel;
  12.     TrackBar2: TTrackBar;
  13.     Label3: TLabel;
  14.     TrackBar3: TTrackBar;
  15.     Label4: TLabel;
  16.     TrackBar4: TTrackBar;
  17.     CheckBox1: TCheckBox;
  18.     SpeedButton1: TSpeedButton;
  19.     procedure FormDeactivate(Sender: TObject);
  20.     procedure FormShow(Sender: TObject);
  21.     procedure Button1Click(Sender: TObject);
  22.     procedure TrackBar1Change(Sender: TObject);
  23.     procedure TrackBar2Change(Sender: TObject);
  24.     procedure TrackBar3Change(Sender: TObject);
  25.     procedure TrackBar4Change(Sender: TObject);
  26.     procedure CheckBox1Click(Sender: TObject);
  27.     procedure SpeedButton1Click(Sender: TObject);
  28.     procedure GetValues;
  29.   private
  30.     { Private declarations }
  31.   public
  32.     { Public declarations }
  33.   end;
  34. var
  35.   ColorControlForm: TColorControlForm;
  36. implementation
  37. uses Unit1;
  38. {$R *.dfm}
  39. procedure TColorControlForm.FormDeactivate(Sender: TObject);
  40. begin
  41.   Close;
  42. end;
  43. procedure TColorControlForm.FormShow(Sender: TObject);
  44. begin
  45.   Color := FormDVDPlayer.DSVideoWindowEx1.ColorKey;
  46.   Shape1.Brush.Color := FormDVDPlayer.DSVideoWindowEx1.ColorKey;
  47.   Left := FormDVDPlayer.DSVideoWindowEx1.ClientOrigin.X + (FormDVDPlayer.DSVideoWindowEx1.Width div 2) - (Width div 2);
  48.   Top := FormDVDPlayer.DSVideoWindowEx1.ClientOrigin.Y + (FormDVDPlayer.DSVideoWindowEx1.Height div 2) - (Height div 2);
  49.   GetValues;
  50. end;
  51. procedure TColorControlForm.Button1Click(Sender: TObject);
  52. begin
  53.   FormDVDPlayer.DSVideoWindowEx1.ColorControl.RestoreDefault;
  54. end;
  55. procedure TColorControlForm.TrackBar1Change(Sender: TObject);
  56. begin
  57.   FormDVDPlayer.DSVideoWindowEx1.ColorControl.Brightness := TrackBar1.Position;
  58. end;
  59. procedure TColorControlForm.TrackBar2Change(Sender: TObject);
  60. begin
  61.   FormDVDPlayer.DSVideoWindowEx1.ColorControl.Contrast := TrackBar2.Position;
  62. end;
  63. procedure TColorControlForm.TrackBar3Change(Sender: TObject);
  64. begin
  65.   FormDVDPlayer.DSVideoWindowEx1.ColorControl.Hue := TrackBar3.Position;
  66. end;
  67. procedure TColorControlForm.TrackBar4Change(Sender: TObject);
  68. begin
  69.   FormDVDPlayer.DSVideoWindowEx1.ColorControl.Saturation := TrackBar4.Position;
  70. end;
  71. procedure TColorControlForm.CheckBox1Click(Sender: TObject);
  72. begin
  73.   FormDVDPlayer.DSVideoWindowEx1.ColorControl.ColorEnable := CheckBox1.Checked;
  74. end;
  75. procedure TColorControlForm.SpeedButton1Click(Sender: TObject);
  76. begin
  77.   FormDVDPlayer.DSVideoWindowEx1.ColorControl.RestoreDefault;
  78.   GetValues;
  79. end;
  80. procedure TColorControlForm.GetValues;
  81. Begin
  82.   CheckBox1.Checked := FormDVDPlayer.DSVideoWindowEx1.ColorControl.ColorEnable;
  83.   TrackBar4.Position := FormDVDPlayer.DSVideoWindowEx1.ColorControl.Saturation;
  84.   TrackBar3.Position := FormDVDPlayer.DSVideoWindowEx1.ColorControl.Hue;
  85.   TrackBar2.Position := FormDVDPlayer.DSVideoWindowEx1.ColorControl.Contrast;
  86.   TrackBar1.Position := FormDVDPlayer.DSVideoWindowEx1.ColorControl.Brightness;
  87. End;
  88. end.