Coming soon, please advise! First, ask a control question about VCL component development and application.
Http://www.delphi2007.net/DelphiVCL/html/delphi_20061224131514154.html
Sendmessage (panel2.handle, lb_sethorizontalextent, panel2.width + 30, 0 );
In this way, you can add a horizontal scroll bar to The ListBox, but it won't work if you change it to a panel. Why is it possible in the forum? But I just cannot implement it. Why? I am using Delphi7, thank you.
By the way, do you have any suitable books to learn about VCL control development?
Tpanel should have no handler to process the lb_sethorizontalextent message. This message is specifically for ListBox. This is what prefix LB _ means. But sendmessage (panel2.handle, lb_sethorizontalextent, panel2.width + 30, 0 );
You can still implement panel2.width + 30.
Tformdemo = Class (tform)
Panel: tpanel;
Buttondemo: tbutton;
Procedure formcreate (Sender: tobject );
Procedure buttondemoclick (Sender: tobject );
Private
Oldpanelwndproc: twndmethod;
Procedure newpanelwindowproc (VAR message: tmessage );
Public
{Public declarations}
End;
VaR
Formdemo: tformdemo;
Implementation
{$ R *. DFM}
Procedure tformdemo. formcreate (Sender: tobject );
Begin
Oldpanelwndproc: = panel. windowproc;
Panel. windowproc: = newpanelwindowproc;
End;
Procedure tformdemo. newpanelwindowproc (VAR message: tmessage );
Begin
If message. MSG = lb_sethorizontalextent then
Panel. Width: = message. wparam;
Oldpanelwndproc (Message );
End;
Procedure tformdemo. buttondemoclick (Sender: tobject );
Begin
Sendmessage (panel. Handle, lb_sethorizontalextent, panel. Width + 30, 0 );
End;
However, implementation has nothing to do with the message lb_sethorizontalextent. There is no difference between sending this message and sending other messages.
Thank you for your answers from sanmaotuo (Lao Feng). It has helped me a lot.
Do you want to distribute the problematic points like they are in the monopoly? I don't know how to do it :(