Microsoft
Software
Hardware
Network
Question : Button Combobox
Hello,
Since Windows Vista, for example, the "Address bar" is like a Combobox where you can click in the path example
C:\Windows\System32\
You can click in Windows or C:\, not necessarily click in the backward button
To see what i'm talking about, open in Windows 7 the control panel and navigate in categories... in the address bar, you can return or choose another path by clicking in the buttons inside the combobox!
Somebody know some component that simulate the same? I already saw, but don't remember the name :/
Regards,
Carlos
Answer : Button Combobox
On versions of Windows later then Win95, you can subclass an edit control to
intercept the WM_CTLCOLOREDIT message (for TEdit, it would be
CN_CTLCOLOREDIT instead) and return a brush that is created from a bitmap.
You can then draw a bitmap of whatever type of progress display you want.
Here is a simple example:
TForm1 = class(TForm)
published
Edit1: TEdit;
Timer1: TTimer;
procedure FormCreate(Sender: TObject)
procedure Timer1Timer(Sender: TObject);
private
OldWndProc: TWndMethod;
procedure EditWndProc(var Message: TMessage);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
OldWndProc := Edit1.WindowProc;
Edit1.WindowProc := EditWndProc;
end;
procedure TForm1.EditWndProc(var Message: TMessage);
var
bmp: TBitmap;
r: TRect;
oldRight: Integer;
begin
if Message.Msg = CN_CTLCOLOREDIT then
begin
Windows.SetTextColor(Messa
ge.WParam,
ColorToRGB(Edit1.Font.Colo
r));
Window.SetBkMode(Message.W
Param, TRANSPARENT);
bmp := TBitmap.Create;
try
r := Edit1.ClientRect;
bmp.Width := (r.Right - r.Left);
bmp.Height := (r.Bottom - r.Top);
if Edit1.Tag > 0 then
begin
oldRight := r.Right;
r.Right := r.Left + ((r.Right - r.Left) *
(Extended(Edit1->Tag) / 100);
bmp.Canvas.Brush.Color := clAqua;
bmp.Canvas.FillRect(r);
r.Left := r.Right;
r.Right := oldRight;
end;
bmp.Canvas.Brush.Color := Edit1.Color;
bmp.Canvas.FillRect(r);
Message.Result := Windows.CreatePatternBrush
(bmp.Handl
e);
finally
bmp.Free;
end;
Exit;
end;
OldWndProc(Message);
end;
procedure TForm1.Timer1Timer(Sender:
TObject);
begin
// I set Timer1.Interval to 50ms...
if Edit1.Tag >= 100 then
Edit1.Tag := 0
else
Edit1.Tag := Edit1.Tag + 1;
Edit1.Invalidate;
end;
Random Solutions
Oracle 10.2.0.4 upgrade
PHP: adding a unique code to JPG image during download (embedded in the file)
Add comments to PDF
BES Activation issue
Script to enable folder auditing
object required error
Replacing a server in an existing domain other than the main Domain Controller
SharePoint - single user can't access Rich Text Editor
sql server tables
how to transfer apps from my iphone to my itunes library