Message response of ListView column width Change in delphi

Source: Internet
Author: User
Unit Unit1; Interface uses Windows, Messages, sysutils, variants, Classes, Graphics, Controls, Forms, Dialogs, Stdctrls, comctr 
 
Ls,commctrl; 
 Type phd_notify=^hd_notify; 
  TForm1 = Class (Tform) Listview1:tlistview; 
  Button1:tbutton; 
  Procedure Formdestroy (Sender:tobject); 
 Procedure Button1Click (Sender:tobject); 
  Private {private declarations} Oldproc:twndmethod; 
 Procedure Newproc (var message:tmessage); 
 
Public {public declarations} end; 
 
var Form1:tform1; 
Implementation {$R *.DFM} procedure Tform1.newproc (Var message:tmessage); 
var hn:phd_notify; Begin IF message. 
  Msg=wm_notify then BEGIN Hn:=phd_notify (Message.lparam); if (hn^.   Hdr.code=hdn_begintracka) or (HN^.HDR.CODE=HDN_BEGINTRACKW) THEN BEGIN//Message.result: = 1; 
   Join this line so that the column header can not change the width//If you want to handle after the drag is done, you can determine whether hn->hdr.code//equals Hdn_endtracka or HDN_ENDTRACKW, and then do the processing. 
  ShowMessage (' hehe '); 
 End Else Listview1.dispatch (message); End 
End 
Procedure Tform1.formdestroy (Sender:tobject); 
Begin Listview1.windowproc:=oldproc; 
 
End 
Procedure Tform1.button1click (Sender:tobject); 
 Begin oldproc:= Listview1.windowproc; 
Listview1.windowproc:= Newproc; 
 
End End.

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.