卷大侠登个记吧 (200分)

  • 主题发起人 主题发起人 203010
  • 开始时间 开始时间
2

203010

Unregistered / Unconfirmed
GUEST, unregistred user!
下面是我写的一个建立Cursor的函数,想建立一个橡皮的Cursor,可以用的,只是当<br>Size = 8 * 奇数时会有问题,其它到都正常,百思不得其解<br><br>function CreateRubberCursor(Size: Integer): HCursor;<br>var<br>&nbsp; A, B: array of Byte;<br>&nbsp; LineBytes: Integer;<br>&nbsp; AndByte: Byte;<br>&nbsp; i: Integer;<br>begin<br>&nbsp; LineBytes := Round(Size / 16 + 0.5) * 2;<br>&nbsp; SetLength(A, LineBytes * Size);<br>&nbsp; SetLength(B, LineBytes * Size);<br><br>&nbsp; for i := 0 to LineBytes * Size - 1 do<br>&nbsp; begin<br>&nbsp; &nbsp; A := 0;<br>&nbsp; &nbsp; B := 255;<br>&nbsp; end;<br><br>&nbsp; for i := 0 to LineBytes - 1 do<br>&nbsp; &nbsp; B := 0;<br>&nbsp; for i := LineBytes * (Size - 1) to LineBytes * Size - 1 do<br>&nbsp; &nbsp; B := 0;<br><br>&nbsp; for i := 1 to Size - 2 do<br>&nbsp; &nbsp; B[i * LineBytes] := B[i * LineBytes] and 127;<br><br>&nbsp; for i := 1 to Size - 2 do<br>&nbsp; begin<br>&nbsp; &nbsp; AndByte := not Trunc(Power(2, (8 - (Size mod 8))));<br>&nbsp; &nbsp; B[i * LineBytes + Round(Size / 8 + 0.5) - 1] :=<br>&nbsp; &nbsp; &nbsp; B[i * LineBytes + Round(Size / 8 + 0.5) - 1] and AndByte;<br>&nbsp; end;<br><br>&nbsp; Result := CreateCursor(Application.Handle, 0, 0, Size, Size, @A[0], @B[0]);<br>end;<br>
 
帮我提前的一律有分
 
搞定了,代码如下,谢谢大家,<br>另:上午出现过本来要24*24的Cursor,可出来了24*12的,现在有好了<br>function CreateRubberCursor(Size: Integer): HCursor;<br>var<br>&nbsp; A, B: array of Byte;<br>&nbsp; LineBytes: Integer;<br>&nbsp; AndByte: Byte;<br>&nbsp; i: Integer;<br>begin<br>&nbsp; LineBytes := Round(Size / 16 + 0.5) * 2;<br>&nbsp; SetLength(A, LineBytes * Size);<br>&nbsp; SetLength(B, LineBytes * Size);<br><br>&nbsp; for i := 0 to LineBytes * Size - 1 do<br>&nbsp; begin<br>&nbsp; &nbsp; A := 0;<br>&nbsp; &nbsp; B := 255;<br>&nbsp; end;<br><br>&nbsp; for i := 0 to LineBytes - 1 do<br>&nbsp; &nbsp; B := 0;<br>&nbsp; for i := LineBytes * (Size - 1) to LineBytes * Size - 1 do<br>&nbsp; &nbsp; B := 0;<br><br>&nbsp; for i := 1 to Size - 2 do<br>&nbsp; &nbsp; B[i * LineBytes] := B[i * LineBytes] and 127;<br><br>&nbsp; for i := 1 to Size - 2 do<br>&nbsp; begin<br>&nbsp; &nbsp; if (Size mod 8) &lt;&gt; 0 then<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; AndByte := not Trunc(Power(2, (8 - (Size mod 8))));<br>&nbsp; &nbsp; &nbsp; B[i * LineBytes + Round(Size / 8 + 0.5) - 1] :=<br>&nbsp; &nbsp; &nbsp; &nbsp; B[i * LineBytes + Round(Size / 8 + 0.5) - 1] and AndByte;<br>&nbsp; &nbsp; end<br>&nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; B[i* LineBytes + Size div 8 - 1] :=<br>&nbsp; &nbsp; &nbsp; &nbsp; B[i* LineBytes + Size div 8 - 1] and 254;<br>&nbsp; end;<br><br>&nbsp; Result := CreateCursor(Application.Handle, 0, 0, Size, Size, @A[0], @B[0]);<br>end;<br>
 
让我登什么记啊?<br><br>^_^
 
瓦!卷卷,我好羡慕你!
 

Similar threads

A
回复
0
查看
932
Andreas Hausladen
A
A
回复
0
查看
805
Andreas Hausladen
A
S
回复
0
查看
896
SUNSTONE的Delphi笔记
S
S
回复
0
查看
873
SUNSTONE的Delphi笔记
S
A
回复
0
查看
654
Andreas Hausladen
A
后退
顶部