Fórum Imgem no listbox in portaTCP #532808
25/09/2015
0
vlw pesquisei sobre 'uThreads' e consegui achar uma
agora minha duvida é o segui-te:
tenho um listbox onde ele pega de de um arquivo INI: as malformações::
arquivo INI
já consegui um pouco do que eu queria que é quando clica no item do listbox a uThreads verificar se uma determinada por esta aberta se
estiver aberta uma imagem da cor verde fica visível se estiver fechada
a imagem fica vermelha,
o que eu quer agora é que em cada item do listbox apareça se ele esta online ou ofline com uma imagem tipo verde para online vermelha para ofline.
Já achei alguns code para coloca imagem em um listbox mas nenhum deu certo como eu quero . Vejo o fonte abaixo coloquei para download também:
[url=http://postimg.org/image/qaq7okdhd/][img]http://s16.postimg.org/qaq7okdhd/foto1.jpg[/img][/url]
[url]http://www.mediafire.com/download/rld8gll4581z4p5/Realm_List2015.rar[/url]
fonte
se alguém poder me ajuda agradeço
agora minha duvida é o segui-te:
tenho um listbox onde ele pega de de um arquivo INI: as malformações::
arquivo INI
[wow-brasil] realmlist=realm.wow-brasil.com [Eternalwow] realmlist=logon.eternal-wow.com [NoOnline] realmlist=noip [MeuIp] realmlist=localhost
já consegui um pouco do que eu queria que é quando clica no item do listbox a uThreads verificar se uma determinada por esta aberta se
estiver aberta uma imagem da cor verde fica visível se estiver fechada
a imagem fica vermelha,
o que eu quer agora é que em cada item do listbox apareça se ele esta online ou ofline com uma imagem tipo verde para online vermelha para ofline.
Já achei alguns code para coloca imagem em um listbox mas nenhum deu certo como eu quero . Vejo o fonte abaixo coloquei para download também:
[url=http://postimg.org/image/qaq7okdhd/][img]http://s16.postimg.org/qaq7okdhd/foto1.jpg[/img][/url]
[url]http://www.mediafire.com/download/rld8gll4581z4p5/Realm_List2015.rar[/url]
fonte
unit RealmListModificador;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.Buttons, Vcl.StdCtrls, IniFiles,
acPNG;
type
TRealmForm1 = class(TForm)
Image1: TImage;
SpeedButton1: TSpeedButton;
Lista_ListBox1: TListBox;
Label1: TLabel;
Sp_add: TSpeedButton;
Sp_del: TSpeedButton;
Sp_Edi: TSpeedButton;
SpeedButton2: TSpeedButton;
GroupBox1: TGroupBox;
Panel1: TPanel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Image_OfLine: TImage;
Image_Online: TImage;
Label6_Status: TLabel;
Label6_CheckStatus: TLabel;
Label_invisivel: TLabel;
Timer1cicero: TTimer;
SpeedButton3: TSpeedButton;
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure SpeedButton1Click(Sender: TObject);
procedure Sp_addClick(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure Lista_ListBox1Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
private
{ Private declarations }
public
TReadINIFile:TiniFile;
procedure TimeProcedure;
procedure LerE_GravaArqINI;
procedure status_do_SERVER(Sender: TObject);
{ Public declarations }
end;
var
RealmForm1: TRealmForm1;
implementation
uses Form_Adicionar, uThreads;
{$R *.dfm}
//-----------------------------------------------------\
procedure TRealmForm1.LerE_GravaArqINI;
var FileINIs : String; //\RealmListModificador.ini
begin
FileINIs:='RealmListModificador.ini';
If not FileExists(ExtractFilePath(Application.ExeName)+FileINIs) then begin
ShowMessage('Arquivo de Configuração '+FileINIs+' Não exite ou está conrrompido!')
end else
TReadINIFile:= TIniFile.Create(ExtractFilePath(Application.ExeName)+FileINIs);
end; //TReadINIFile.Free;
//-----------------------------------------------------\
procedure TRealmForm1.status_do_SERVER(Sender: TObject);
var K, porta: integer;
ip: string;
begin
porta:= (3724);
for K:= 0 to Lista_ListBox1.Items.Count -1 do begin
if Lista_ListBox1.Selected[K] then begin
LerE_GravaArqINI;
ip:= TReadINIFile.ReadString(Lista_ListBox1.Items[K], 'realmlist','');
begin
TPortScanner.Create(ip,IntToStr(porta),Label_invisivel);
Lista_ListBox1.Repaint;
TReadINIFile.Free;
if Label_invisivel.Caption = IntToStr(porta) then
Label6_CheckStatus.Caption := 'Online'
else
Label6_CheckStatus.Caption:= 'Ofline';
if Label_invisivel.Caption = IntToStr(porta) then begin
Image_Online.Visible:= true ;
Image_OfLine.Visible:= false;
Label6_CheckStatus.Font.Color:= clGreen;
end;
if not (Label_invisivel.Caption = IntToStr(porta)) then begin
Image_Online.Visible:= false;
Image_OfLine.Visible:= true;
Label6_CheckStatus.Font.Color:= clGray;
end;
Label_invisivel.Caption:= '';
end;
break;
end;
end;
end;
procedure TRealmForm1.TimeProcedure;
begin
Timer1cicero.Enabled := TRUE;
Timer1cicero.Interval := 1000;
Timer1cicero.Ontimer := status_do_SERVER;
end;
procedure TRealmForm1.Lista_ListBox1Click(Sender: TObject);
var
k: integer;
begin
for k:= 0 to Lista_ListBox1.Count -1 do
if (Lista_ListBox1.Selected[k] = true) then begin
LerE_GravaArqINI; // Abrir arquivo .INI
Label4.Caption:= TReadINIFile.ReadString(Lista_ListBox1.Items.Strings[Lista_ListBox1.ItemIndex],'realmlist','') ;
Label5.Caption:= TReadINIFile.ReadString('Config','LocalWow','');
//sMemo1.Lines.Add(TReadINIFile.ReadString(Lista_ListBox1.Items.Strings[Lista_ListBox1.ItemIndex], 'realmlist', ''));
//sMemo1.Lines.Add('');
//sMemo1.Lines.Add(TReadINIFile.ReadString('Config', 'LocalWow', ''));
//RealmForm1.sEdit1.Text:= (TReadINIFile.ReadString(Lista_ListBox1.Items.Strings[Lista_ListBox1.ItemIndex], 'WowLocal', ''));
break;
TReadINIFile.Free; // Frechar arquivo .INI
end;
TimeProcedure;
end;
procedure TRealmForm1.FormCreate(Sender: TObject);
begin
if not FileExists(ExtractFilePath(Application.ExeName)+'RealmListModificador.ini') then begin
TReadINIFile:= TIniFile.Create(ExtractFilePath(Application.ExeName)+ '\RealmListModificador.ini');
TReadINIFile.WriteString('Config', 'LocalWow', 'wow.exe');
TReadINIFile.WriteString('Config', 'DATA', DateToStr(now));
TReadINIFile.Free;
end;
SpeedButton2.Click;
end;
procedure TRealmForm1.FormShow(Sender: TObject);
var
i : integer;
begin
LerE_GravaArqINI;
TReadINIFile.ReadSections(Lista_ListBox1.Items);
begin
for i:=0 to Lista_ListBox1.Items.Count -1 do begin
if (Lista_ListBox1.Items.Strings[i]) = 'Config' then begin
Lista_ListBox1.Items.Delete(i);
break;
begin
TReadINIFile.Free;
end;
end;
end;
end;
end;
procedure TRealmForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
const
SC_DRAGMOVE = $F012;
begin
if Button = mbLeft then
begin
ReleaseCapture;
Perform(WM_SYSCOMMAND, SC_DRAGMOVE, 0);
end;
end;
procedure TRealmForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
const
SC_DRAGMOVE = $F012;
begin
if Button = mbLeft then
begin
ReleaseCapture;
Perform(WM_SYSCOMMAND, SC_DRAGMOVE, 0);
end;
end;
procedure TRealmForm1.SpeedButton1Click(Sender: TObject);
begin
RealmForm1.Close;
Application.Terminate;
end;
procedure TRealmForm1.SpeedButton2Click(Sender: TObject);
const
RollUpHt = 369;
DropDownHt = 428;
begin
with TControl(Sender).Parent do
if (Height < RollUpHt + 5) then
begin
while Height < DropDownHt do begin
Height := Height + 6; //Refresh; //Sleep(01);
end;
end else
while Height > RollUpHt do begin
Height := Height - 6;
//Refresh; Sleep(01);
end;
end;
procedure TRealmForm1.SpeedButton3Click(Sender: TObject);
begin
status_do_SERVER(Sender);
end;
procedure TRealmForm1.Sp_addClick(Sender: TObject);
begin
Add_Form2.ShowModal;
end;
end.
se alguém poder me ajuda agradeço
Cgm2k7 2013
Curtir tópico
+ 0
Responder
Posts
26/09/2015
Cgm2k7 2013
help-me
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)