Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 37 additions & 37 deletions Vcl.Memo.LineNumbers.pas
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
//########################################################################//
// //
// ��r�s��ئ�s���Ҳ� //
// 文字編輯框行編號模組 //
// //
//########################################################################//
// �����GVCL����\��[�j //
// �s�g�GWei-Lun Huang //
// ���v�GCopyright (c) 2020 Wei-Lun Huang //
// �����Gø�s�r���s���C //
// 類型:VCL元件功能加強 //
// 編寫:Wei-Lun Huang //
// 版權:Copyright (c) 2020 Wei-Lun Huang //
// 說明:繪製字串行編號。 //
// //
// �@�ΡG //
// 作用: //
// 1. TLineNumber //
// �b���p�������ø�s�r�ꪺ��s�� //
// * �`�N�G���񪫥�ɻݭn�`�N�{���y�{�A�H���إߥ����񬰭�h�C //
// �аѾ\ Bind �P Unbind �\��AWindowProc �л\�C //
// 在關聯的控制項中繪製字串的行編號 //
// * 注意:釋放物件時需要注意程式流程,以先建立後釋放為原則。 //
// 請參閱 Bind Unbind 功能,WindowProc 覆蓋。 //
// //
// ��L�G //
// 其他: //
// //
// �̫��ܧ����G2020�~12��12�� //
// 最後變更日期:2020年12月12日 //
// //
//########################################################################//

//
// Memo box line number module.
//
// Type: VCL Component Enhancements.
// Author: 2020 Wei-Lun Huang
// Description: Draw the line numbers of the text.
//
// Features:
// 1. TLineNumber
// Draw the line numbers of the string in the associated control.
// * Note: Need check program flow when releasing objects.
// principle is first in and first out for objects, please.
// See the Bind and Unbind function, about WindowProc override.
//
// Memo box line number module.
//
// Type: VCL Component Enhancements.
// Author: 2020 Wei-Lun Huang
// Description: Draw the line numbers of the text.
//
// Features:
// 1. TLineNumber
// Draw the line numbers of the string in the associated control.
// * Note: Need check program flow when releasing objects.
// principle is first in and last out for objects, please.
// See the Bind and Unbind function, about WindowProc override.
//
//
// Last modified date: Dec 12, 2020.

Expand Down Expand Up @@ -77,11 +77,11 @@ TLineNumbers = class(TComponent)
procedure SetBackgroundColor(Color: TColor);
protected
//
// �� Memo �� ø�s�ؼб�� ����m�Τj�p�o���ܤƮ����I�s�C
// Memo 或 繪製目標控制項 的位置或大小發生變化時應呼叫。
// When Memo or target drawing control item size changes, call this.
procedure SyncCanvas;

// �� Memo �r���ܧ������I�s�A�H�O��ø�s��r�ɪ��j�p��m�C
// Memo 字體變更後時應呼叫,以保持繪製文字時的大小位置。
// When the Memo font is changed to keep the size and position when drawing text.
procedure SyncFont; overload;
procedure SyncFont(Color: TColor); overload;
Expand All @@ -91,38 +91,38 @@ TLineNumbers = class(TComponent)
procedure ControlProc(var Message: TMessage);

public
// �����л\ Memo �P ø�s�ؼб�� �� WindowProc �ɤ���ij�]�w�D�餸�� AOwner�C
// �]���ݭn�x���٭�ɪ���ư����}�A���ǿ��~�N�ɭP����X�{�Y�����~�C
// 當有覆蓋 Memo 與 繪製目標控制項 的 WindowProc 時不建議設定主體元件 AOwner
// 因為需要掌控還原時的函數執行位址,順序錯誤將導致執行出現嚴重錯誤。
// It is not recommended to set the belonging component AOwner when WindowProc
// overrides of Memo or draw target control.
// Because need to handle the execution address of the function when restoring,
// a sequence mistake will make serious execution errors.
constructor Create(AOwner: TComponent); overload; override;

// �إ߮ɳ]�w�ӷ� Memo �P �ؼб���C
// 建立時設定來源 Memo 與 目標控制項。
// Set the source Memo and target controls when creating.
constructor Create(AOwner: TComponent; AMemo: TCustomMemo; AControl: TControl; Immediate: Boolean = False); reintroduce; overload;

// �إ߮ɳ]�w�ӷ� Memo �ñN�ؼб�����w���� Memo ��������C
// 建立時設定來源 Memo 並將目標控制項指定為該 Memo 的父控制項。
// Set the source Memo when creating and specify the target control as the parent control of the Memo.
constructor Create(AOwner: TComponent; AMemo: TCustomMemo; Immediate: Boolean = False); reintroduce; overload;

destructor Destroy; override;

// �إ߳s�� �P �Ѱ��s��
// �`�N���涶�ǡA�����л\ Memo �P ø�s�ؼб�� �� WindowProc �ɡA�o�Ӷ��ǫܭ��n�C
// 建立連動 與 解除連動
// 注意執行順序,當有覆蓋 Memo 與 繪製目標控制項 的 WindowProc 時,這個順序很重要。
// About Bind and Unbind.
// Attention, the order of execution. If the WindowProc of Memo or draw target control items be covers, the order is very important.

// �إ߳s��
// 建立連動
// Manually bind linkage components.
procedure Bind(AMemo: TCustomMemo; AControl: TControl);

// �Ѱ��s��
// 解除連動
// Manually unbind.
procedure Unbind;

// �ϰ쥢�ġA�ϱ������ø�s�n�D��୫�sø�s
// 區域失效,使控制項收到繪製要求後能重新繪製
procedure Invalidate;
function Update: Boolean;

Expand All @@ -132,11 +132,11 @@ TLineNumbers = class(TComponent)
property FontColor: TColor read FFontColor write SetFontColor;
property BackgroundColor: TColor read FBackgroundColor write SetBackgroundColor;

// �����wø�s�ت��� Memo ��������ɪ�ø�s����C
// 當指定繪製目的為 Memo 的父控制項時的繪製間格。
// The left distance when drawing on the parent control of TMemo.
property Distance: Integer read FDistance write FDistance;

// �O�_�ߧY��sø�s
// 是否立即更新繪製
// Update drawing immediately when Memo changed.
property Immediate: Boolean read FImmediate write FImmediate;
end;
Expand Down