aca les dejo el ejemplo de la aplicacion..se que no esta terminada como tiene que ser , pero es un avance en este tema..
Código Delphi
[-]
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
btnCreatePnl: TButton;
btnDelPnl: TButton;
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
ScrollBox1: TScrollBox;
procedure btnCreatePnlClick(Sender: TObject);
procedure btnDelPnlClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
procedure MouseWheel(var Msg: tagMSG; var Handled: Boolean);
procedure CheckBoxClick(Sender: TObject);
public
end;
var
Form1: TForm1;
implementation {$R *.dfm}
var
Pnl : TPanel;
numberpanel: Integer = 1;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnMessage:= MouseWheel;
end;
procedure TForm1.MouseWheel(var Msg: tagMSG; var Handled: Boolean);
var
FControl: TWinControl;
i: SmallInt;
begin
FControl:= FindVCLWindow(Mouse.CursorPos);
i:= HiWord(Msg.wParam);
if Assigned(FControl) and (Msg.message = WM_MOUSEWHEEL) then begin
try
if (FControl.Parent is TScrollBox) then begin
if i > 0 then begin
with TScrollingWinControl(ScrollBox1).VertScrollBar do begin
if ScrollBox1.VertScrollBar.Range > 0 then begin
Position:= Position - Increment ;
Edit1.Text:=IntToStr(Position);
end;
end;
end else begin
with TScrollingWinControl(ScrollBox1).VertScrollBar do begin
if ScrollBox1.VertScrollBar.Range > 0 then begin
Position:= Position + Increment;
Edit1.Text:=IntToStr(Position);
end;
end;
end;
end;
except
next;
end;
end;
end;
procedure TForm1.CheckBoxClick(Sender: TObject);
begin
if TCheckBox(Sender).Checked then
TPanel(TCheckBox(Sender).Parent).Color := clRed
else
TPanel(TCheckBox(Sender).Parent).Color := clBtnFace
end;
procedure TForm1.btnCreatePnlClick(Sender: TObject);
begin
Pnl := TPanel.Create(nil);
Pnl.Name := 'PnlUser' + IntToStr(numberpanel);
Pnl.Caption := '';
Pnl.Align := alTop;
Pnl.Height := 60;
Pnl.Parent := ScrollBox1;
Pnl.ParentBackground := False;
with TCheckBox.Create(nil) do
begin
OnClick := CheckBoxClick;
Name := 'CheckMail'+ IntToStr(numberpanel);
Caption := '';
left := 16;
top := 21;
Width := 17;
Parent := Pnl;
end;
end;
procedure TForm1.btnDelPnlClick(Sender: TObject);
var
i,j: Integer;
begin
for i:= ScrollBox1.ControlCount - 1 downto 0 do
if ScrollBox1.Controls[i] is TPanel then
for j:= 0 to TPanel(ScrollBox1.Controls[i]).ControlCount-1 do
if (TPanel(ScrollBox1.Controls[i]).Controls[j] is TCheckBox) and
(TCheckBox(TPanel(ScrollBox1.Controls[i]).Controls[j]).Checked) then
ScrollBox1.Controls[i].Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
with TScrollingWinControl(ScrollBox1).VertScrollBar do begin
if ScrollBox1.VertScrollBar.Range > 0 then begin
Position:= Position - Increment ;
Edit1.Text:=IntToStr(Position);
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
with TScrollingWinControl(ScrollBox1).VertScrollBar do begin
if ScrollBox1.VertScrollBar.Range > 0 then begin
Position:= Position + Increment ;
Edit1.Text:=IntToStr(Position);
end;
end;
end;
end.
aca les dejo la url del ejemplo en delphi