1 unit Unit1; 2 3 interface 4 5 uses 6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 Dialogs, StdCtrls, bsSkinData, BusinessSkinForm, Mask, bsSkinBoxCtrls, bscalc, 8 bsSkinCtrls; 9 10 type 11 TForm1 = class(TForm) 12 Button2: TButton; 13 Button3: TButton; 14 Button4: TButton; 15 Button5: TButton; 16 Button6: TButton; 17 Button7: TButton; 18 Button8: TButton; 19 Button9: TButton; 20 Button10: TButton; 21 Button11: TButton; 22 Button12: TButton; 23 Button13: TButton; 24 Button14: TButton; 25 Button15: TButton; 26 Button16: TButton; 27 Button17: TButton; 28 Button18: TButton; 29 Button19: TButton; 30 Button20: TButton; 31 Button21: TButton; 32 Button22: TButton; 33 bsBusinessSkinForm1: TbsBusinessSkinForm; 34 bsSkinData1: TbsSkinData; 35 Edit1: TbsSkinEdit; 36 bsCompressedStoredSkin1: TbsCompressedStoredSkin; 37 Edit2: TbsSkinEdit; 38 Edit3: TbsSkinEdit; 39 Edit4: TbsSkinEdit; 40 Label1: TLabel; 41 Button1: TButton; 42 Button23: TButton; 43 procedure Button1Click(Sender: TObject); 44 procedure FormCreate(Sender: TObject); 45 procedure Button2Click(Sender: TObject); 46 procedure Button3Click(Sender: TObject); 47 procedure Button4Click(Sender: TObject); 48 procedure Button5Click(Sender: TObject); 49 procedure Button6Click(Sender: TObject); 50 procedure Button7Click(Sender: TObject); 51 procedure Button8Click(Sender: TObject); 52 procedure Button9Click(Sender: TObject); 53 procedure Button10Click(Sender: TObject); 54 procedure Button11Click(Sender: TObject); 55 procedure Button12Click(Sender: TObject); 56 procedure Button13Click(Sender: TObject); 57 procedure Button14Click(Sender: TObject); 58 procedure Button15Click(Sender: TObject); 59 procedure Button16Click(Sender: TObject); 60 procedure Edit1Change(Sender: TObject); 61 procedure Edit3Change(Sender: TObject); 62 procedure Edit1Enter(Sender: TObject); 63 procedure Edit3Enter(Sender: TObject); 64 procedure Button17Click(Sender: TObject); 65 procedure Button18Click(Sender: TObject); 66 procedure Button19Click(Sender: TObject); 67 procedure Button20Click(Sender: TObject); 68 procedure Button21Click(Sender: TObject); 69 procedure Button22Click(Sender: TObject); 70 procedure bsSkinButton1Click(Sender: TObject); 71 procedure Button23Click(Sender: TObject); 72 private 73 { Private declarations } 74 public 75 { Public declarations } 76 77 end; 78 79 var 80 Form1: TForm1; 81 str1:String; 82 str2:String; 83 int1:real; 84 int2:real; 85 bo:real; 86 result:real; 87 implementation 88 89 {$R *.dfm} 90 91 procedure TForm1.Button1Click(Sender: TObject); 92 begin 93 94 if bo=0 then 95 begin 96 str1:=str1+‘1‘; 97 Edit1.Text:=str1; 98 end 99 Else 100 begin 101 str2:=str2+‘1‘; 102 Edit3.Text:=str2; 103 end 104 105 106 end; 107 108 procedure TForm1.FormCreate(Sender: TObject); 109 begin 110 111 int1:=0; 112 int2:=0; 113 bo:=0; 114 SetWindowLong(Edit1.Handle,GWL_STYLE,GetWindowLong(Edit1.Handle,GWL_STYLE) or Es_right); 115 SetWindowLong(Edit2.Handle,GWL_STYLE,GetWindowLong(Edit2.Handle,GWL_STYLE) or Es_right); 116 SetWindowLong(Edit3.Handle,GWL_STYLE,GetWindowLong(Edit3.Handle,GWL_STYLE) or Es_right); 117 SetWindowLong(Edit4.Handle,GWL_STYLE,GetWindowLong(Edit4.Handle,GWL_STYLE) or Es_right); 118 end; 119 120 procedure TForm1.Button20Click(Sender: TObject); 121 begin 122 edit2.Text:=‘‘; 123 edit3.Text:=‘‘; 124 int2:=0; 125 edit4.Text:= FormatFloat(‘0.00000‘,1/int1) ; 126 end; 127 128 procedure TForm1.Button21Click(Sender: TObject); 129 begin 130 edit2.Text:=‘‘; 131 edit3.Text:=‘‘; 132 int2:=0; 133 edit4.Text:= FormatFloat(‘0.00000‘,Sqrt(int1)) ; 134 end; 135 136 procedure TForm1.Button22Click(Sender: TObject); 137 begin 138 result:=int1*int2/100; 139 Edit4.Text:=FormatFloat(‘0.00000‘,result); 140 end; 141 142 procedure TForm1.Button23Click(Sender: TObject); 143 begin 144 if bo=0 then 145 edit1.Text:=‘‘ 146 else 147 edit3.Text:=‘‘; 148 149 end; 150 151 procedure TForm1.Button2Click(Sender: TObject); 152 153 154 begin 155 if bo=0 then 156 begin 157 str1:=str1+‘2‘; 158 Edit1.Text:=str1; 159 end 160 Else 161 begin 162 str2:=str2+‘2‘; 163 Edit3.Text:=str2; 164 end 165 end; 166 167 procedure TForm1.Button3Click(Sender: TObject); 168 begin 169 if bo=0 then 170 begin 171 str1:=str1+‘3‘; 172 Edit1.Text:=str1; 173 end 174 Else 175 begin 176 str2:=str2+‘3‘; 177 Edit3.Text:=str2; 178 end 179 end; 180 181 procedure TForm1.Button4Click(Sender: TObject); 182 begin 183 if bo=0 then 184 begin 185 str1:=str1+‘4‘; 186 Edit1.Text:=str1; 187 end 188 Else 189 begin 190 str2:=str2+‘4‘; 191 Edit3.Text:=str2; 192 end 193 end; 194 195 procedure TForm1.Button5Click(Sender: TObject); 196 begin 197 if bo=0 then 198 begin 199 str1:=str1+‘5‘; 200 Edit1.Text:=str1; 201 end 202 Else 203 begin 204 str2:=str2+‘5‘; 205 Edit3.Text:=str2; 206 end 207 end; 208 209 procedure TForm1.Button6Click(Sender: TObject); 210 begin 211 if bo=0 then 212 begin 213 str1:=str1+‘6‘; 214 Edit1.Text:=str1; 215 end 216 Else 217 begin 218 str2:=str2+‘6‘; 219 Edit3.Text:=str2; 220 end 221 end; 222 223 procedure TForm1.Button7Click(Sender: TObject); 224 begin 225 if bo=0 then 226 begin 227 str1:=str1+‘7‘; 228 Edit1.Text:=str1; 229 end 230 Else 231 begin 232 str2:=str2+‘7‘; 233 Edit3.Text:=str2; 234 end 235 end; 236 237 procedure TForm1.Button8Click(Sender: TObject); 238 begin 239 if bo=0 then 240 begin 241 str1:=str1+‘8‘; 242 Edit1.Text:=str1; 243 end 244 Else 245 begin 246 str2:=str2+‘8‘; 247 Edit3.Text:=str2; 248 end 249 end; 250 251 procedure TForm1.Button9Click(Sender: TObject); 252 begin 253 if bo=0 then 254 begin 255 str1:=str1+‘9‘; 256 Edit1.Text:=str1; 257 end 258 Else 259 begin 260 str2:=str2+‘9‘; 261 Edit3.Text:=str2; 262 end 263 end; 264 265 procedure TForm1.Edit1Change(Sender: TObject); 266 begin 267 str1:=edit1.Text; 268 if edit1.Text<>‘‘ then 269 int1:=strtofloat(edit1.Text) 270 else 271 int1:=0; 272 273 end; 274 275 procedure TForm1.Edit1Enter(Sender: TObject); 276 begin 277 bo:=0; 278 end; 279 280 procedure TForm1.Edit3Change(Sender: TObject); 281 begin 282 str2:=edit3.Text; 283 if edit3.Text<>‘‘ then 284 int2:=strtofloat(edit3.Text) 285 else 286 int2:=0; 287 288 end; 289 290 procedure TForm1.Edit3Enter(Sender: TObject); 291 begin 292 bo:=1; 293 end; 294 295 procedure TForm1.bsSkinButton1Click(Sender: TObject); 296 begin 297 if bo=0 then 298 begin 299 str1:=str1+‘1‘; 300 Edit1.Text:=str1; 301 end 302 Else 303 begin 304 str2:=str2+‘1‘; 305 Edit3.Text:=str2; 306 end 307 end; 308 309 procedure TForm1.Button10Click(Sender: TObject); 310 begin 311 if bo=0 then 312 begin 313 str1:=str1+‘0‘; 314 Edit1.Text:=str1; 315 end 316 Else 317 begin 318 str2:=str2+‘0‘; 319 Edit3.Text:=str2; 320 end 321 end; 322 323 procedure TForm1.Button11Click(Sender: TObject); 324 begin 325 bo:=1; 326 Edit2.Text:=‘+‘; 327 end; 328 329 procedure TForm1.Button12Click(Sender: TObject); 330 begin 331 bo:=1; 332 Edit2.Text:=‘-‘; 333 end; 334 335 procedure TForm1.Button13Click(Sender: TObject); 336 begin 337 bo:=1; 338 Edit2.Text:=‘*‘; 339 end; 340 341 procedure TForm1.Button14Click(Sender: TObject); 342 begin 343 bo:=1; 344 Edit2.Text:=‘/‘; 345 end; 346 347 procedure TForm1.Button15Click(Sender: TObject); 348 begin 349 350 351 if Edit2.Text=‘+‘ then 352 begin 353 result:=int1+int2; 354 Edit4.Text:=floattostr(result); 355 end ; 356 357 358 if Edit2.Text=‘-‘ then 359 begin 360 result:=int1-int2; 361 Edit4.Text:=floattostr(result); 362 end ; 363 if Edit2.Text=‘*‘ then 364 begin 365 result:=int1*int2; 366 Edit4.Text:=floattostr(result); 367 end ; 368 if ( Edit2.Text=‘/‘) and (int2<>0 ) then 369 begin 370 result:=int1/int2; 371 {保留5位小数} 372 Edit4.Text:=FormatFloat(‘0.00000‘,result); 373 end ; 374 375 if ( Edit2.Text=‘/‘) and (int2=0 ) then 376 begin 377 Application.MessageBox(‘除数不能为0!‘,‘错误提示‘,MB_OKCANCEL); 378 end ; 379 380 381 end; 382 383 384 procedure TForm1.Button16Click(Sender: TObject); 385 begin 386 387 388 bo:=0; 389 Edit1.Text:=‘‘; 390 Edit2.Text:=‘‘; 391 Edit3.Text:=‘‘; 392 Edit4.Text:=‘‘; 393 int1:=0; 394 int2:=0; 395 result:=0; 396 end; 397 398 procedure TForm1.Button17Click(Sender: TObject); 399 begin 400 if bo=0 then 401 edit1.Text:= Copy( edit1.Text, 1, length( Edit1.text )-1 ) {截取} 402 else 403 edit3.Text:= Copy( edit3.Text, 1, length( Edit3.text )-1 ); 404 405 406 end; 407 408 procedure TForm1.Button18Click(Sender: TObject); 409 begin 410 if bo=0 then 411 begin 412 str1:=str1+‘.‘; 413 Edit1.Text:=str1; 414 end 415 Else 416 begin 417 str2:=str2+‘.‘; 418 Edit3.Text:=str2; 419 end 420 end; 421 422 procedure TForm1.Button19Click(Sender: TObject); 423 begin 424 if bo=0 then 425 begin 426 if int1>0 then 427 edit1.Text:=‘-‘+edit1.Text 428 else 429 begin 430 int1:=0-strtofloat(edit1.Text); 431 edit1.Text:=floattostr(int1) ; 432 end; 433 434 end 435 436 else 437 begin 438 if int2>0 then 439 edit3.Text:=‘-‘+edit3.Text 440 else 441 begin 442 int2:=0-strtofloat(edit3.Text); 443 edit3.Text:=floattostr(int2) ; 444 end; 445 end; 446 end; 447 448 end.