Autor Wiadomość
dsfds
PostWysłany: Nie 13:16, 06 Kwi 2008    Temat postu:

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

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

void __fastcall TForm1::mysz(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
Label1->Caption=X;
Label2->Caption=Y;
int rozmiar;
rozmiar=ScrollBar1->Position;
Canvas->Ellipse(X-rozmiar,Y-rozmiar,X+rozmiar,Y+rozmiar);

}
//---------------------------------------------------------------------------

void __fastcall TForm1::bbb(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
Label1->Caption=X;
Label2->Caption=Y;
if ((X<27)&&(Y<33)) Canvas->Brush->Color=clWhite;
if ((X<55)&&(X>31)&&(Y<33)) Canvas->Brush->Color=clYellow;
if ((X>59)&&(Y<33)) Canvas->Brush->Color=clRed;
if ((X<27)&&(Y<67)&&(Y>37)) Canvas->Brush->Color=clLime;
if ((X<55)&&(X>31)&&(Y<67)&&(Y>37)) Canvas->Brush->Color=clInactiveCaption;
if ((X>59)&&(Y<67)&&(Y>37)) Canvas->Brush->Color=clBlue;
if ((X<27)&&(Y>71)) Canvas->Brush->Color=clPurple;
if ((X<55)&&(X>31)&&(Y>71)) Canvas->Brush->Color=clMaroon;
if ((X>59)&&(Y>71)) Canvas->Brush->Color=clBlack;
}
//---------------------------------------------------------------------------
dioboł11
PostWysłany: Nie 11:58, 06 Kwi 2008    Temat postu: program

Program który po wybraniu koloru rusuje koła o róznej wielkości i kolorze
#include <vcl.h>
#pragma hdrstop

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


void __fastcall TForm1::kolor(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
if ((X<101)&&(Y<124)) Canvas->Brush->Color=clRed;
if ((X>100)&&(Y<124)) Canvas->Brush->Color=clGreen;

}
//---------------------------------------------------------------------------
void __fastcall TForm1::myszka(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
int rozmiar;
rozmiar=ScrollBar1->Position;
Canvas->Ellipse(X-rozmiar,Y-rozmiar,X+rozmiar,Y+rozmiar);
}
//-----------------------------------------------------------------------
Goś2
PostWysłany: Nie 11:03, 06 Kwi 2008    Temat postu:

Rysowanie koł ( zmiana kolorow )


//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Mysz.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Mysz(TObject *Sender, TShiftState Shift, int X,
int Y)
{
Label1->Caption=X;
Label2->Caption=Y;

Canvas->Brush->Color=clWhite;
Canvas->Ellipse (X+10,Y+10,X+40,Y+40);
}
//---------------------------------------------------------------------------


void __fastcall TForm1::RadioButton1Click(TObject *Sender)
{
Canvas->Pen->Color=clRed;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::RadioButton2Click(TObject *Sender)
{
Canvas->Pen->Color=clYellow;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::RadioButton3Click(TObject *Sender)
{
Canvas->Pen->Color=clBlue;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::FormCreate(TObject *Sender)
{

}
//---------------------------------------------------------------------------

void __fastcall TForm1::Label1Click(TObject *Sender)
{

}
//---------------------------------------------------------------------------

void __fastcall TForm1::Label2Click(TObject *Sender)
{

}
//---------------------------------------------------------------------------
Gość1
PostWysłany: Nie 10:33, 06 Kwi 2008    Temat postu:

objects inspector w Events zmieniamy OnMouseMove .... mysz


Label1->Caption=X;
Label2->Caption=Y;

Canvas->Brush->Color=random(500000)-250000;
Canvas->Ellipse (X+10,Y+10,X+40,Y+40);
Gość
PostWysłany: Nie 13:56, 16 Mar 2008    Temat postu:

Rysowanie koł w czasie ruchu myszka:

int x,y;
poz=mouse1->CursorPos;
Label1->Caption=poz.x;
Label2->Caption=poz.x;
x=poz.x;
y=poz.y;
Canvas->Pen->Color=clRed;
Canvas->Brush->Color=random(500000)-250000;
Canvas->Ellipse (x+10,y+10,x+20,y+20);
Gość
PostWysłany: Nie 13:43, 16 Mar 2008    Temat postu:

{
poz=mouse1->CursorPos;
Label1->Caption=poz.x;
Label2->Caption=poz.y;
}
Tesla
PostWysłany: Nie 12:52, 16 Mar 2008    Temat postu:

Generator figur


{
int x,y,z,w,a,b;
x=StrToInt(Edit1->Text);
y=StrToInt(Edit2->Text);
z=StrToInt(Edit3->Text);
w=StrToInt(Edit4->Text);
a=StrToInt(Edit5->Text);
b=StrToInt(Edit6->Text);


if (RadioButton1->Checked)
Canvas->Ellipse (x,y,z,w);

if (RadioButton2->Checked)
Canvas->Rectangle (x,y,z,w);

if (RadioButton3->Checked)
{
Canvas->MoveTo (x,y);
Canvas->LineTo (z,y);
Canvas->LineTo (z,w);
Canvas->LineTo (x,y);
}

if (RadioButton4->Checked)
{
Canvas->MoveTo (x,y);
Canvas->LineTo (z,y);
Canvas->LineTo (a,w);
Canvas->LineTo (b,w);
Canvas->LineTo (x,y);
}


if (RadioButton5->Checked)
{
Canvas->Brush->Color=clRed;
Canvas->Pen->Width=5;
Canvas->Pen->Color=clRed;
}
if (RadioButton6->Checked)
{
Canvas->Brush->Color=clBlue;
Canvas->Pen->Width=5;
Canvas->Pen->Color=clBlue;
}
if (RadioButton7->Checked)
{
Canvas->Brush->Color=clGreen;
Canvas->Pen->Width=5;
Canvas->Pen->Color=clGreen;
}
if (RadioButton8->Checked)
{
Canvas->Brush->Color=clBlack;
Canvas->Pen->Width=5;
Canvas->Pen->Color=clBlack;
}
if (RadioButton9->Checked)
{
Canvas->Brush->Color=clWhite;
Canvas->Pen->Width=5;
Canvas->Pen->Color=clWhite;
}
if (RadioButton10->Checked)
{
Canvas->Brush->Color=clLime;
Canvas->Pen->Width=5;
Canvas->Pen->Color=clLime;
}
}
Gość
PostWysłany: Nie 11:05, 16 Mar 2008    Temat postu:

To co wyżej tylko z KWADRATEM




//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
int x,y;
x=0;
y=0;
while(x<700)
{
y=0;
while(y<1000)
{
Canvas->Pen->Color=clRed;
Canvas->MoveTo (x,0);
Canvas->LineTo (x,900);
Canvas->MoveTo (0,y);
Canvas->LineTo (700,y);
Canvas->Pen->Color=random(500000)-250000;
Canvas->Brush->Color=random(500000)-250000;
Canvas->Rectangle (x,90+y,x+90,0+y);
y+=40;
}
x+=50;
}
}
tesla
PostWysłany: Nie 11:04, 16 Mar 2008    Temat postu:

int x,y;
for(x=0;x<700;x+=90)
for(y=0;y<1000;y+=40)
{
Canvas->Pen->Color=clRed;
Canvas->MoveTo (x,0);
Canvas->LineTo (x,900);
Canvas->MoveTo (0,y);
Canvas->LineTo (700,y);
Canvas->Pen->Color=random(500000)-250000;
Canvas->Brush->Color=random(500000)-250000;
Canvas->Rectangle (x,90+y,x+90,0+y);
Gość
PostWysłany: Nie 10:50, 16 Mar 2008    Temat postu:

Komenda WHILE



//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
int x,y;
x=0;
y=0;
while(x<700)
{
y=0;
while(y<1000)
{
Canvas->Pen->Color=clRed;
Canvas->MoveTo (x,0);
Canvas->LineTo (x,900);
Canvas->MoveTo (0,x);
Canvas->LineTo (700,x);
Canvas->Pen->Color=random(500000)-250000;
Canvas->Brush->Color=random(500000)-250000;
Canvas->Ellipse (x,90+y,x+90,0+y);
y+=90;
}
x+=90;
}
}
//---------------------------------------------------------------------------
Gość
PostWysłany: Nie 10:19, 16 Mar 2008    Temat postu:

L++ -> L=l+1
L-- -> lL=l-1
L+=3 -> L=l+3


pętla:

licznik=0;
while(licznik<10)
{
licznik++;
.
.
.
}


pętla 2:

licznik=0;
while(licznik++<10)
{
.
.
.
}
tesla
PostWysłany: Nie 9:49, 16 Mar 2008    Temat postu:

int x,y;
for(x=0;x<700;x+=90)
for(y=0;y<1000;y+=90)
{
Canvas->Pen->Color=clRed;
Canvas->MoveTo (x,0);
Canvas->LineTo (x,900);
Canvas->MoveTo (0,x);
Canvas->LineTo (700,x);
Canvas->Pen->Color=random(500000)-250000;
Canvas->Brush->Color=random(500000)-250000;
Canvas->Ellipse (x,90+y,x+90,0+y);
Gość
PostWysłany: Nie 14:17, 02 Mar 2008    Temat postu:

kratka z kolami i kolorami



int x,y;
for(x=0;x<700;x+=45)
{
Canvas->Pen->Color=clRed;
Canvas->MoveTo (x,0);
Canvas->LineTo (x,450);
Canvas->MoveTo (0,x);
Canvas->LineTo (700,x);
Canvas->Pen->Color=random(500000)-250000;
Canvas->Brush->Color=random(500000)-250000;
Canvas->Ellipse (x,0,x+45,45);

}
Gość
PostWysłany: Nie 13:55, 02 Mar 2008    Temat postu:

domek

{
Canvas->Pen->Color=clRed;
Canvas->MoveTo (200,200);
Canvas->LineTo (200,400);
Canvas->LineTo (400,400);
Canvas->LineTo (400,200);
Canvas->LineTo (200,200);
Canvas->LineTo (100,200);
Canvas->LineTo (300,50);
Canvas->LineTo (500,200);
Canvas->LineTo (400,200);

Canvas->Pen->Color=clGreen;
Canvas->MoveTo (250,250);
Canvas->LineTo (250,280);
Canvas->LineTo (280,280);
Canvas->LineTo (280,250);
Canvas->LineTo (250,250);

Canvas->Pen->Color=clGreen;
Canvas->MoveTo (320,250);
Canvas->LineTo (320,280);
Canvas->LineTo (350,280);
Canvas->LineTo (350,250);
Canvas->LineTo (320,250);

Canvas->Pen->Color=clYellow;
Canvas->Brush->Color=clYellow;
Canvas->Ellipse (0,0,100,100);

Canvas->Brush->Color=clBlack;
Canvas->Ellipse (30,20,40,30);

Canvas->Brush->Color=clBlack;
Canvas->Ellipse (60,20,70,30);

Canvas->Pen->Color=clYellow;
Canvas->Pen->Width=5;
Canvas->MoveTo (0,0);
Canvas->LineTo (100,100);

Canvas->Pen->Color=clYellow;
Canvas->Pen->Width=5;
Canvas->MoveTo (50,0);
Canvas->LineTo (50,120);

Canvas->Pen->Color=clYellow;
Canvas->Pen->Width=5;
Canvas->MoveTo (100,0);
Canvas->LineTo (0,100);

Canvas->Pen->Color=clYellow;
Canvas->Pen->Width=5;
Canvas->MoveTo (0,50);
Canvas->LineTo (130,50);
Gość
PostWysłany: Nie 13:50, 02 Mar 2008    Temat postu:

Koła olimpijskie:


Canvas->Pen->Color=clBlue ;
Canvas->Brush->Style=bsClear;
Canvas->Pen->Width=5;
Canvas->Ellipse(465,60,525,120);
Canvas->Pen->Color=clBlack ;
Canvas->Brush->Style=bsClear;
Canvas->Pen->Width=5;
Canvas->Ellipse(530,60,590,120);
Canvas->Pen->Color=clRed ;
Canvas->Brush->Style=bsClear;
Canvas->Pen->Width=5;
Canvas->Ellipse(595,60,655,120);
Canvas->Pen->Color=clYellow ;
Canvas->Brush->Style=bsClear;
Canvas->Pen->Width=5;
Canvas->Ellipse(498,90,558,150);
Canvas->Pen->Color=clGreen ;
Canvas->Pen->Width=5;
Canvas->Brush->Style=bsClear;
Canvas->Ellipse(562,90,622,150);

Powered by phpBB © 2001, 2005 phpBB Group