The six basic steps to writing your Delphi component are as follows:
1. Deciding on an ancestor class.
2. Creating the Component Unit.
3. Adding properties, methods, and events to your new component.
4. Testing your component.
5. Registering your component with the Delphi environment.
6. Creating a help file for your component.
How to Convert Bytes code (TBytes) to 874 Thai(Windows) or Thai TIS-620.
Test with Delphi XE10.1 Berlin. This function show you how to convert TBytes (e.g. Data from Smart card) to Thai Unicode format. function แปลง TBytes ไปเป็นข้อความภาษาไทย 874 Thai(Windows) หรือ Thai TIS-620 function GetThaiFromBytesCode(const data: TBytes): WideString; var BYTES_CODE_TH: TBytes; UNICODE874_TIS620: TEncoding; begin // UNICODE := TEncoding.GetEncoding('TIS-620'); //TIS-620 UNICODE874_TIS620 := TEncoding.GetEncoding(874); //874 Thai(Windows) try BYTES_CODE_TH := TEncoding.Convert(UNICODE874_TIS620, TEncoding.Unicode, data); Result := WideStringOf(BYTES_CODE_TH) finally UNICODE874_TIS620.Free; //Fixed TMBCSEncoding memory leak. end; end;
ทำความเข้าใจเกี่ยวกับการปัดจุดทศนิยมบน Delphi
ปัญหา การปัดเศษ บน Delphi ใส่ A = 11291.50 กดปุ่ม 7% -> 11291.50 x 0.07 = 790.41 <- ค่าที่ถูกต้อง แต่โปรแกรมโชว์ 790.40 ตามโปรแกรมนี้ B = 790.40 Grand Total C = A + B ( 11291.50 + 790.40 ) ต้องได้ค่า = 12,081.90 แต่โปรแกรมโชว์ 12,081.91 กดปุ่ม 1% -> 11291.50 x 0.01 = 112.92 <- ค่าที่ถูกต้อง ครั้งนี้ปัดถูก NET Pay E = C - D (12081.91 - 112.92) = 11968.99 <- ค่าถูกต้อง ปัญหาคือ ทำไมตอน กด 7% คือ 11291.50 x 0.07 = 790.405 ทำไมไม่ปัดขึ้นเป็น 790.41 แต่ ตอนกด 1% คือ 11291.50 x 0.01 = 112.915 ถึงปัดขึ้นเป็น 112.92 Download source
Passport MRZ Checks
This will compares the codes built in to the passport with the identity details provided or found. Download source
Get MSSQL Server data Schema
SELECT T.NAME AS TABLENAME ,C.NAME AS COLNAME ,DTYPE.DATA_TYPE ,CASE WHEN P.PK = C.NAME THEN 'PK' ELSE '' END AS ISPK ,DTYPE.ORDINAL_POSITION FROM SYS.COLUMNS C LEFT JOIN SYS.TABLES T ON C.OBJECT_ID = T.OBJECT_ID INNER JOIN INFORMATION_SCHEMA.COLUMNS DTYPE ON T.NAME = DTYPE.TABLE_NAME AND C.NAME = DTYPE.COLUMN_NAME LEFT JOIN ( SELECT KU.TABLE_NAME AS TABLENAME ,KU.COLUMN_NAME AS PK FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS TC LEFT JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KU ON TC.CONSTRAINT_TYPE = 'PRIMARY KEY' AND TC.CONSTRAINT_NAME = KU.CONSTRAINT_NAME WHERE KU.TABLE_NAME IS NOT NULL ) P ON T.NAME = P.TABLENAME AND C.NAME = P.PK WHERE T.NAME = 'Customer' ORDER BY DTYPE.ORDINAL_POSITION;
Push Delphi source code to github
บทความที่กำลังอ่านต่อไปนี้ เป็นตัวอย่างการใช้งาน git command เพื่อ push source ไปยัง remote repository (github.com) เหมาะสำหรับมือใหม่ที่ต้องการจะ push source ไป share บน remote repository Download
Multi-lined text display with fastreport component in Delphi
การตั้งค่าให้ Fastreport แสดงหลายบรรทัด ..ในกรณีที่ข้อมูลที่จะแสดงนั้นยาวเกินกว่าที่จะแสดง ใน 1 บรรทัด เราสามารถกำหนด ให้ Fastreport แสดง ในรูปแบบหลายบรรทัด หรือ Mutli-Line ได้ แบบง่าย ๆ โดยดูได้จากภาพตัวอย่างด้านล่างประกอบ. Ref.Link
Delphi: Copy Paste Data from Excel to Dataset (With out Third-party component or Library)
This demo show you about, How to copy data from Excel and then paste to Delphi Application. (paste it to dataset) Very easy and Small code with this Project + Tool: Delphi 10.4.2 + Standard components: - TPanel - TFDMemTable - TDataSource - TDBGrid - TPanel - TButton - TActionList - TPopupMenu + Library: ClipBrd Youtube (+source)