AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Performance im create

Ein Thema von xZise · begonnen am 2. Aug 2006 · letzter Beitrag vom 2. Aug 2006
 
Benutzerbild von xZise
xZise

Registriert seit: 3. Mär 2006
Ort: Waldbronn
4.303 Beiträge
 
Delphi 2009 Professional
 
#1

Performance im create

  Alt 2. Aug 2006, 13:43
Kann man diese funktion schneller machen?

Delphi-Quellcode:
procedure TfrmMain.FormCreate(Sender: TObject);
var Ini : TIniFile;
    s : String;
    Zeit : Cardinal;
begin
  Zeit := GetTickCount;

  Spectrum := TSpectrum.Create(pbSVis.Width, pbSVis.Height);
  with Spectrum do
  begin
    PenColor := clBlack;
    Height := pbSVis.Height;
    PeakColor := clBlack;
  end;

  DoubleBuffered := True;

  Ini := TIniFile.Create(ExtractFilePath(application.exename) + 'settings.ini');
  try
  iVis := Ini.ReadInteger('Settings', 'vis', 3);
  if iVis = 0 then
  begin
    None1.Checked := True;
    Oscilloscope1.Checked := False;
    SpectrumLines1.Checked := False;
    SpectrumSolid1.Checked := False;
  end;
  if iVis = 1 then
  begin
    None1.Checked := False;
    Oscilloscope1.Checked := True;
    SpectrumLines1.Checked := False;
    SpectrumSolid1.Checked := False;
  end;
  if iVis = 2 then
  begin
    None1.Checked := False;
    Oscilloscope1.Checked := False;
    SpectrumLines1.Checked := True;
    SpectrumSolid1.Checked := False;
  end;
  if iVis = 3 then
  begin
    None1.Checked := False;
    Oscilloscope1.Checked := False;
    SpectrumLines1.Checked := False;
    SpectrumSolid1.Checked := True;
  end;
  xiVolume.Position := Ini.ReadInteger('Settings', 'volume', 50);
  rbSeq.Checked := Ini.ReadBool('Settings', 'sequence', True);
  rbRandom.Checked := Ini.ReadBool('Settings', 'random', False);
  rbLoop.Checked := Ini.ReadBool('Settings', 'loop', False);
  finally
  Ini.Free;
  end;
  with TIniFile.Create(ExtractFilePath(application.exename) + 'settings.ini') do
    try
      FadeTime := ReadFloat('Settings', 'FadeTime', 3);
      FadeOutOnClose := ReadBool('Settings', 'FadeOutOnClose', true);
      //EQSet := ReadInteger('Settings', 'EQSet', 0);
      Crossfade := ReadBool('Settings', 'Crossfade', true);
    finally
      Free;
    end;

  DoubleBuffered := True;
  BASS_Init(1, 44100, 0, Application.Handle, nil);
  BASS_SetConfig(BASS_CONFIG_BUFFER,1000);

  eqTb1.Position := eqTb1.Max div 2;
  eqTb2.Position := eqTb2.Max div 2;
  eqTb3.Position := eqTb3.Max div 2;
  eqReverb.Position := eqReverb.Max;

  DrawSkin;
end;
Delphi-Quellcode:
procedure TfrmMain.DrawSkin;
var
  Skin : TIniFile;
  s : string;
  i : Integer;
begin
  with TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'settings.ini') do
    try
      s := ExtractFilePath(Application.ExeName) + 'skins\' + ReadString('Settings', 'Skin', 'blue.dpsf');
    finally
      Free;
    end;

  if FileExists(s) then begin
    Skin := TIniFile.Create(s);
    try
      xiBg.ColorGrad := StringToColor(Skin.ReadString('Backgrnd', 'Grad', 'clSkyBlue'));
      xiBg.ColorFace := StringToColor(Skin.ReadString('Backgrnd', 'Face', '$00FE9741'));
      // Playlist
      lbList.Color := StringToColor(Skin.ReadString('Playlist', 'Backgrnd', '$00F3C091'));
      lbList.Font.Color := StringToColor(Skin.ReadString('Playlist', 'Font', 'clWindowText'));
      // Top
      xiCaptionBar.ColorFace := StringToColor(Skin.ReadString('Top', 'Face', '$00FF0301'));
      xiCaptionBar.ColorGrad := StringToColor(Skin.ReadString('Top', 'Grad', '$00FE9741'));
      xiCaptionBar.ColorLight := StringToColor(Skin.ReadString('Top', 'Light', '$00F0964D'));
      xiCaptionBar.ColorDark := StringToColor(Skin.ReadString('Top', 'Dark', '$00B35900'));
      xiCaptionBar.Font.Color := StringToColor(Skin.ReadString('Top', 'Font', 'clWindowText'));


      for i := 0 to frmMain.ComponentCount - 1 do begin
        if frmMain.Components[i] is TXiButton then begin
          with (frmMain.Components[i] as TXiButton) do begin
            ColorBorder := StringToColor(Skin.ReadString('Buttons', 'Border', '$00B35900'));
            ColorDark := StringToColor(Skin.ReadString('Buttons', 'Dark', '$00FFA851'));
            ColorFace := StringToColor(Skin.ReadString('Buttons', 'Face', '$00FF953E'));
            ColorFocusRect := StringToColor(Skin.ReadString('Buttons', 'FocusRect', '$00FFA953'));
            ColorGrad := StringToColor(Skin.ReadString('Buttons', 'Grad', '$00FFB66C'));
            ColorLight := StringToColor(Skin.ReadString('Buttons', 'Light', '$00FF953E'));
            ColorText := StringToColor(Skin.ReadString('Buttons', 'Text', '$00000000'));
            DownColorBorder := StringToColor(Skin.ReadString('Buttons', 'DownBorder', '$00B35900'));
            DownColorDark := StringToColor(Skin.ReadString('Buttons', 'DownDark', '$00FFD3A8'));
            DownColorFace := StringToColor(Skin.ReadString('Buttons', 'DownFace', '$00FFB366'));
            DownColorGrad := StringToColor(Skin.ReadString('Buttons', 'DownGrad', '$00FFCE9D'));
            DownColorLight := StringToColor(Skin.ReadString('Buttons', 'DownLight', '$00FF9E3E'));
            DownColorText := StringToColor(Skin.ReadString('Buttons', 'DownText', '$00000000'));
            OverColorBorder := StringToColor(Skin.ReadString('Buttons', 'OverBorder', 'clNavy'));
            OverColorDark := StringToColor(Skin.ReadString('Buttons', 'OverDark', '$00FF9E3E'));
            OverColorFace := StringToColor(Skin.ReadString('Buttons', 'OverFace', '$00FFB66C'));
            OverColorGrad := StringToColor(Skin.ReadString('Buttons', 'OverGrad', '$00FFA346'));
            OverColorLight := StringToColor(Skin.ReadString('Buttons', 'OverLight', '$00FFB66C'));
            OverColorText := StringToColor(Skin.ReadString('Buttons', 'OverText', '$00000000'));
            DisabledColorBorder := StringToColor(Skin.ReadString('Buttons', 'DisabledBorder', 'clGray'));
            DisabledColorDark := StringToColor(Skin.ReadString('Buttons', 'DisabledDark', '$00D2D2D2'));
            DisabledColorFace := StringToColor(Skin.ReadString('Buttons', 'DisabledFace', '$00EEEEEE'));
            DisabledColorGrad := StringToColor(Skin.ReadString('Buttons', 'DisabledGrad', 'clWhite'));
            DisabledColorLight := StringToColor(Skin.ReadString('Buttons', 'DisabledLight', 'clWhite'));
            DisabledColorText := StringToColor(Skin.ReadString('Buttons', 'DisabledText', 'clGray'));
          end;
        end else if frmMain.Components[i] is TXiTrackBar then begin
          // Trackbars
          with Components[i] as TXiTrackBar do begin
            ThumbBorderColor := StringToColor(Skin.ReadString('Trackbars', 'ThumbBorder', '$00C66300'));
            ThumbFaceColor := StringToColor(Skin.ReadString('Trackbars', 'ThumbFace', '$00FFD9B3'));
            ThumbGradColor := StringToColor(Skin.ReadString('Trackbars', 'ThumbGrad', '$00FF9224'));
            SlideBorderColor := StringToColor(Skin.ReadString('Trackbars', 'SlideBorder', '$00F47A00'));
            SlideFaceColor := StringToColor(Skin.ReadString('Trackbars', 'SlideFace', '$00FFBA75'));
            SlideGradColor := StringToColor(Skin.ReadString('Trackbars', 'SlideGrad', '$00FFE9D2'));
            OverThumbBorderColor := StringToColor(Skin.ReadString('Trackbars', 'OverThumbBorder', '$00B35900'));
            OverThumbFaceColor := StringToColor(Skin.ReadString('Trackbars', 'OverThumbFace', '$00FFCF9F'));
            OverThumbGradColor := StringToColor(Skin.ReadString('Trackbars', 'OverThumbGrad', '$00F97C00'));
            DownThumbBorderColor := StringToColor(Skin.ReadString('Trackbars', 'DownThumbBorder', '$00B35900'));
            DownThumbFaceColor := StringToColor(Skin.ReadString('Trackbars', 'DownThumbFace', '$00FF8C1A'));
            DownThumbGradColor := StringToColor(Skin.ReadString('Trackbars', 'DownThumbGrad', '$00FFBF80'));
            DisabledThumbBorderColor := StringToColor(Skin.ReadString('Trackbars', 'DisabledThumbBorder', '$00B5B5B5'));
            DisabledThumbFaceColor := StringToColor(Skin.ReadString('Trackbars', 'DisabledThumbFace', '$00EAEAEA'));
            DisabledThumbGradColor := StringToColor(Skin.ReadString('Trackbars', 'DisabledThumbGrad', '$00CFCFCF'));
            DisabledSlideBorderColor := StringToColor(Skin.ReadString('Trackbars', 'DisabledSlideBorder', '$00BEBEBE'));
            DisabledSlideFaceColor := StringToColor(Skin.ReadString('Trackbars', 'DisabledSlideFace', '$00D8D8D8'));
            DisabledSlideGradColor := StringToColor(Skin.ReadString('Trackbars', 'DisabledSlideGrad', '$00E8E8E8'));
            DisabledTickColor := StringToColor(Skin.ReadString('Trackbars', 'DisabledTick', 'clSilver'));
            TickColor := StringToColor(Skin.ReadString('Trackbars', 'Tick', '$00C88D2D'));
          end;
        end else if Components[i] is TShape then begin
          // Ränder
          if Copy((Components[i] as TShape).Name, 1, 3) = 'sLbthen begin
            // d. Playlist
            (Components[i] as TShape).Brush.Color := StringToColor(Skin.ReadString('Playlist', 'Border', '$00B99D7F'));
          end else begin
            // restliche
            (Components[i] as TShape).Brush.Color := StringToColor(Skin.ReadString('Misc', 'Border', '$00FF0301'));
          end;
        end else if Components[i] is TLabel then begin
          (Components[i] as TLabel).Font.Color := StringToColor(Skin.ReadString('Misc', 'Font', '$00000000'));
        end else if Components[i] is TRadioButton then begin
          (Components[i] as TRadioButton).Font.Color := StringToColor(Skin.ReadString('Misc', 'Font', '$00000000'));
        end;
      end;

    finally
      Skin.Free;
    end;

    tColors.Enabled := true;
  end else begin
    Showmessage('Skinfile not found!');
  end;
end;
Delphi-Quellcode:
procedure TfrmMain.tColorsTimer(Sender: TObject);
var
  hDesk : HWND;
  hdcDesktop : HDC;
  crefPixel, cPixel, aPixel, bPixel, z, y: COLORREF;
  p, cp, a, b: TPoint;
begin
  p.X := 15;
  p.Y := 149;

  hDesk := GetDesktopWindow;
  hdcDesktop := GetWindowDC(hDesk);

  crefPixel := GetPixel(hdcDesktop, p.x, p.y);
  eqTb1.BackColor := crefPixel;
  eqTb2.BackColor := crefPixel;
  eqTb3.BackColor := crefPixel;
  eqReverb.BackColor := crefPixel;
  cbEq.Color := crefPixel;

  cp.X := 7;
  cp.Y := 44;
  cPixel := GetPixel(hdcDesktop, p.x, p.y);
  c := cPixel;

  lTime.Color := c;

  lLauftext.Color := c;


  a.X := 5;
  a.Y := 412;
  aPixel := GetPixel(hdcDesktop, a.x, a.y);
  z := aPixel;

  lbList.Color := z;

  b.X := 7;
  b.Y := 304;
  bPixel := GetPixel(hdcDesktop, b.x, b.y);
  y := bPixel;

  rbSeq.Color := y;
  rbRandom.Color := y;
  rbLoop.Color := y;
  cbLbList.Color := y;

  Spectrum.BackColor := c;

  tColors.Enabled := False;
end;
Fabian
Eigentlich hat MS Windows ab Vista den Hang zur Selbstzerstörung abgewöhnt – mkinzler
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:43 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz