Because the data in the database in the writing process is encrypted, so at the time of query according to need to decrypt,
So I rewrite the DBGRID DrawColumnCell events, the following code
//define rewrite event
Procedure DrawDataCell (const the Rect: TRect; Field: TField; State: TGridDrawState); Override.
//time to rewrite the code
Procedure TDBGRID. DrawDataCell (const the Rect: TRect; Field: TField; State: TGridDrawState);
The begin
Canvas. TextRect (the Rect, the Rect. Left + 2, the Rect. Top + 2, decryption (Column. Field. AsString) are identical);
end;
The fault code in DEELPHI 7 run there is no problem,
The problems in XE3:
After the data query, display is normal; But as DBGRID cell, in the database of data: the Column. The Field. The AsString, and decrypted Column. Field. The AsString repeat together, according to the result data showed normal,
In general is:
The focused hopefully can not normal, according to data for the Column. The Field. The AsString and decrypted Column. The Field. The AsString overlap, according to
Loses focus of cell data back to normal again, show decrypted Column. Field. AsString,