Einzelnen Beitrag anzeigen

AlexII

Registriert seit: 28. Apr 2008
1.717 Beiträge
 
FreePascal / Lazarus
 
#9

Re: FormShow mit CoolTrayIcon dauert zu lange

  Alt 2. Jan 2010, 16:59
Ok

Und bei mir sieht das so aus, wenn jemand lust hat guck mal durch, vielleicht gibt's da was zu verbessern.

Delphi-Quellcode:
procedure TForm1.FormShow(Sender: TObject);
var ComboIndex: Integer;
    Ini : TIniFile;
    UserAppDataDir, ProgPath, Headline: String;
begin
UserAppDataDir:=GetSpecialFolder(CSIDL_LOCAL_APPDATA);
ProgPath:=ExtractFilePath(ParamStr(0));

if FileExists(UserAppDataDir + AppDataRootDir + AppDataProjectDir + '\Config-t.ini') then
begin
Ini := TIniFile.Create(UserAppDataDir + AppDataRootDir + AppDataProjectDir + '\Config-t.ini');
  try
    Headline := Ini.ReadString('Default', 'Headline', '');
    ComboBox1.ItemIndex := Ini.ReadInteger('Default', 'Channel', 1);
    TrackBar1.Position := Ini.ReadInteger('Default', 'Volume', 90);
    Form5.cbDirectConnection.Checked := Ini.ReadBool('Default', 'Proxy', True);
    Form5.ed_ProxyServer.Text := Ini.ReadString('Default', 'ProxyIP', '');
    Form1.ClientWidth := Ini.ReadInteger('Default', 'Form', 570);
    ShowDate1.Checked := Ini.ReadBool('Default', 'ShowDate', False);
    ShowTime1.Checked := Ini.ReadBool('Default', 'ShowTime', False);
    ShowPlayTime1.Checked := Ini.ReadBool('Default', 'ShowPlayTime', False);
    Form3.RadioButton1.Checked := Ini.ReadBool('Default', 'ItemPositionTop', False);
    Form3.RadioButton2.Checked := Ini.ReadBool('Default', 'ItemPositionBelow', True);
    Language := Ini.ReadString('Default', 'Language', '');
    ListBox1.TopIndex := Ini.ReadInteger('Default', 'Channelposition', 0);
    Background := Ini.ReadString('Default', 'Background', '');
    Form5.CheckBox2.Checked := Ini.ReadBool('Default', 'Traybarwhenmin', False);
    Form5.LabeledEdit1.Text := Ini.ReadString('Default', 'Headline', '');
  finally
    Ini.Free;
end;

if Form5.CheckBox2.Checked=True then
begin
CoolTrayIcon1.Enabled:=True;
CoolTrayIcon1.MinimizeToTray:=True;
end;

ComboIndex:=ComboBox1.ItemIndex;

if ShowDate1.Checked=True then
begin
Label10.Visible:=True;
Label10.Caption:=FormatDateTime('dddd, d. mmmm yyyy', date);
end else Label10.Visible:=False;

if ShowTime1.Checked=True then
begin
Label11.Visible:=True;
Label11.Caption:=FormatDateTime('tt', time);
end else Label11.Visible:=False;
end;

if ShowPlayTime1.Checked=True then
begin
Image28.Visible:=True;
Label6.Visible:=True;
end else
    begin
    Image28.Visible:=False;
    Label6.Visible:=False;
    end;
    
if Form1.ClientWidth=407 then
begin
Image11.Visible := False;
Image10.Visible := True;

Label10.Caption:='Label10';
Label10.Left:=348; //344
Label10.Caption:=FormatDateTime('dddd, d. mmmm yyyy', date);

Label11.Caption:='Label11';
Label11.Left:=361; //360
Label11.Caption:=FormatDateTime('tt', time);
end else
    begin
    Image11.Visible := True;
    Image10.Visible := False;

    Label10.Caption:='Label10';
    Label10.Left:=511; //507
    Label10.Caption:=FormatDateTime('dddd, d. mmmm yyyy', date);

    Label11.Caption:='Label11';
    Label11.Left:=524; //523
    Label11.Caption:=FormatDateTime('tt', time);
    end;

case ComboBox1.Itemindex of
3: Image9.Visible := False;
7: Image9.Visible := False;
21: Image9.Visible := False;
22: Image9.Visible := False;
24: Image9.Visible := False;
25: Image9.Visible := False;
end;

vol := TrackBar1.Position;
cbDirectConnectionClick(Sender);

if Language='Englishthen
begin
//Form1
AutoUpgrader1.InfoFileURL:='http://xxx/update/autoupgrade_en.cgi';
Font.Charset := DEFAULT_CHARSET;
Label2.Font.Charset := DEFAULT_CHARSET;
Label10.Font.Charset := DEFAULT_CHARSET;
GroupBox1.Font.Charset := DEFAULT_CHARSET;
Label9.Font.Charset := DEFAULT_CHARSET;
ComboBox1.Font.Charset := DEFAULT_CHARSET;

GroupBox1.Font.Charset := DEFAULT_CHARSET;

GroupBox2.Font.Charset := DEFAULT_CHARSET;
Label3.Font.Charset := DEFAULT_CHARSET;
Label4.Font.Charset := DEFAULT_CHARSET; //?

UseLanguage('EN');
RetranslateComponent(Self);
English1.Enabled:=False;
German1.Enabled:=True;
Russian1.Enabled:=True;

if ComboBox1.ItemIndex=-1 then ComboBox1.ItemIndex:=ComboIndex;
end else if Language='Germanthen
         begin
         //Form1
         AutoUpgrader1.InfoFileURL:='http://xxx/update/autoupgrade_en.cgi';
         Font.Charset := DEFAULT_CHARSET;
         Label2.Font.Charset := DEFAULT_CHARSET;
         Label10.Font.Charset := DEFAULT_CHARSET;
         GroupBox1.Font.Charset := DEFAULT_CHARSET;
         Label9.Font.Charset := DEFAULT_CHARSET;
         ComboBox1.Font.Charset := DEFAULT_CHARSET;

         GroupBox1.Font.Charset := DEFAULT_CHARSET;

         GroupBox2.Font.Charset := DEFAULT_CHARSET;
         Label3.Font.Charset := DEFAULT_CHARSET;
         Label4.Font.Charset := DEFAULT_CHARSET; //?

         UseLanguage('de_DE');
         ReTranslateComponent(Self);
         English1.Enabled:=True;
         German1.Enabled:=False;
         Russian1.Enabled:=True;

         if ComboBox1.ItemIndex=-1 then ComboBox1.ItemIndex:=ComboIndex;
         end else if Language='Russianthen
                  begin
                  //Form1
                  AutoUpgrader1.InfoFileURL:='http://xxx/update/autoupgrade_ru.cgi';
                  Font.Charset := RUSSIAN_CHARSET;
                  Label2.Font.Charset := RUSSIAN_CHARSET;
                  Label10.Font.Charset := RUSSIAN_CHARSET;
                  GroupBox1.Font.Charset := RUSSIAN_CHARSET;
                  Label9.Font.Charset := RUSSIAN_CHARSET;
                  ComboBox1.Font.Charset := RUSSIAN_CHARSET;

                  GroupBox1.Font.Charset := RUSSIAN_CHARSET;

                  GroupBox2.Font.Charset := RUSSIAN_CHARSET;
                  Label3.Font.Charset := RUSSIAN_CHARSET;
                  Label4.Font.Charset := RUSSIAN_CHARSET; //?

                  UseLanguage('ru_RU');
                  ReTranslateComponent(Self);
                  English1.Enabled:=True;
                  German1.Enabled:=True;
                  Russian1.Enabled:=False;

                  if ComboBox1.ItemIndex=-1 then ComboBox1.ItemIndex:=ComboIndex;
                  end else
                      begin

                      if (GetCurrentLanguage()='EN') then
                      begin
                      //Form1
                      AutoUpgrader1.InfoFileURL:='http://xxx/update/autoupgrade_en.cgi';
                      Font.Charset := DEFAULT_CHARSET;
                      Label2.Font.Charset := DEFAULT_CHARSET;
                      Label10.Font.Charset := DEFAULT_CHARSET;
                      GroupBox1.Font.Charset := DEFAULT_CHARSET;
                      Label9.Font.Charset := DEFAULT_CHARSET;
                      ComboBox1.Font.Charset := DEFAULT_CHARSET;

                      GroupBox1.Font.Charset := DEFAULT_CHARSET;

                      GroupBox2.Font.Charset := DEFAULT_CHARSET;
                      Label3.Font.Charset := DEFAULT_CHARSET;
                      Label4.Font.Charset := DEFAULT_CHARSET; //?

                      UseLanguage('EN');
                      RetranslateComponent(Self);
                      English1.Enabled:=False;
                      German1.Enabled:=True;
                      Russian1.Enabled:=True;

                      if ComboBox1.ItemIndex=-1 then ComboBox1.ItemIndex:=1;
                      Language:='English';
                      end else if (GetCurrentLanguage()='de_DE') then
                               begin
                               //Form1
                               AutoUpgrader1.InfoFileURL:='http://xxx/update/autoupgrade_de.cgi';
                               Font.Charset := DEFAULT_CHARSET;
                               Label2.Font.Charset := DEFAULT_CHARSET;
                               Label10.Font.Charset := DEFAULT_CHARSET;
                               GroupBox1.Font.Charset := DEFAULT_CHARSET;
                               Label9.Font.Charset := DEFAULT_CHARSET;
                               ComboBox1.Font.Charset := DEFAULT_CHARSET;

                               GroupBox1.Font.Charset := DEFAULT_CHARSET;

                               GroupBox2.Font.Charset := DEFAULT_CHARSET;
                               Label3.Font.Charset := DEFAULT_CHARSET;
                               Label4.Font.Charset := DEFAULT_CHARSET; //?

                               UseLanguage('de_DE');
                               ReTranslateComponent(Self);
                               English1.Enabled:=True;
                               German1.Enabled:=False;
                               Russian1.Enabled:=True;

                               if ComboBox1.ItemIndex=-1 then ComboBox1.ItemIndex:=1;
                               Language:='German';
                               end else if (GetCurrentLanguage()='ru_RU') then
                                        begin
                                        //Form1
                                        AutoUpgrader1.InfoFileURL:='http://xxx/update/autoupgrade_ru.cgi';
                                        Font.Charset := RUSSIAN_CHARSET;
                                        Label2.Font.Charset := RUSSIAN_CHARSET;
                                        Label10.Font.Charset := RUSSIAN_CHARSET;
                                        GroupBox1.Font.Charset := RUSSIAN_CHARSET;
                                        Label9.Font.Charset := RUSSIAN_CHARSET;
                                        ComboBox1.Font.Charset := RUSSIAN_CHARSET;

                                        GroupBox1.Font.Charset := RUSSIAN_CHARSET;

                                        GroupBox2.Font.Charset := RUSSIAN_CHARSET;
                                        Label3.Font.Charset := RUSSIAN_CHARSET;
                                        Label4.Font.Charset := RUSSIAN_CHARSET; //?

                                        UseLanguage('ru_RU');
                                        ReTranslateComponent(Self);
                                        English1.Enabled:=True;
                                        German1.Enabled:=True;
                                        Russian1.Enabled:=False;

                                        if ComboBox1.ItemIndex=-1 then ComboBox1.ItemIndex:=1;
                                        Language:='Russian';
                                        end;
                      end;

if (Background='Blue') or (Background='') then
begin
Image3.Picture:=Image23.Picture;
Blue1.Checked:=True;
Vista1.Checked:=False;
Red1.Checked:=False;
Black1.Checked:=False;
Win71.Checked:=False;
Light1.Checked:=False;
Blue1.Enabled:=False;
Vista1.Enabled:=True;
Red1.Enabled:=True;
Black1.Enabled:=True;
Win71.Enabled:=True;
Light1.Enabled:=True;
Background:='Blue';
end;
if Background='Vistathen
begin
Image3.Picture:=Image22.Picture;
Blue1.Checked:=False;
Vista1.Checked:=True;
Red1.Checked:=False;
Black1.Checked:=False;
Win71.Checked:=False;
Light1.Checked:=False;
Blue1.Enabled:=True;
Vista1.Enabled:=False;
Red1.Enabled:=True;
Black1.Enabled:=True;
Win71.Enabled:=True;
Light1.Enabled:=True;
end;
if Background='Redthen
begin
Image3.Picture:=Image24.Picture;
Blue1.Checked:=False;
Vista1.Checked:=False;
Red1.Checked:=True;
Black1.Checked:=False;
Win71.Checked:=False;
Light1.Checked:=False;
Blue1.Enabled:=True;
Vista1.Enabled:=True;
Red1.Enabled:=False;
Black1.Enabled:=True;
Win71.Enabled:=True;
Light1.Enabled:=True;
end;
if Background='Blackthen
begin
Image3.Picture:=Image25.Picture;
Blue1.Checked:=False;
Vista1.Checked:=False;
Red1.Checked:=False;
Black1.Checked:=True;
Win71.Checked:=False;
Light1.Checked:=False;
Blue1.Enabled:=True;
Vista1.Enabled:=True;
Red1.Enabled:=True;
Black1.Enabled:=False;
Win71.Enabled:=True;
Light1.Enabled:=True;
end;
if Background='Win7then
begin
Image3.Picture:=Image26.Picture;
Blue1.Checked:=False;
Vista1.Checked:=False;
Red1.Checked:=False;
Black1.Checked:=False;
Win71.Checked:=True;
Light1.Checked:=False;
Blue1.Enabled:=True;
Vista1.Enabled:=True;
Red1.Enabled:=True;
Black1.Enabled:=True;
Win71.Enabled:=False;
Light1.Enabled:=True;
end;
if Background='Lightthen
begin
Image3.Picture:=Image27.Picture;
Blue1.Checked:=False;
Vista1.Checked:=False;
Red1.Checked:=False;
Black1.Checked:=False;
Win71.Checked:=False;
Light1.Checked:=True;
Blue1.Enabled:=True;
Vista1.Enabled:=True;
Red1.Enabled:=True;
Black1.Enabled:=True;
Win71.Enabled:=True;
Light1.Enabled:=False;
end;

if Headline<>'then
Label2.Caption:=Headline;

end;
Bin Hobbyprogrammierer! Meine Fragen beziehen sich meistens auf Lazarus!
  Mit Zitat antworten Zitat