?? u7_4_2.cpp
字號(hào):
//---------------------- u7_4_2 -----------------------------------------------------
#include<math.h>
#include <vcl.h>
#pragma hdrstop
#include "u7_4_2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
Tf7_4_2 *f7_4_2;
//---------------------------------------------------------------------------
__fastcall Tf7_4_2::Tf7_4_2(TComponent* Owner)
: TForm(Owner)
{
}
int m_flag,shape_value;
//---------------------------------------------------------------------------
void __fastcall Tf7_4_2::FormCreate(TObject *Sender)
{
img1->Picture->LoadFromFile("..\\elephant.bmp");
img2->Picture->LoadFromFile("..\\monkey.bmp");
img3->Picture->LoadFromFile("../mouse.bmp");
img4->Picture->LoadFromFile("../rabbit.bmp");
m_flag=1;shape_value=0;
}
//---------------------------------------------------------------------------
void __fastcall Tf7_4_2::FormMouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
m_flag=0;
if(Button == 1)
{ shape_value++;
if(shape_value>5) shape_value=0;
shpMove->Shape=shape_value;
}
}
//---------------------------------------------------------------------------
void __fastcall Tf7_4_2::FormMouseUp(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y)
{
m_flag=1;
}
//---------------------------------------------------------------------------
void __fastcall Tf7_4_2::FormMouseMove(TObject *Sender, TShiftState Shift,
int X, int Y)
{
if (m_flag)
{ shpMove->Left=X-shpMove->Width;
shpMove->Top=Y-shpMove->Height;
}
else
{ shpMove->Width=abs(X-shpMove->Left);
shpMove->Height=abs(Y-shpMove->Top);
}
}
//---------------------------------------------------------------------------
void __fastcall Tf7_4_2::cmdEndClick(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -