Form dynamic special effects

xiaoxiao2021-03-06  68

Here is the header file: // ----------------------------------------- --------------------------------

#ifndef unit1H # Define unit1H // ------------------------------------------------------------------------------------------------------------------------------------ --------------------------------- # include #include #include < STDCTRLS.HPP> #include #include #include #include // ---------------- -------------------------------------------------- --------- class TForm1: public TForm {__ published: // IDE-managed Components TImage * Image1; TBitBtn * BitBtn1; TBitBtn * BitBtn2; TBitBtn * BitBtn3; TBitBtn * BitBtn4; TBitBtn * BitBtn5; TBitBtn * BitBtn6 ; TBitBtn * BitBtn7; TBitBtn * BitBtn8; TBitBtn * BitBtn9; TBitBtn * BitBtn10; TBitBtn * BitBtn11; TBitBtn * BitBtn12; TBitBtn * BitBtn13; TBitBtn * BitBtn14; TBitBtn * BitBtn15; TBitBtn * BitBtn16; TBitBtn * BitBtn17; TBitBtn * BitBtn18; TStaticText * Statictext1; tbitbtn * bitbtn19; tbitbtn * bitbtn20; tbitbtn * bitbtn21; void __fastcall FormCreate (TObject * Sender); void __fastcall BitBtn1Click (TObject * Sender); void __fastcall BitBtn2Click (TObject * Sender); void __fastcall BitBtn3Click (TObject * Sender); void __fastcall BitBtn4Click (TObject * Sender); void __fastcall BitBtn5Click (TObject * Sender); void __fastcall BitBtn6Click (TObject * Sender); void __fastcall BitBtn7Click (TObject * Sender); void __fastcall BitBtn8Click (TObject * Sender); void __fastcall BitBtn9Click (TObject * Sender); void __fastcall BitBtn10Click (TObject * Sender); void __fastcall bitbtn11click (TOBJECT * Sender); void __fastcall bitbtn12click (TOBJECT * Sender);

void __fastcall BitBtn13Click (TObject * Sender); void __fastcall BitBtn14Click (TObject * Sender); void __fastcall BitBtn15Click (TObject * Sender); void __fastcall BitBtn16Click (TObject * Sender); void __fastcall BitBtn17Click (TObject * Sender); void __fastcall BitBtn18Click (TObject * Sender); void __fastcall BitBtn19Click (TObject * Sender); void __fastcall BitBtn20Click (TObject * Sender); void __fastcall BitBtn21Click (TObject * Sender); private: // User declarations BITMAP bmp; HRGN MyRgn; Graphics :: TBitmap * bitmap1; INT I, J; Int Widthhalf; Int Heighthalf; Treat Dest1, Source1, Dest2, Source2; Public: // User Declarations __fastcall tform1 (tComponent * Owner);}; // ------------ -------------------------------------------------- ------------- EXTERN PACKAGE TFORM1 * FORM1; / / --------------------------- ---------------------------------------------- # Endif // / Below is a CPP file

#include #pragma HDRSTOP

#include "unit1.h" #include "math.h" // ---------------------------------- ----------------------------------------- # prgma package (smart_init) #pragma resource "* .dfm" TFORM1 * FORM1; // --------------------------------------- -----------------------------------__ fastcall tform1 :: tform1 (tComponent * Owner): TFORM (Owner ) {} // ------------------------------------------------------------------------------------------- ------------------------------

Void __fastcall tform1 :: form, {form1-> borderstyle = bsnone; form1-> left = 0; form1-> top = 0; Form1-> width = Screen-> width; Form1-> Height = screen- > Height; // Full screen display

Bitmap1 = new graphics :: tbitmap (); // Define an image handle // bitmap1-> loadFromfile ("test.bmp"); // Set the image to be displayed as factory.bmp // if (getDeviceCaps (Form1-> Canvas-> Handle, Bitspixel) == 8) {// Get the color properties of the display window getObject (Bitmap1-> Handle, SizeOf (Bitmap), (LPSTR) & BMP); if (bmp.bmbitspixel == 8 ) {// If the image color attribute of special effects is 256 colors // selectpalette (form1-> canvas-> handle, bitmap1-> palette, false); // Extract color scheme from the color drawing board displayed by special effects // RealizePalette (Form1-> canvas-> Handle); // Set color matching scheme in the display window //} Bitmap1-> handletype = BMDDB;}} // --------------- -------------------------------------------------- ------------

Void __fastcall tform1 :: bitbtn1click (TOBJECT * sender) {// image from the middle to the left and right! Form1-> refresh (); widthhalf = Bitmap1-> width / 2 bitmap1-> width% 2; for (i = 0; i <= widthhalf; i ) {dest1 = Rest (Widthhalf-i, 0, Widthhalf i , Bitmap1-> Height; Source1 = Rect (Widthhalf-i, 0, Widthhalf i, Bitmap1-> Height); Form1-> Canvas-> CopyRect (DEST1, BITMAP1-> Canvas, Source1); for (j = 0 ; J <10000; J ); // Image delay display //}} // ---------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------- void __fastcall tform1 :: Bitbtn2Click (TOBJECT * Sender) {// image is pulled in the middle of the left and right! FORM1-> refresh (); widthhalf = Bitmap1-> width / 2 bitmap1-> width% 2; Form1-> refresh (); for (i = 0; i <= width, i ) {source1 = dest1 = Rect ( 0, 0, I, Bitmap1-> height); Source2 = dest2 = Rect (Bitmap1-> Width-i, 0, Bitmap1-> width, Bitmap1-> Height); Form1-> Canvas-> CopyRect (dest1, Bitmap1- > Canvas, source1); Form1-> canvas-> CopyRect (dest2, bitmap1-> canvas, source2); for (j = 0; j <10000; j );}} // --------- -------------------------------------------------- ---------------- Void __fastcall tform1 :: bitbtn3click (TOBJECT * Sender) {// Image from the middle to both sides form1-> refresh (); heighthalf = bitmap1-> height / 2 bitmap1-> height% 2; for (i = 0; i <= heighthalf; i ) {dest1 = Rect (0, Heighthalf-i, Bitmap1-> width, heighthalf); Source1 = Rect (0, 0, Bitmap1-> Width, I); DEST2 = Rect (0, Heighthalf, Bitmap1->

Width, Heighthalf I); Source2 = Rect (0, Bitmap1-> Height-i, Bitmap1-> width, Bitmap1-> Height); Form1-> Canvas-> CopyRect (dest1, Bitmap1-> canvas, Source1); Form1 -> canvas-> CopyRect (DEST2, BITMAP1-> Canvas, Source2); for (j = 0; j <10000; j );}} // ---------------- -------------------------------------------------- --------- void __fastcall tform1 :: bitbtn4click (TOBJECT * Sender) {// Image closer from both sides FORM1-> refresh (); heighthalf = Bitmap1-> height / 2 bitmap1-> height% 2 For (i = 0; i <= heighthalf; i ) {dest1 = Rect (0, 0, Bitmap1-> Width, I); Source1 = Rect (0, Heighthalf-i, Bitmap1-> width, heighthalf); DEST2 = Rect (0, Bitmap1-> Height-i, Bitmap1-> width, Bitmap1-> Height); Source2 = Rect (0, Heighthalf, Bitmap1-> Width, Heighthalf i); Form1-> Canvas-> CopyRect (DEST1 , Bitmap1-> Canvas, Source1); Form1-> Canvas-> CopyRect (DEST2, BITMAP1-> Canvas, Source2); for (j = 0; J <1 0000; J );}} // --------------------------------------- ---------------------------------- Void __fastcall tform1 :: bitbtn5click (TOBJECT * Sender) {// image From left to right form1-> refresh (); for (i = Bitmap1-> width; i> = 0; i -) {dest1 = Rect (0, 0, Bitmap1-> width-i, Bitmap1-> height ); Source1 = Rect (i, 0, bitmap1-> width, bitmap1-> height); Form1-> canvas-> CopyRect (dest1, Bitmap1-> canvas, source1); for (j = 0; j <10000; J ) );

}} // ---------------------------------------------- ----------------------------- void __fastcall tform1 :: bitbtn6click (TOBJECT * Sender) {// image from right to left FORM1-> Refresh (); for (i = 0; i <= bitmap1-> width; i ) {dest1 = Rect (Bitmap1-> width-i, 0, bitmap1-> width, Bitmap1-> Height); Source1 = Rect (0, 0, I, Bitmap1-> Height); Form1-> Canvas-> CopyRect (dest1, Bitmap1-> canvas, Source1); for (j = 0; j <10000; j );}} // -------------------------------------------------- ------------------------- void __fastcall tform1 :: bitbtn7click (TOBJECT * Sender) {// Image pulls from top to Form1-> Refresh ); For (i = 0; i <= bitmap1-> height; i ) {dest1 = Rect (0, 0, bitmap1-> width, i); Source1 = Rect (0, Bitmap1-> Height-i, Bitmap1- > Width, bitmap1-> height); Form1-> Canvas-> CopyRect (dest1, bitmap1-> canvas, source1); for (j = 0; j <1; j );}} // ------ -------------------------------------------------- ------------------- void __fastcall tfor M1 :: bitbtn8click (TOBJECT * Sender) {// Image from dropping to FORM1-> Refresh (); for (i = 0; i <= bitmap1-> height; i ) {dest1 = Rect (0, Bitmap1- > Height-i, bitmap1-> width, bitmap1-> height); Source1 = Rect (0, 0, Bitmap1-> Width, i); Form1-> Canvas-> CopyRect (dest1, bitmap1-> canvas, source1); For (j = 0; j <10000; j );}} // --------------------------------- ------------------------------------------ Void __fastcall tform1 :: bitbtn9click (TOBJECT * Sender) {// image from left to right form1->

Refresh (); for (i = 0; i <= bitmap1-> width; i ) {dest1 = RECT (0, 0, i, bitmap1-> height); Source1 = Rect (0, 0, I, Bitmap1-> HEIGHT); FORM1-> Canvas-> CopyRect (dest1, Bitmap1-> canvas, Source1); for (j = 0; j <10000; j );}} // ------------ -------------------------------------------------- ------------- void __fastcall tform1 :: bitbtn10click (TOBJECT * Sender) {// Image from right to left FORM1-> refresh (); for (i = bitmap1-> width; I> = 0; i -) {dest1 = Rect (i 0, 0 bitmap1-> width, 0 bitmap1-> height); Source1 = Rect (i, 0, bitmap1-> width, Bitmap1- > HeiGHT); FORM1-> Canvas-> CopyRect (dest1, bitmap1-> canvas, source1); for (j = 0; j <10000; j );}} // ----------- -------------------------------------------------- -------------- Void __fastcall tform1 :: bitbtn11click (TOBJECT * Sender) {// Image from the appearance of Form1-> refresh (); for (i = 0; i < = Bitmap1-> Height; i ) {dest1 = Rect (0, 0, Bitmap1-> Width 0, i 0); Source1 = Rect (0, 0, Bitmap1-> Width, I); Form1-> Canvas-> CopyRect (DEST1, BITMAP1-> canvas, Source1); for (j = 0; j <10000; j );}} / / --------------------------------------------------- -------------------------- void __fastcall tform1 :: bitbtn12click (TOBJECT * sender) {// image from Form1-> Refresh (); for (i = bitmap1-> height; i> = 0; i -) {dest1 = Rect (0, i 0, Bitmap1-> width 0, Bitmap1-> Height 0); Source1 = RECT (0, I, Bitmap1-> width, Bitmap1->

HEIGHT); FORM1-> Canvas-> CopyRect (dest1, Bitmap1-> canvas, Source1); for (j = 0; j <10000; j );}} // ------------ -------------------------------------------------- ------------- void __fastcall tform1 :: bitbtn13click (TOBJECT * Sender) {// Metal-melting cast A form1-> refresh (); for (i = bitmap1-> height; i> = 0 i -) {source1 = Rect (0, I, Bitmap1-> Width, i 1); for (int J1 = 0; j1 <= i; j1 ) {dest1 = Rect (0, J1, Bitmap1-> Width 0, J1 1); FORM1-> Canvas-> CopyRect (dest1, Bitmap1-> canvas, Source1); for (j = 0; j <10000; j );}}} // ----- -------------------------------------------------- -------------------- Void __fastcall tform1 :: bitbtn14click (Tobject * sender) {// reverse metal molten casting FORM1-> refresh (); for (i = 0; i <= bitmap1-> height; i ) {source1 = Rect (0, i, bitmap1-> width, i 1); for (int J1 = Bitmap1-> height-1; j1> = i; j1--) {DEST1 = RECT (0, J1, Bit Map1-> Width, J1 1); Form1-> Canvas-> CopyRect (DEST1, BITMAP1-> canvas, Source1); for (j = 0; j <10000; j );}}} // ---- -------------------------------------------------- --------------------- void __fastcall tform1 :: bitbtn15click (Tobject * sender) {form1-> refresh (); int J1 = SQRT (Bitmap1-> width * Bitmap1-> width bitmap1-> height * bitmap1-> height) / 2 4; for (i = 1; i

Width / 2-i, Bitmap1-> Height / 2-i, Bitmap1-> Width / 2 i, Bitmap1-> Height / 2 i); selectObject (canvas-> handle, myRGN); Canvas-> DRAW (0 , 0, Bitmap1); deleteObject (MyRGN); for (j = 0; j <10000; j );}} // ---------------------- -------------------------------------------------- --- void __fastcall tform1 :: bitbtn16click (tobject * sender) {form1-> refresh (); heighthalf = Bitmap1-> height / 2 bitmap1-> height% 2; source1 = Rect (0, 0, Bitmap1-> width , Heighthalf); Source2 = Rect (0, Heighthalf, Bitmap1-> width, Bitmap1-> Height); for (i = 0; i <= bitmap1-> width; i ) {dest1 = Rect (0-bitmap1-> width i, 0, i, 0 heighthalf); dest2 = Re (Bitmap1-> width-i, heighthalf, bitmap1-> width bitmap1-> width-i, bitmap1-> height 0); Form1-> Canvas > MoveTo (0-bitmap1-> width i-1, 0); Form1-> Canvas-> Lineto (0-bitmap1-> width i-1, heighthalf); Form1-> Canvas-> COP YRECT (DEST1, BITMAP1-> Canvas, Source1); Form1-> Canvas-> Moveto (Bitmap1-> Width Bitmap1-> width-i, 0); Form1-> Canvas-> Lineto (Bitmap1-> Width Bitmap1- > Width-i, bitmap1-> height); Form1-> canvas-> CopyRect (dest2, bitmap1-> canvas, source2); for (j = 0; j <10000; j );}} // ---- -------------------------------------------------- --------------------- void __fastcall tform1 :: bitbtn17click (Tobject * sender) {form1-> refresh (); widthhalf = Bitmap1-> width / 2

Bitmap1-> width% 2; Source1 = Rect (0, 0, widthhalf, Bitmap1-> height); Source2 = Rect (widthhalf, 0, Bitmap1-> width, Bitmap1-> height); for (i = 0; i < = Bitmap1-> Height; i ) {dest1 = Rect (0, 0-bitmap1-> height i, widthhalf, 0 i); // bitmap1-> width dest2 = Rect (widthhalf, Bitmap1-> height-i, Bitmap1-> width, 0 i); // bitmap1-> height 1); canvas-> Moveto (0, 0-bitmap1-> height i-1); Form1-> Canvas-> Lineto (Widthhalf, 0 -Bitmap1-> Height i-1); Form1-> Canvas-> CopyRect (dest1, Bitmap1-> canvas, source1); Form1-> canvas-> Moveto (widthhalf, Bitmap1-> Height Bitmap1-> HEIGHT-i ); Form1-> canvas-> lineto (Bitmap1-> Width, Bitmap1-> Height Bitmap1-> Height-i); Form1-> Canvas-> CopyRect (DEST2, BITMAP1-> Canvas, Source2); for (j = 0; J <10000; J );}} // ------------------------------------- -------------------------------------- void __fastcall tform1 :: bitbtn18click (Tobject * Sender) {FORM1-> refresh (); widthhalf = Bitmap1-> width / 2 bitmap1-> width% 2; source1 = Rect (0, 0, widthhalf, Bitmap1-> height); Source2 = Re (Widthhalf, 0, Bitmap1- > Width, bitmap1-> height); for (i = 0; i <= Bitmap1-> height; i ) {dest1 = Rect (0, 0-bitmap1-> height i, widthhalf, 0 i); ///// Bitmap1-> width dest2 = Rect (widthhalf, Bitmap1-> height-i, bitmap1-> width, i-0); canvas-> moveto (0,0-bitmap1-> height i-1); Form1-> Canvas ->

LINETO (Width I-1); Form1-> Canvas-> CopyRect (dest1, Bitmap1-> canvas, Source1); Form1-> Canvas-> Moveto (widthhalf, Bitmap1-> Height Bitmap1 -> Height-i); Form1-> canvas-> lineto (Bitmap1-> width, Bitmap1-> Height Bitmap1-> Height-i); Form1-> Canvas-> CopyRect (DEST2, BITMAP1-> Canvas, Source2) ; For (j = 0; j <10000; j );}} // -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------- void __fastcall tform1 :: bitbtn19click Tobject * sender {form1-> refresh (); source2 = Rect (0, 0, bitmap1-> width, bitmap1-> height); for (i = 0; i <= bitmap1-> height; i ) {DEST2 = Rect (0, Bitmap1-> Height-i, Bitmap1-> Width, I-0); Canvas-> Moveto (0,0-bitmap1-> height i-1); Form1-> Canvas-> Moveto (0, Bitmap1-> Height Bitmap1-> Height-i); Form1-> canvas-> lineto (Bitmap1-> Width, Bitmap1-> Height Bitmap1-> Height-i); Form1-> Canva S-> COPYRECT (DEST2, BITMAP1-> Canvas, Source2); for (j = 0; j <10000; j );}} // ------------------------------------------------------------------------------------------------------------------------------------------------------ -------------------------------------------------- -------

void __fastcall tform1 :: bitbtn20click (tobject * render) {form1-> refresh (); source2 = Rect (0, Bitmap1-> height, bitmap1-> width, 0); for (i = 0; i <= bitmap1-> Width; i ) {DEST2 = Rect (i-0, Bitmap1-> height, bitmap1-> width-i, 0); canvas-> moveto (0-bitmap1-> width i-1, 0); Form1-> Canvas-> MoveTo (Bitmap1-> Width Bitmap1-> width-i, 0); Form1-> Canvas-> Lineto (Bitmap1-> Width Bitmap1-> width-i, Bitmap1-> Height); Form1-> Canvas -> COPYRECT (DEST2, BITMAP1-> Canvas, Source2); for (j = 0; j <10000; j );}} // ------------------- -------------------------------------------------- ------ Void __fastcall tform1 :: bitbtn21click (TOBJECT * Sender) {Application-> Terminate ();} // ------------------------------------------------------------------------------------------------------------------------------------------ -------------------------------------------------- ---

转载请注明原文地址:https://www.9cbs.com/read-109831.html

New Post(0)