⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sampdest.cpp

📁 suite component ace report
💻 CPP
字号:
//---------------------------------------------------------------------------
#include <vcl\vcl.h>
#pragma hdrstop

#include "sampdest.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
TSampleDestination *SampleDestination;
//---------------------------------------------------------------------------
__fastcall TSampleDestination::TSampleDestination(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TSampleDestination::PrinterSetupClick(TObject *Sender)
{
  if (FormStyle == fsStayOnTop)
    SetWindowPos(Handle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE |
       SWP_NOSIZE | SWP_NOACTIVATE);

  PrintSetup->Execute();

  if (FormStyle == fsStayOnTop)
    SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE |
       SWP_NOSIZE | SWP_NOACTIVATE);

}
//---------------------------------------------------------------------------
void __fastcall TSampleDestination::FormShow(TObject *Sender)
{
  if (!PageSetup->AnyPrinters)
  {
    GoPrinter->Enabled = False;
    PrinterSetup->Enabled = False;
  }
  else
  {
    GoPrinter->Enabled = True;
    PrinterSetup->Enabled = True;
  }

  if (PageSetup->Destination == destPrinter) GoPrinter->Checked = True;
  else GoScreen->Checked = True;

  StartRange->Text = "";
  EndRange->Text = "";
  if (PageSetup->RangeStart > 0) StartRange->Text = IntToStr(PageSetup->RangeStart);
  if (PageSetup->RangeEnd > 0) EndRange->Text = IntToStr(PageSetup->RangeEnd);
  if ((PageSetup->RangeStart > 0) || (PageSetup->RangeEnd > 0)) RangePages->Checked = True;
  Copies->Text = IntToStr(PageSetup->Copies);

  if (PageSetup->AnyPrinters) PageSetup->LoadSettings();

}
//---------------------------------------------------------------------------
void __fastcall TSampleDestination::btnPrintClick(TObject *Sender)
{
  if (GoPrinter->Checked) PageSetup->Destination = destPrinter;
  else PageSetup->Destination = destScreen;

  if (RangeAll->Checked)
  {
    PageSetup->RangeStart = 0;
    PageSetup->RangeEnd = 0;
  } else
  {
    if (SctEmpty(StartRange->Text)) StartRange->Text = "0";
    if (SctEmpty(EndRange->Text)) EndRange->Text = "0";

    PageSetup->RangeStart = StrToInt(SctRightTrim(StartRange->Text));
    PageSetup->RangeEnd = StrToInt(SctRightTrim(EndRange->Text));
  }

  if (PageSetup->AnyPrinters) PageSetup->CopySettings();
  // the cast is just to suppress a compiler warning
  PageSetup->Copies = (TSctPaperCopies) StrToInt(SctRightTrim(Copies->Text));
// need to load settings back to windows so it knows to
// print the correct number of copies.
  if (PageSetup->AnyPrinters) PageSetup->LoadSettings();

}
//---------------------------------------------------------------------------
void __fastcall TSampleDestination::RangeAllClick(TObject *Sender)
{
  StartRange->Text = "";
  EndRange->Text = "";
  StartRange->Enabled = False;
  EndRange->Enabled = False;
}
//---------------------------------------------------------------------------
void __fastcall TSampleDestination::RangePagesClick(TObject *Sender)
{
  StartRange->Enabled = True;
  EndRange->Enabled = True;
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -