2
203010
Unregistered / Unconfirmed
GUEST, unregistred user!
下面是我写的一个建立Cursor的函数,想建立一个橡皮的Cursor,可以用的,只是当<br>Size = 8 * 奇数时会有问题,其它到都正常,百思不得其解<br><br>function CreateRubberCursor(Size: Integer): HCursor;<br>var<br> A, B: array of Byte;<br> LineBytes: Integer;<br> AndByte: Byte;<br> i: Integer;<br>begin<br> LineBytes := Round(Size / 16 + 0.5) * 2;<br> SetLength(A, LineBytes * Size);<br> SetLength(B, LineBytes * Size);<br><br> for i := 0 to LineBytes * Size - 1 do<br> begin<br> A := 0;<br> B := 255;<br> end;<br><br> for i := 0 to LineBytes - 1 do<br> B := 0;<br> for i := LineBytes * (Size - 1) to LineBytes * Size - 1 do<br> B := 0;<br><br> for i := 1 to Size - 2 do<br> B[i * LineBytes] := B[i * LineBytes] and 127;<br><br> for i := 1 to Size - 2 do<br> begin<br> AndByte := not Trunc(Power(2, (8 - (Size mod 8))));<br> B[i * LineBytes + Round(Size / 8 + 0.5) - 1] :=<br> B[i * LineBytes + Round(Size / 8 + 0.5) - 1] and AndByte;<br> end;<br><br> Result := CreateCursor(Application.Handle, 0, 0, Size, Size, @A[0], @B[0]);<br>end;<br>