SQLwill
asked on
Adding to a component's canvas
I need a good abstarct way, hopefully off of TControl or TWinControl methods or props, that will allow me to make additions to the canvas of many components of unknown type at run time. EX: Adding a small red circle to the upper left corner of a textbox that will remain when the form is minimized and restored. If at all possible, I'd like to do this without redirecting WndProcs... I have, in fact, gotten to draw on the canvas of a textbox using a Canvas i have created and set the Handle of to a GetDC call on the control, but i can't get the image i draw on the control to persist.... all ideas are worth a shot on this one!
ASKER
This won't work in the manner in which I intend to use it. I need a *abstract* method with which to do my assigned task whereupon i do not choose or mess with any components at design time other than to add them to a "WatchedComponents" StringList.
I think you need something like :
function NewWindowProc (wnd:Hwnd; Msg:UINT; Wparam:wparam ;
lparam:lparam): longint; stdcall;
begin
if Msg=WM_PAINT then begin
// Do your painting
end;
Result := CallWindowProc (OldProc,Wnd,Msg,wParam,lP aram);
end;
procedure TForm1.Button1Click(Sender : TObject);
begin
OldProc :=Pointer(SetWindowLong( Edit1.Handle,gwl_wndproc,l ongint(@Ne wWindowPro c)));
end;
Greetings,
MvZ
function NewWindowProc (wnd:Hwnd; Msg:UINT; Wparam:wparam ;
lparam:lparam): longint; stdcall;
begin
if Msg=WM_PAINT then begin
// Do your painting
end;
Result := CallWindowProc (OldProc,Wnd,Msg,wParam,lP
end;
procedure TForm1.Button1Click(Sender
begin
OldProc :=Pointer(SetWindowLong( Edit1.Handle,gwl_wndproc,l
end;
Greetings,
MvZ
ASKER
This looks like what i might have to do. I'm trying, however, to do my best to avoid moving around WndProcs, since doing so gets extremely ugly when more than one WndProc stealing component is used. =]
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
JDB