Programlama | Programlama Dilleri | C Programlama Dili |C++

Hata
  • XML Parsing Error at 1:82. Error 9: Invalid character
´╗┐

Z?playan Toplar (ăarp??ma Kural?na G÷re)

AăIKLAMA

C++ Builder 6 projesidir. Bu program da Timer nesnesi kullan?larak RadioButton ve Shape nesnelerinin h?zl? bir hareketi sa?lanm??t?r. E?er RadioButton ile Shape nesneleri šarp??ma durumuna gelirlerse bulunduklar? istikamete g÷re z?t y÷nde hareket ederler. B÷ylece šarp??mada geršeklik durumuna da de?inilmi? olur. ăal??ma zaman?nda formun boyutlar? pencerede kayma ?eklinde olmayacak ?ekilde de?i?tirilirse šarp??ma kural? ba?l? ÷zellikler daha rahat g÷zlemlenebilir.

Program?n Tamam?n? A?a??daki Linkten ?ndirebilirsiniz

Linki G÷rebilmeniz ?šin ▄ye Olman?z Gerekmektedir...

▄ye Kay?t

Program Kodu:

  1. //---------------------------------------------------------------------------
  2.  
  3. #include <vcl.h>
  4. #pragma hdrstop
  5.  
  6. #include "Unit1.h"
  7. //---------------------------------------------------------------------------
  8. #pragma package(smart_init)
  9. #pragma resource "*.dfm"
  10. TForm1 *Form1;
  11. //---------------------------------------------------------------------------
  12. __fastcall TForm1::TForm1(TComponent* Owner)
  13. ááááááá : TForm(Owner)
  14. {
  15. }
  16. //---------------------------------------------------------------------------
  17.  
  18. void __fastcall TForm1::Timer1Timer(TObject *Sender)
  19. {
  20. static int sx=5;
  21. static int sy=5;
  22. static int ax=5;
  23. static int by=5;
  24. int x,y,a,b;
  25. x=RadioButton1->Left;
  26. y=RadioButton1->Top;
  27. a=Shape1->Left;
  28. b=Shape1->Top;
  29. if(y<=0)
  30. sy=-sy;
  31. if(b<=0)
  32. by=-by;
  33. if(y+RadioButton1->Height>=Form1->ClientRect.Bottom)
  34. sy=-sy;
  35. if(b+Shape1->Height>=Form1->ClientRect.Bottom)
  36. by=-by;
  37. if(x<=0)
  38. sx=-sx;
  39. if(a<=0)
  40. ax=-ax;
  41. if(x+RadioButton1->Width>=Form1->ClientRect.right)
  42. sx=-sx;
  43. if(a+Shape1->Width>=Form1->ClientRect.right)
  44. ax=-ax;
  45.  
  46. if(RadioButton1->Left+RadioButton1->Width>Shape1->Left && RadioButton1->Left+RadioButton1->Width<Shape1->Left+Shape1->Width && RadioButton1->Top+RadioButton1->Height>Shape1->Top && RadioButton1->Top+RadioButton1->Height<Shape1->Top+Shape1->Height)
  47. {ax=-ax;áá sx=-sx; }
  48.  
  49. if( RadioButton1->Top+RadioButton1->Height>Shape1->Top&&RadioButton1->Top+RadioButton1->Height<Shape1->Top+Shape1->Height && RadioButton1->Left+RadioButton1->Width>Shape1->Left && RadioButton1->Left+RadioButton1->Width<Shape1->Left+Shape1->Width)
  50. {by=-by;áá sy=-sy; }
  51.  
  52. x+=sx;
  53. y+=sy;
  54. a+=ax;
  55. b+=by;
  56. RadioButton1->Left=x;
  57. RadioButton1->Top=y;
  58. Shape1->Left=a;
  59. Shape1->Top=b;
  60. }
  61. //---------------------------------------------------------------------------
  62.  

Yorumlar (0)
Sadece kay─▒tl─▒ kullan─▒c─▒lar yorum yazabilir!
Son G├╝ncelleme ( Sal─▒, 04 Eyl├╝l 2012 03:17 )  
am─▒n─▒za koyay─▒m am─▒n─▒za koyay─▒m am─▒n─▒za koyay─▒m am─▒n─▒za koyay─▒m am─▒n─▒za koyay─▒m am─▒n─▒za koyay─▒m