imagebuttonu.cpp
上传用户:hylc_2004
上传日期:2014-01-23
资源大小:46800k
文件大小:6k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #include <stdio.h>
  4. #pragma hdrstop
  5. #include "imagebuttonu.h"
  6. //---------------------------------------------------------------------------
  7. #pragma package(smart_init)
  8. #pragma link "fcButton"
  9. #pragma link "fcButtonGroup"
  10. #pragma link "fcClearPanel"
  11. #pragma link "fcColorCombo"
  12. #pragma link "fcCombo"
  13. #pragma link "fcDemoRichEdit"
  14. #pragma link "fcImgBtn"
  15. #pragma link "fcLabel"
  16. #pragma link "fcTreeCombo"
  17. #pragma resource "*.dfm"
  18. TImageBtnDemoForm *ImageBtnDemoForm;
  19. //---------------------------------------------------------------------------
  20. __fastcall TImageBtnDemoForm::TImageBtnDemoForm(TComponent* Owner)
  21.         : TForm(Owner)
  22. {
  23. }
  24. //---------------------------------------------------------------------------
  25. void __fastcall TImageBtnDemoForm::LightSwitch1Click(TObject *Sender)
  26. {
  27.  led4->Down = ((TfcImageBtn *)Sender)->Down;
  28. }
  29. //---------------------------------------------------------------------------
  30. void __fastcall TImageBtnDemoForm::TackButtonClick(TObject *Sender)
  31. {
  32.   Char Temp[20];
  33.   if (((TfcImageBtn *)Sender)->Down == True){
  34.      sprintf(Temp,"Tackrn(In)");
  35.   } else sprintf(Temp,"Tackrn(Out)");
  36.   tacklabel2->Caption = Temp;
  37. }
  38. //---------------------------------------------------------------------------
  39. void __fastcall TImageBtnDemoForm::NorthAmericaClick(TObject *Sender)
  40. {
  41.  CountryLabel->Caption = ((TfcImageBtn *)Sender)->Caption;
  42. }
  43. //---------------------------------------------------------------------------
  44. void __fastcall TImageBtnDemoForm::FormShow(TObject *Sender)
  45. {
  46.   fcImageCombo1->Text = "DitherBlend";
  47. }
  48. //---------------------------------------------------------------------------
  49. void __fastcall TImageBtnDemoForm::fcColorCombo1Change(TObject *Sender)
  50. {
  51.    puz1->DitherColor = ((TfcColorCombo *)Sender)->SelectedColor;
  52.    puz2->DitherColor = ((TfcColorCombo *)Sender)->SelectedColor;
  53.    puz3->DitherColor = ((TfcColorCombo *)Sender)->SelectedColor;
  54.    puz4->DitherColor = ((TfcColorCombo *)Sender)->SelectedColor;
  55.    puz5->DitherColor = ((TfcColorCombo *)Sender)->SelectedColor;
  56. }
  57. //---------------------------------------------------------------------------
  58. void __fastcall TImageBtnDemoForm::fcImageCombo1Change(TObject *Sender)
  59. {
  60.    if (fcImageCombo1->TreeView->Selected==NULL) return;
  61.    switch (fcImageCombo1->TreeView->Selected->Index) {
  62.    case 0: puz1->DitherStyle = dsFill;
  63.            puz2->DitherStyle = dsFill;
  64.            puz3->DitherStyle = dsFill;
  65.            puz4->DitherStyle = dsFill;
  66.            puz5->DitherStyle = dsFill;
  67.            break;
  68.    case 1: puz1->DitherStyle = dsDither;
  69.            puz2->DitherStyle = dsDither;
  70.            puz3->DitherStyle = dsDither;
  71.            puz4->DitherStyle = dsDither;
  72.            puz5->DitherStyle = dsDither;
  73.            break;
  74.    case 2: puz1->DitherStyle = dsBlendDither;
  75.            puz2->DitherStyle = dsBlendDither;
  76.            puz3->DitherStyle = dsBlendDither;
  77.            puz4->DitherStyle = dsBlendDither;
  78.            puz5->DitherStyle = dsBlendDither;
  79.    }
  80. }
  81. //---------------------------------------------------------------------------
  82. void __fastcall TImageBtnDemoForm::fcColorCombo2Change(TObject *Sender)
  83. {
  84.   Butterfly1->DitherColor = ((TfcColorCombo *)Sender)->SelectedColor;
  85.   Butterfly2->DitherColor = ((TfcColorCombo *)Sender)->SelectedColor;
  86.   Butterfly3->DitherColor = ((TfcColorCombo *)Sender)->SelectedColor;
  87. }
  88. //---------------------------------------------------------------------------
  89. void __fastcall TImageBtnDemoForm::ThumbTackClick(TObject *Sender)
  90. {
  91.   Char Temp[20];
  92.   if (((TfcImageBtn *)Sender)->Down == True){
  93.      sprintf(Temp,"Tackrn(In)");
  94.   } else sprintf(Temp,"Tackrn(Out)");
  95.   TackLabel->Caption = Temp;
  96. }
  97. //---------------------------------------------------------------------------
  98. void __fastcall TImageBtnDemoForm::Switch1Click(TObject *Sender)
  99. {
  100.    switch (((TfcImageBtn *)Sender)->Tag) {
  101.    case 1: lightbutton1->Down = ((TfcImageBtn *)Sender)->Down; break;
  102.    case 2: LightButton2->Down = ((TfcImageBtn *)Sender)->Down; break;
  103.    case 3: LightButton3->Down = ((TfcImageBtn *)Sender)->Down;
  104.    }
  105. }
  106. //---------------------------------------------------------------------------
  107. void __fastcall TImageBtnDemoForm::ButtonTabChange(
  108.       TfcCustomButtonGroup *ButtonGroup, TfcButtonGroupItem *OldSelected,
  109.       TfcButtonGroupItem *Selected)
  110. {
  111.   if (OldSelected->Button != NULL)
  112.      OldSelected->Button->Font->Color = clWhite;
  113.   Selected->Button->Font->Color = clYellow;
  114.   switch (Selected->Button->Tag) {
  115.   case 1: PageControl1->ActivePage = TabSheet1; break;
  116.   case 2: PageControl1->ActivePage = TabSheet2; break;
  117.   case 3: PageControl1->ActivePage = TabSheet3; break;
  118.   case 4: PageControl1->ActivePage = TabSheet4; break;
  119.   case 5: PageControl1->ActivePage = TabSheet5;
  120.   }
  121. }
  122. //---------------------------------------------------------------------------
  123. void __fastcall TImageBtnDemoForm::lightbutton1Click(TObject *Sender)
  124. {
  125.    switch (((TfcImageBtn *)Sender)->Tag) {
  126.    case 1: Switch1->Down = ((TfcImageBtn *)Sender)->Down; break;
  127.    case 2: Switch2->Down = ((TfcImageBtn *)Sender)->Down; break;
  128.    case 3: Switch3->Down = ((TfcImageBtn *)Sender)->Down;
  129.    }
  130. }
  131. //---------------------------------------------------------------------------
  132. void __fastcall TImageBtnDemoForm::fcColorCombo3Change(TObject *Sender)
  133. {
  134.   fcImageBtn1->Color = ((TfcColorCombo *)Sender)->SelectedColor;
  135.   fcImageBtn2->Color = ((TfcColorCombo *)Sender)->SelectedColor;
  136. }
  137. //---------------------------------------------------------------------------
  138. void __fastcall TImageBtnDemoForm::led4Click(TObject *Sender)
  139. {
  140.    LightSwitch1->Down = ((TfcImageBtn *)Sender)->Down;
  141. }
  142. //---------------------------------------------------------------------------