Coming soon, please advise! First ask a control question

Source: Internet
Author: User
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 :(

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.