⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frainbow.cpp

📁 C++ Math Lib. C++ Builder must use.
💻 CPP
字号:
//---------------------------------------------------------------------------
// N.V.Shokhirev
// created:  20041020
// modified: 20051020
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "fRainbow.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ScrollBar1Change(TObject *Sender)
{
  double t = double(ScrollBar1->Position)/double(ScrollBar1->Max);
  Label1->Caption = t;
  this->Canvas->Brush->Color = TColor(rainbow(t));
  this->Canvas->Rectangle(30,80,100,150);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  for (int i = 0; i < 500; i++)
  {
    this->Canvas->Pen->Color = TColor(rainbow(double(i)/500.0));
    this->Canvas->MoveTo(i+30,10);
    this->Canvas->LineTo(i+30,50);
  }
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button2Click(TObject *Sender)
{
  for (int i = 0; i < 500; i++)
  {
    this->Canvas->Pen->Color = TColor(rainbow1(double(i)/500.0));
    this->Canvas->MoveTo(i+30,10);
    this->Canvas->LineTo(i+30,50);
  }
}
//---------------------------------------------------------------------------



void __fastcall TForm1::Button5Click(TObject *Sender)
{
  int c;
  for (int i = 0; i < 500; i++)
  {
    c = PositiveNegative(RGB2(RadioGroup1->ItemIndex), double(i-250)/150.0);
    this->Canvas->Pen->Color = TColor(c);
    this->Canvas->MoveTo(i+30,10);
    this->Canvas->LineTo(i+30,50);
  }
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button6Click(TObject *Sender)
{
  int c;
  for (int i = 0; i < 500; i++)
  {
    c = PositiveNegative(RGB2(RadioGroup1->ItemIndex), double(i-250)/250.0);
    this->Canvas->Pen->Color = TColor(c);
    this->Canvas->MoveTo(i+30,10);
    this->Canvas->LineTo(i+30,50);
  }
}
//---------------------------------------------------------------------------


void __fastcall TForm1::Button7Click(TObject *Sender)
{
  int c;
  for (int i = 0; i < 500; i++)
  {
    c = Transition(RGB2(RadioGroup1->ItemIndex), double(i-250)/250.0);
    this->Canvas->Pen->Color = TColor(c);
    this->Canvas->MoveTo(i+30,10);
    this->Canvas->LineTo(i+30,50);
  }
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button8Click(TObject *Sender)
{
  int c;
  for (int i = 0; i < 500; i++)
  {
    c = Transition(RGB2(RadioGroup1->ItemIndex), double(i-250)/150.0);
    this->Canvas->Pen->Color = TColor(c);
    this->Canvas->MoveTo(i+30,10);
    this->Canvas->LineTo(i+30,50);
  }
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -