home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / TASKVCLD.PAK / VCLDLG.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  2.0 KB  |  54 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1996 by Borland International, All Rights Reserved
  4. //
  5. // This file defines a VCL form class.  It was originally generated
  6. // by C++Builder.  The VCLDLG example invokes the form from an OWL
  7. // application. 
  8. //
  9. // None of the original C++Builder code was altered, but the 
  10. // GetSelectedColor function was added by hand.
  11. //----------------------------------------------------------------------------
  12. #define STRICT
  13. #include <vcl\vcl.h>
  14. #pragma hdrstop
  15. #include "vcldlg.h"
  16. //---------------------------------------------------------------------------
  17. #pragma resource "*.dfm"
  18. TForm1 *Form1;
  19. //---------------------------------------------------------------------------
  20. COLORREF TForm1::GetSelectedColor(void)
  21. {
  22.   // Note: the Max and Min properties of each scrollbar in this
  23.   // form guarantee that the Position value will always be < 256.
  24.   //
  25.   return RGB(
  26.              (unsigned char)ScrollBar_Red->Position,
  27.              (unsigned char)ScrollBar_Green->Position,
  28.              (unsigned char)ScrollBar_Blue->Position);
  29. }
  30. //---------------------------------------------------------------------------
  31. void TForm1::SetSelectedColor(COLORREF color)
  32. {
  33.   ScrollBar_Red->Position   = GetRValue(color);
  34.   ScrollBar_Green->Position = GetGValue(color);
  35.   ScrollBar_Blue->Position  = GetBValue(color);
  36. }
  37. //---------------------------------------------------------------------------
  38. __fastcall TForm1::TForm1(TComponent* Owner)
  39.   : TForm(Owner)
  40. {
  41. }
  42. //---------------------------------------------------------------------------
  43. void __fastcall TForm1::FormCreate(TObject* /*Sender*/)
  44. {
  45.   Label_Selection->Color = TColor(GetSelectedColor());
  46. }
  47. //---------------------------------------------------------------------
  48. void __fastcall TForm1::ScrollBar_Change(TObject* /*Sender*/)
  49. {
  50.   Label_Selection->Color = TColor(GetSelectedColor());
  51. }
  52. //---------------------------------------------------------------------
  53.  
  54.