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

Delphi控件源码

开发平台:

Delphi

  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "frameu.h"
  5. //---------------------------------------------------------------------------
  6. #pragma package(smart_init)
  7. #pragma link "fcButton"
  8. #pragma link "fcCombo"
  9. #pragma link "fcDemoRichEdit"
  10. #pragma link "fcImage"
  11. #pragma link "fcImageForm"
  12. #pragma link "fcImager"
  13. #pragma link "fcImgBtn"
  14. #pragma link "fcLabel"
  15. #pragma link "fcShapeBtn"
  16. #pragma link "fctreecombo"
  17. #pragma resource "*.dfm"
  18. TFrameDemoForm *FrameDemoForm;
  19. //---------------------------------------------------------------------------
  20. __fastcall TFrameDemoForm::TFrameDemoForm(TComponent* Owner)
  21.         : TForm(Owner)
  22. {
  23. }
  24. //---------------------------------------------------------------------------
  25. void __fastcall TFrameDemoForm::BitBtn1Click(TObject *Sender)
  26. {
  27.  Close();        
  28. }
  29. //---------------------------------------------------------------------------
  30. void __fastcall TFrameDemoForm::BackgroundComboChange(TObject *Sender)
  31. {
  32.  if (!dynamic_cast<TfcTreeCombo *>(Sender)) return;
  33.  if (((TfcTreeCombo *)Sender)->Text=="Plain")
  34.  {
  35.   TileImager->Visible = False;
  36.   return;
  37.  }
  38.  TfcImager * Tile;
  39.  Tile = NULL;
  40.  if (((TfcTreeCombo *)Sender)->Text=="Wrinkle")
  41.     Tile = WrinkleImager;
  42.  else if (((TfcTreeCombo *)Sender)->Text=="Linen")
  43.     Tile = LinenImager;
  44.  else if (((TfcTreeCombo *)Sender)->Text=="Parchment")
  45.     Tile = ParchmentImager;
  46.  else if (((TfcTreeCombo *)Sender)->Text=="Mosaic")
  47.     Tile = MosaicImager;
  48.   if (Tile != NULL) {
  49.      Tile->UpdateWorkBitmap();
  50.      TileImager->Picture->Assign(Tile->WorkBitmap);
  51.   }
  52.   TileImager->Visible = True;
  53. }
  54. //---------------------------------------------------------------------------
  55. void __fastcall TFrameDemoForm::FormShow(TObject *Sender)
  56. {
  57.   ParchmentImager->UpdateWorkBitmap();
  58.   TileImager->Picture->Assign(ParchmentImager->WorkBitmap);
  59. }
  60. //---------------------------------------------------------------------------
  61. void __fastcall TFrameDemoForm::FrameComboChange(TObject *Sender)
  62. {
  63.   for (int i = 0;i <= ControlCount-1;i++)
  64.   {
  65.     if (!dynamic_cast<TfcTreeCombo *>(Controls[i])) continue;
  66.     TfcTreeCombo * TreeCombo = ((TfcTreeCombo *)Controls[i]);
  67.     TreeCombo->Frame->FocusStyle = efsFrameBox;
  68.     TreeCombo->Frame->NonFocusStyle = efsFrameBox;
  69.     TreeCombo->Frame->NonFocusBorders = TreeCombo->Frame->NonFocusBorders << efLeftBorder << efTopBorder << efRightBorder << efBottomBorder;
  70.     TreeCombo->ButtonEffects->Flat = False;
  71.     TreeCombo->ButtonEffects->Transparent = False;
  72.     TreeCombo->Frame->Enabled = True;
  73.     if (((TfcTreeCombo *)Sender)->Text == "Underline") {
  74.        TreeCombo->Frame->NonFocusBorders.Clear();
  75.        TreeCombo->Frame->NonFocusBorders = TreeCombo->Frame->NonFocusBorders << efBottomBorder;
  76.     }
  77.     else if (((TfcTreeCombo *)Sender)->Text == "FrameBox") {}
  78.     else if (((TfcTreeCombo *)Sender)->Text == "Flat Buttons") {
  79.           TreeCombo->Frame->NonFocusStyle = efsFrameSingle;
  80.           TreeCombo->ButtonEffects->Flat = True;
  81.           TreeCombo->ButtonEffects->Transparent = True;
  82.     }
  83.     else if (((TfcTreeCombo *)Sender)->Text == "No Frame (Normal)") {
  84.           TreeCombo->Frame->Enabled = False;
  85.           TreeCombo->BorderStyle = bsSingle;
  86.     }
  87.     else if (((TfcTreeCombo *)Sender)->Text == "No Frame (Normal)")
  88.           TreeCombo->Frame->FocusStyle = efsFrameSunken;
  89.     else if (((TfcTreeCombo *)Sender)->Text == "Raised Panel Focus")
  90.           TreeCombo->Frame->FocusStyle = efsFrameRaised;
  91.     else if (((TfcTreeCombo *)Sender)->Text == "Etched") {
  92.           TreeCombo->Frame->NonFocusStyle = efsFrameEtched;
  93.           TreeCombo->Frame->FocusStyle = efsFrameEtched;
  94.     }
  95.     else if (((TfcTreeCombo *)Sender)->Text == "Bump") {
  96.           TreeCombo->Frame->NonFocusStyle = efsFrameBump;
  97.           TreeCombo->Frame->FocusStyle = efsFrameBump;
  98.     }
  99.   }
  100. }
  101. //---------------------------------------------------------------------------