www.pudn.com > delphi-Sdk3000-ocx.zip > OsdSet.pas, change:2005-05-12,size:7024b


unit OsdSet; 
 
interface 
 
uses 
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, StdCtrls; 
 
type 
  TformOsdSet = class(TForm) 
    GroupBox1: TGroupBox; 
    checkShow1: TCheckBox; 
    editHeight1: TEdit; 
    Label1: TLabel; 
    Label2: TLabel; 
    editWidth1: TEdit; 
    Label4: TLabel; 
    editSpacing1: TEdit; 
    Label5: TLabel; 
    editLeft1: TEdit; 
    Label6: TLabel; 
    editTop1: TEdit; 
    Label7: TLabel; 
    editText1: TEdit; 
    btnFont1: TButton; 
    btnBkColor1: TButton; 
    GroupBox2: TGroupBox; 
    Label3: TLabel; 
    Label8: TLabel; 
    Label9: TLabel; 
    Label10: TLabel; 
    Label11: TLabel; 
    checkShow2: TCheckBox; 
    editHeight2: TEdit; 
    editWidth2: TEdit; 
    editSpacing2: TEdit; 
    editLeft2: TEdit; 
    editTop2: TEdit; 
    btnFont2: TButton; 
    btnBkColor2: TButton; 
    btnOk: TButton; 
    btnCancel: TButton; 
    dlgFont: TFontDialog; 
    dlgColor: TColorDialog; 
    procedure FormShow(Sender: TObject); 
    procedure btnFont1Click(Sender: TObject); 
    procedure btnBkColor1Click(Sender: TObject); 
    procedure btnFont2Click(Sender: TObject); 
    procedure btnBkColor2Click(Sender: TObject); 
    procedure btnOkClick(Sender: TObject); 
    procedure btnCancelClick(Sender: TObject); 
  private 
    { Private declarations } 
  public 
    { Public declarations } 
  end; 
 
var 
  formOsdSet: TformOsdSet; 
 
implementation 
 
uses Main; 
 
{$R *.dfm} 
 
procedure TformOsdSet.FormShow(Sender: TObject); 
begin 
    //取得文本OSD信息 
    checkShow1.Checked := formMain.SDK30001.ToShow; 
 
    editHeight1.Text := IntToStr(formMain.SDK30001.ToHeight); 
    editWidth1.Text := IntToStr(formMain.SDK30001.ToWidth); 
    editSpacing1.Text := IntToStr(formMain.SDK30001.ToSpacing); 
    editLeft1.Text := IntToStr(formMain.SDK30001.ToLeft); 
    editTop1.Text := IntToStr(formMain.SDK30001.ToTop); 
    editText1.Text := formMain.SDK30001.ToText; 
     
    //取得时间OSD信息 
    checkShow2.Checked :=  formMain.SDK30001.DoShow; 
    editHeight2.Text := IntToStr(formMain.SDK30001.DoHeight); 
    editWidth2.Text := IntToStr(formMain.SDK30001.DoWidth); 
    editSpacing2.Text := IntToStr(formMain.SDK30001.DoSpacing); 
    editLeft2.Text := IntToStr(formMain.SDK30001.DoLeft); 
    editTop2.Text := IntToStr(formMain.SDK30001.DoTop); 
end; 
 
procedure TformOsdSet.btnFont1Click(Sender: TObject); 
begin 
    dlgFont.Font.Name := formMain.SDK30001.ToFaceName; 
    dlgFont.Font.Color := formMain.SDK30001.ToTextColor; 
 
    dlgFont.Font.Style := []; 
    If(formMain.SDK30001.ToItalic) Then 
        dlgFont.Font.Style := dlgFont.Font.Style + [fsItalic]; 
    If(formMain.SDK30001.ToStrikeOut) Then 
        dlgFont.Font.Style := dlgFont.Font.Style + [fsStrikeOut]; 
    If(formMain.SDK30001.ToUnderline) Then 
        dlgFont.Font.Style := dlgFont.Font.Style + [fsUnderline]; 
    If formMain.SDK30001.ToWeight = 700 Then 
        dlgFont.Font.Style := dlgFont.Font.Style + [fsBold]; 
 
    If dlgFont.Execute() Then 
    begin 
        formMain.SDK30001.ToFaceName := dlgFont.Font.Name; 
        formMain.SDK30001.ToTextColor := dlgFont.Font.Color; 
        If fsItalic in dlgFont.Font.Style then 
            formMain.SDK30001.ToItalic := True 
        Else 
            formMain.SDK30001.ToItalic := False; 
 
        If fsStrikeOut in dlgFont.Font.Style then 
            formMain.SDK30001.ToStrikeOut := True 
        Else 
            formMain.SDK30001.ToStrikeOut := False; 
 
        If fsUnderline in dlgFont.Font.Style then 
            formMain.SDK30001.ToUnderline := True 
        Else 
            formMain.SDK30001.ToUnderline := False; 
 
        If fsBold in dlgFont.Font.Style then 
            formMain.SDK30001.ToWeight := 700 
        Else 
            formMain.SDK30001.ToWeight := 400; 
    end; 
end; 
 
procedure TformOsdSet.btnBkColor1Click(Sender: TObject); 
begin 
    formMain.SDK30001.ToTransparent := False; 
    dlgColor.Color := formMain.SDK30001.ToBkColor; 
    If dlgColor.Execute() Then 
        formMain.SDK30001.ToBkColor := dlgColor.Color; 
end; 
 
procedure TformOsdSet.btnFont2Click(Sender: TObject); 
begin 
    dlgFont.Font.Name := formMain.SDK30001.DoFaceName; 
    dlgFont.Font.Color := formMain.SDK30001.DoTextColor; 
 
    dlgFont.Font.Style := []; 
    If(formMain.SDK30001.DoItalic) Then 
        dlgFont.Font.Style := dlgFont.Font.Style + [fsItalic]; 
    If(formMain.SDK30001.DoStrikeOut) Then 
        dlgFont.Font.Style := dlgFont.Font.Style + [fsStrikeOut]; 
    If(formMain.SDK30001.DoUnderline) Then 
        dlgFont.Font.Style := dlgFont.Font.Style + [fsUnderline]; 
    If formMain.SDK30001.DoWeight = 700 Then 
        dlgFont.Font.Style := dlgFont.Font.Style + [fsBold]; 
 
    If dlgFont.Execute() Then 
    begin 
        formMain.SDK30001.DoFaceName := dlgFont.Font.Name; 
        formMain.SDK30001.DoTextColor := dlgFont.Font.Color; 
        If fsItalic in dlgFont.Font.Style then 
            formMain.SDK30001.DoItalic := True 
        Else 
            formMain.SDK30001.DoItalic := False; 
 
(*        If fsStrikeOut in dlgFont.Font.Style then 
            formMain.SDK30001.DoStrikeOut := True 
        Else 
            formMain.SDK30001.DoStrikeOut := False; 
 
        If fsUnderline in dlgFont.Font.Style then 
            formMain.SDK30001.DoUnderline := True 
        Else 
            formMain.SDK30001.DoUnderline := False; 
*) 
        If fsBold in dlgFont.Font.Style then 
            formMain.SDK30001.DoWeight := 700 
        Else 
            formMain.SDK30001.DoWeight := 400; 
    end; 
end; 
 
procedure TformOsdSet.btnBkColor2Click(Sender: TObject); 
begin 
    formMain.SDK30001.DoTransparent := False; 
    dlgColor.Color := formMain.SDK30001.DoBkColor; 
    If dlgColor.Execute() Then 
        formMain.SDK30001.DoBkColor := dlgColor.Color; 
end; 
 
procedure TformOsdSet.btnOkClick(Sender: TObject); 
begin 
 
    //取得新的文本OSD信息 
    formMain.SDK30001.ToShow := checkShow1.Checked; 
    formMain.SDK30001.ToHeight := StrToInt(editHeight1.Text); 
    formMain.SDK30001.ToWidth := StrToInt(editWidth1.Text); 
    formMain.SDK30001.ToSpacing := StrToInt(editSpacing1.Text); 
    formMain.SDK30001.ToLeft := StrToInt(editLeft1.Text); 
    formMain.SDK30001.ToTop := StrToInt(editTop1.Text); 
    formMain.SDK30001.ToText := editText1.Text; 
 
    //更新文本OSD 
    formMain.SDK30001.UpdateTextOsd(); 
 
    //取得时间OSD信息 
    formMain.SDK30001.DoShow := checkShow2.Checked; 
    formMain.SDK30001.DoHeight := StrToInt(editHeight2.Text); 
    formMain.SDK30001.DoWidth := StrToInt(editWidth2.Text); 
    formMain.SDK30001.DoSpacing := StrToInt(editSpacing2.Text); 
    formMain.SDK30001.DoLeft := StrToInt(editLeft2.Text); 
    formMain.SDK30001.DoTop := StrToInt(editTop2.Text); 
 
    //更新时间OSD 
    formMain.SDK30001.UpdateDateTimeOsd(); 
     
    //关闭此窗口 
    Close(); 
end; 
 
procedure TformOsdSet.btnCancelClick(Sender: TObject); 
begin 
    //关闭此窗口 
    Close(); 
end; 
 
end.