📄 unit_preview.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit_Preview.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm_Preview *Form_Preview;
//---------------------------------------------------------------------------
__fastcall TForm_Preview::TForm_Preview(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm_Preview::FormResize(TObject *Sender)
{
double R;
R = 210.0/297.0;
Image1->Width = Form_Preview->ClientWidth -50-ControlBar1->Height;
Image1->Height = Image1->Width * R;
if(Image1->Height > (Form_Preview->ClientHeight - 50-ControlBar1->Height)){
Image1->Height = Form_Preview->Height - 50-ControlBar1->Height;
Image1->Width = Image1->Height / R;
}
Image1->Left=(Form_Preview->ClientWidth-Image1->Width)/2;
Image1->Top=(Form_Preview->ClientHeight-Image1->Height+ControlBar1->Height)/2;;
Image1->Height/(double)Image1->Width;
}
//---------------------------------------------------------------------------
void __fastcall TForm_Preview::FormCanResize(TObject *Sender,
int &NewWidth, int &NewHeight, bool &Resize)
{
if(NewWidth <297 || NewHeight < 210) Resize = false;
else Resize = true;
}
//---------------------------------------------------------------------------
void __fastcall TForm_Preview::Button_ReturnClick(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm_Preview::Button_Infact_SizeClick(TObject *Sender)
{
double R;
R=Form_Preview->PixelsPerInch/25.4;
Form_Preview->ClientWidth = 297 * R;
Form_Preview->ClientHeight = 210 * R;
}
//---------------------------------------------------------------------------
void __fastcall TForm_Preview::FormClose(TObject *Sender,
TCloseAction &Action)
{
Button_Infact_SizeClick(this);
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -