www.pudn.com > TMIDIPlayer_w_MidiSheet.rar > SyncLyricsAdjust.pas, change:2012-05-28,size:2711b


unit SyncLyricsAdjust; 
 
interface 
 
{$DEFINE MULTI_LANGUAGE} 
 
uses 
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 
  StdCtrls, Buttons, ComCtrls, slider{$IFDEF MULTI_LANGUAGE}, gnugettext{$ENDIF}; 
 
type 
  TLyricsAdjustForm = class(TForm) 
    lblTransparency: TLabel; 
    lblOpaque: TLabel; 
    lblSmall: TLabel; 
    Label3: TLabel; 
    lblScale: TLabel; 
    Label5: TLabel; 
    Label6: TLabel; 
    Label1: TLabel; 
    TrackBar1: TSlider; 
    TrackBar2: TSlider; 
    btnClose: TButton; 
    Edit1: TEdit; 
    Edit2: TEdit; 
    procedure btnCloseClick(Sender: TObject); 
    procedure FormActivate(Sender: TObject); 
    procedure TrackBar2Change(Sender: TObject); 
    procedure FormCreate(Sender: TObject); 
    procedure FormClose(Sender: TObject; var Action: TCloseAction); 
    procedure TrackBar1StopTracking(Sender: TObject); 
    procedure TrackBar1Change(Sender: TObject); 
  private 
    { Private declarations } 
  public 
    { Public declarations } 
     LyricsHandle : HWND; 
     Transparency : integer; 
     ScaleFactor  : double; 
  end; 
 
var 
  LyricsAdjustForm: TLyricsAdjustForm; 
 
implementation 
 
uses ShowMIDILyrics; 
 
{$R *.DFM} 
 
 
procedure TLyricsAdjustForm.btnCloseClick(Sender: TObject); 
begin 
   Close; 
end; 
 
procedure TLyricsAdjustForm.FormActivate(Sender: TObject); 
begin 
   TrackBar1.Value := Transparency; 
   TrackBar2.Value := round(ScaleFactor * 100); 
   Edit1.Text := intToStr(round(TrackBar1.Value / 2.55)) + '%'; 
   Edit2.Text := FormatFloat('0.00', TrackBar2.Value / 100); 
   TrackBar1.OnChange := TrackBar1Change; 
   TrackBar2.OnChange := TrackBar2Change; 
end; 
 
procedure TLyricsAdjustForm.TrackBar1Change(Sender: TObject); 
begin 
   Edit1.Text := intToStr(round(TrackBar1.Value / 2.55)) + '%'; 
end; 
 
procedure TLyricsAdjustForm.TrackBar1StopTracking(Sender: TObject); 
begin 
   Edit1.Text := intToStr(round(TrackBar1.Value / 2.55)) + '%'; 
   PostMessage(LyricsHandle, WM_SyncLyricsConfig, SyncLyrics_BackTransparency, 255 - TrackBar1.Value); 
end; 
 
procedure TLyricsAdjustForm.TrackBar2Change(Sender: TObject); 
begin 
   Edit2.Text := FormatFloat('0.00', TrackBar2.Value / 100); 
   PostMessage(LyricsHandle, WM_SyncLyricsConfig, SyncLyrics_ScaleAdj, TrackBar2.Value); 
end; 
 
procedure TLyricsAdjustForm.FormCreate(Sender: TObject); 
begin 
  {$IFDEF MULTI_LANGUAGE} 
   TranslateComponent(Self); 
  {$ENDIF} 
end; 
 
procedure TLyricsAdjustForm.FormClose(Sender: TObject; 
  var Action: TCloseAction); 
begin 
 // 프로그램이 Activation시 TrackBar1.Value 또는 TrackBar2.Value를 변경하면서 발생하는 이벤트 방지 
   TrackBar1.OnChange := nil; 
   TrackBar2.OnChange := nil; 
end; 
 
end.