1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
//---------------------------------------------------------------------------
#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::WMVScroll(TMessage &Msgv)
{
int c = Panel3->Top;
int b = Panel2->Top;
int a = Panel1->Top; // doit etre place imperativement avant la ligne suivante
// afin de conserver la position sur l'ecran
TForm::Dispatch(&Msgv); // imperatif sinon le ScrollBar ne defile pas
// (Form1->VertScrollBar->Increment / (Form1->VertScrollBar->Range - Form1->ClientHeight))
// formule permettant de calculer la position en hauteur dans la Form quelque soit
// la position du SCrollBar afin d'avoir le ou les composants toujours a l'ecra
Panel1->Top = a;
Panel2->Top = b;
Panel3->Top = c;
// + GetScrollPos(Form1->Handle, SB_VERT) * (Form1->VertScrollBar->Increment / (Form1->VertScrollBar->Range - Form1->ClientHeight));
}
//---------------------------------------------------------------------------
void __fastcall TForm1::WMHScroll(TMessage &Msgh)
{
int c = Panel3->Left;
int d = Panel2->Left;
int a = Panel1->Left; // doit etre place imperativement avant la ligne suivante
// afin de conserver la position sur l'ecran
TForm::Dispatch(&Msgh); // imperatif sinon le ScrollBar ne defile pas
// (Form1->HorzScrollBar->Increment / (Form1->HorzScrollBar->Range - Form1->ClientHeight))
// formule permettant de calculer la position en hauteur dans la Form quelque soit
// la position du SCrollBar afin d'avoir le ou les composants toujours a l'ecra
Panel1->Left = a;
Panel2->Left = d;
Panel3->Left = c;
// GetScrollPos(Form1->Handle, SB_HORZ) * (Form1->HorzScrollBar->Increment / (Form1->HorzScrollBar->Range - Form1->ClientHeight));
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
// affiche le Panel avec un effet ascenseur
Panel2->BringToFront();
Panel2->Top = 60;
Panel2->Left = 10;
Panel2->Height = 0;
for(int i = 0; i <= 130; i++)
{
Panel2->Height = i;
Panel2->Repaint();
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
// le Button2 est place sur le Panel
// efface le Panel avec un effet ascenseur
for(int i = 130; i >= 0; i--)
{
Panel2->Height = i;
Panel2->Repaint();
}
Panel2->Height = 0;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Panel2MouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
// permet de deplacer le Panel
ReleaseCapture();
SendMessage(Panel2->Handle, WM_SYSCOMMAND, 0xF012, 0);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
// affiche le Panel avec un effet ascenseur
Panel3->BringToFront();
Panel3->Top = 60;
Panel3->Left = 10;
Panel3->Height = 0;
for(int i = 0; i <= 130; i++)
{
Panel3->Height = i;
Panel3->Repaint();
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button5Click(TObject *Sender)
{
// le Button2 est place sur le Panel
// efface le Panel avec un effet ascenseur
for(int i = 130; i >= 0; i--)
{
Panel3->Height = i;
Panel3->Repaint();
}
Panel3->Height = 0;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Panel3MouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
// permet de deplacer le Panel
ReleaseCapture();
SendMessage(Panel3->Handle, WM_SYSCOMMAND, 0xF012, 0);
}
//--------------------------------------------------------------------------- |
Partager