举个翻转TLabel的例子,其实TMemo也一样,只是对TWincontrol而言,涉及光标<br>的计算,要复杂一些.其实我的例子可适合一切基于TGraphicControl的控件,<br>即使有滚动区哉也不要紧,难道你还要求看不见的部分也翻转?<br><br>unit RevLabels;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br> StdCtrls;<br><br>type<br> TRevLabel = class(TLabel)<br> protected<br> procedure Paint; override;<br> end;<br><br>procedure Register;<br><br>implementation<br><br>procedure Register;<br>begin<br> RegisterComponents('Samples', [TRevLabel]);<br>end;<br><br>procedure TRevLabel.Paint;<br>var<br> I, J: Integer;<br> AColor: TColor;<br>begin<br> inherited Paint;<br> with Canvas do<br> for I := 0 to (ClientRect.Right - ClientRect.Left - 1) div 2 do<br> for J := ClientRect.Top to ClientRect.Bottom do<br> begin<br> AColor := Pixels[ClientRect.Left + I, J];<br> Pixels[ClientRect.Left + I, J] := Pixels[ClientRect.Right - I - 1, J];<br> Pixels[ClientRect.Right - I - 1, J] := AColor;<br> end;<br>end;<br><br>end.