|
同步两个TRichEdit的滚动条:4SCLinux联盟 4SCLinux联盟
/...4SCLinux联盟 private4SCLinux联盟 PRichEdWndProc, POldWndProc: Pointer;4SCLinux联盟 procedure RichEdWndProc(var Msg: TMessage);4SCLinux联盟 //...4SCLinux联盟 4SCLinux联盟 4SCLinux联盟 procedure TForm1.FormCreate(Sender: TObject);4SCLinux联盟 begin4SCLinux联盟 PRichEdWndProc := MakeObjectInstance(RichEdWndProc);4SCLinux联盟 POldWndProc := Pointer(SetWindowLong(RichEdit1.Handle, GWL_WNDPROC,4SCLinux联盟 Integer(PRichEdWndProc)));4SCLinux联盟 end;4SCLinux联盟 4SCLinux联盟 procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);4SCLinux联盟 begin4SCLinux联盟 if Assigned(PRichEdWndProc) then4SCLinux联盟 begin4SCLinux联盟 SetWindowLong(RichEdit1.Handle, GWL_WNDPROC, Integer(POldWndProc));4SCLinux联盟 FreeObjectInstance(PRichEdWndProc);4SCLinux联盟 end;4SCLinux联盟 end;4SCLinux联盟 4SCLinux联盟 4SCLinux联盟 procedure TForm1.RichEdWndProc(var Msg: TMessage);4SCLinux联盟 begin4SCLinux联盟 Msg.Result := CallWindowProc(POldWndProc, RichEdit1.Handle, Msg.Msg,4SCLinux联盟 Msg.wParam, Msg.lParam);4SCLinux联盟 4SCLinux联盟 if (Msg.Msg = WM_VSCROLL) and (LOWORD(Msg.wParam) = SB_THUMBTRACK) then4SCLinux联盟 begin4SCLinux联盟 Label1.Caption := 'Pos is ' + IntToStr(HIWORD(Msg.wParam));4SCLinux联盟 RichEdit2.Perform(Msg.Msg, Msg.wParam, Msg.lParam);4SCLinux联盟 SetScrollPos(RichEdit2.Handle, SB_VERT, HIWORD(Msg.wParam), True);4SCLinux联盟 end;4SCLinux联盟 end;[/codde]4SCLinux联盟
|
Linux联盟收集整理 ,转贴请标明原始链接,如有任何疑问欢迎来本站Linux论坛讨论 |
|