DelphiÖÐÈ¡Õûº¯ÊýRoundµÄBug½â¾ö
DelphiÖÐ Roundº¯ÊýÓиöBug
Ò»µ©²ÎÊýÊÇÐÎÈç XXX.5ÕâÑùµÄÊýʱ
Èç¹û XXX ÊÇÆæÊý ÄÇô¾Í»á Round up
Èç¹û XXX ÊÇżÊý ÄÇô¾Í»á Round down
ÀýÈç Round(17.5)=18
µ«ÊÇ Round(12.5)=12
ÏÂÃæµÄº¯Êý¼´¿É¾ÀÕýÕâ¸ö Bug µ«ÊÇÊÇÁÙʱÐÔµÄ
Ö´ÐÐ DoRound(12.5) ½á¹ûΪ 13 ÕýÈ·
function DoRound(Value: Extended): Int64;
procedure Set8087CW(NewCW: Word);
asm
MOV Default8087CW,AX
FNCLEX
FLDCW Default8087CW
end;
const
RoundUpCW = $1B32;
var
OldCW : Word;
begin
OldCW := Default8087CW;
try
Set8087CW(RoundUpCW);
Result := Round(Value);
finally
Set8087CW(OldCW);
end;
end;
Ïà¹ØÎĵµ£º
ÔÚ´°ÌåµÄOnMouseDownʼþÖмÓÈëÏÂÃæ¼¸ÐдúÂë¼´¿É
If Button = mbleft Then
begin
ReleaseCapture;
SendMessage(MainForm.Handle,WM_NCLBUTTONDOWN,HTCAPTION,0);
end;
Èô´°ÌåµÄ±íÃæ±»±ðµÄ¿Ø¼þÂĸǵô£¬ÔòÐèÒª°ÑÉÏÃæµÄ´úÂë¼ÓÈëÂĸǵĿؼþÀïÃæ¡£ ......
ÔÚÌÖÂÛÕâ¸ö»°Ìâ֮ǰ£¬±ØÐëҪ˵Ã÷µÄÊÇ£¬Èç¹ûÄã¸Õѧϰdelphi£¬Ç벻Ҫģ·Â£¬ÒòΪ̸²»ÉÏתÐÍ£»Èç¹ûÄãÓÃdelphiÒѾ³Éϰ¹ß£¬²¢ÇÒÊìϤhtmlÓïÑÔ¡¢ÓÐBS½á¹¹»ù´¡¡¢¶ÔJAVAÓ﷨ûÓÐÕϰ£¨Èç¹ûÄã¿´²»¶®¼òµ¥µÄ»ù´¡JAVA´úÂ룬½¨ÒéÄ㻹ÊǼÌÐøÄãµÄd°É£©£¬Ï£ÍûÕâ¶ÎÄÚÈݶÔÄãÓÐËù°ïÖú£¬´Ë»°Ìâ²»ÌÖÂÛ¾ßÌå¼¼Êõ£¬Ö»ËµËµÎÒµÄѧϰ²½ÖèºÍÐĵá£
1¡¢ ² ......
(Ò») ʹÓö¯Ì¬´´½¨µÄ·½·¨
Ê×ÏÈ´´½¨ Excel ¶ÔÏó£¬Ê¹ÓÃComObj:
var ExcelApp: Variant;
ExcelApp := CreateOleObject( 'Excel.Application' );
1) ÏÔʾµ±Ç°´°¿Ú£º
ExcelApp.Visible := True;
2) ¸ü¸Ä Excel ±êÌâÀ¸£º
ExcelApp.Caption := 'Ó¦ÓóÌÐòµ÷Óà Microsoft Excel';
3) Ìí¼Óй¤×÷²¾£º
ExcelApp.WorkBooks.Add ......
delphi TStringList Ó÷¨Ïê½â
//TStringList ³£Ó÷½·¨ÓëÊôÐÔ
:
var
List: TStringList;
i: Integer;
begin
List := TStringList.Create;
List.Add('Strings1'); {Ìí¼Ó}
List.Add('Strings2');
List.Exch ......