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

📄 vmreportpage.cpp

📁 TOOL (Tiny Object Oriented Language) is an easily-embedded, object-oriented, C++-like-language inter
💻 CPP
📖 第 1 页 / 共 5 页
字号:

       DESCRIPTION:  Prints using data supplied as return value from user function

             INPUT:  row - Location Coordinates in inches
                     col - Location Coordinates in inches
                     ID - ID to be supplied to user function
            OUTPUT:  

           RETURNS:  The next print line location in inches using the current 
                     font size and line spacing
*/
double VMPage::Print( double row, double col, int ID )
{
  if ( pUserFunc == NULL )
  {
    return( 0 );
  }

  ConvertPosition( row, col );

  m_PrtDesc.rc.top = (int)row;

  int res = Print( pUserFunc( ID ),(int)col, m_PrtDesc.uTextFlags, m_PrtDesc.PointSize );

  int nLineSpacing = m_Spacing > 1 
    ? (int)( ConvertToMappedUnits( m_PrtDesc.PointSize / 72.0, VERTRES ) * ( m_Spacing - 1 ) )
    : 0;

  return( ConvertToInches( res + nLineSpacing, VERTRES ) );
}
/* End of function "VMPage::Print"
/*****************************************************************************/


/*****************************************************************************/
/*

     FUNCTION NAME:  VMPage::Print

       DESCRIPTION:  Prints by calling user defined function for data

             INPUT:  row - Location Coordinates in logical units
                     col - Location Coordinates in logical units
                     TextFlags - 
                     PointSize - 
                     ID - message to pass to the user function
            OUTPUT:  

           RETURNS:  The next logical print line using the current font 
                     size and line spacing 
*/
int VMPage::Print( int row, int col, UINT TextFlags, int PointSize, int ID )
{
  if ( pUserFunc == NULL )
  {
    return( 0 );
  }

  m_PrtDesc.rc.top = row;

  int res = Print( pUserFunc( ID ), col, TextFlags, PointSize );

  int nLineSpacing = m_Spacing > 1 
    ? (int)( ConvertToMappedUnits( m_PrtDesc.PointSize / 72.0, VERTRES ) * ( m_Spacing - 1 ) )
    : 0;

  return( res + nLineSpacing );
}
/* End of function "VMPage::Print"
/*****************************************************************************/


/*****************************************************************************/
/*

     FUNCTION NAME:  VMPage::Print

       DESCRIPTION:  Prints by calling user defined function for data

             INPUT:  row - Location Coordinates in inches
                     col - Location Coordinates in inches
                     TextFlags - 
                     PointSize - 
                     ID - message to pass to the user function
            OUTPUT:  

           RETURNS:  The next print location in inches using the current font 
                     size and line spacing 
*/
double VMPage::Print(double row,double col,UINT TextFlags,int PointSize,int ID)
{
  if ( pUserFunc == NULL )
  {
    return( 0 );
  }

  ConvertPosition( row, col );

  m_PrtDesc.rc.top = (int)row;

  int res = Print( pUserFunc( ID ),(int)col, TextFlags, PointSize );

  int nLineSpacing = m_Spacing > 1 
    ? (int)( ConvertToMappedUnits( m_PrtDesc.PointSize / 72.0, VERTRES ) * ( m_Spacing - 1 ) )
    : 0;

  return( ConvertToInches( res + nLineSpacing, VERTRES ) );
}
/* End of function "VMPage::Print"
/*****************************************************************************/


/*****************************************************************************/
/*

     FUNCTION NAME:  VMPage::Print

       DESCRIPTION:  Prints using printf variable length print arguments

             INPUT:  row - Location Coordinates in logical units
                     col - Location Coordinates in logical units
                     TextFlags - 
                     PointSize - 
                     fmt - format string
                     ... - arguments
            OUTPUT:  

           RETURNS:  The next logical print line using the current font size 
                     and line spacing 
*/
int VMPage::Print( int row, int col, UINT TextFlags, int PointSize, const char* fmt, ... )
{
  va_list t;
  va_start( t, fmt );
  vsprintf( Buffer, fmt, t );

  m_PrtDesc.rc.top = row;

  int res = Print( Buffer, col, TextFlags, PointSize );

  va_end( t );

  int nLineSpacing = m_Spacing > 1 
    ? (int)( ConvertToMappedUnits( m_PrtDesc.PointSize / 72.0, VERTRES ) * ( m_Spacing - 1 ) )
    : 0;

  return( res + nLineSpacing );
}
/* End of function "VMPage::Print"
/*****************************************************************************/


/*****************************************************************************/
/*

     FUNCTION NAME:  VMPage::Print

       DESCRIPTION:  Prints using printf variable length print arguments

             INPUT:  row - Location Coordinates in inches
                     col - Location Coordinates in inches
                     TextFlags - 
                     PointSize - 
                     fmt - format string
                     ... - arguments
            OUTPUT:  

           RETURNS:  The next print line location in inches using the current
                     font size and line spacing 
*/
double VMPage::Print( double row, double col, UINT TextFlags, int PointSize, const char* fmt, ... )
{
  va_list t;
  va_start( t, fmt );
  vsprintf( Buffer, fmt, t );

  ConvertPosition( row, col );
  m_PrtDesc.rc.top = (int)row;

  int res = Print( Buffer, (int)col, TextFlags, PointSize );

  va_end( t );

  int nLineSpacing = m_Spacing > 1 
    ? (int)( ConvertToMappedUnits( m_PrtDesc.PointSize / 72.0, VERTRES ) * ( m_Spacing - 1 ) )
    :0;

  return( ConvertToInches( res + nLineSpacing, VERTRES ) );
}
/* End of function "VMPage::Print"
/*****************************************************************************/


/*****************************************************************************/
/*

     FUNCTION NAME:  VMPage::Print

       DESCRIPTION:  Same as above except col is a pointer and is updated 
                     to the next logical print column

             INPUT:  row - Location Coordinates in inches
                     col - Location Coordinates in inches
                     TextFlags - 
                     PointSize - 
                     fmt - format string
                     ... - arguments
            OUTPUT:  

           RETURNS:  The next print line location in inches using the current
                     font size and line spacing 
*/
double VMPage::Print( double row, double* col, UINT TextFlags, int PointSize, const char* fmt, ... )
{
  va_list t;
  va_start( t, fmt );
  vsprintf( Buffer, fmt, t );

  ConvertPosition( row, *col );

  m_PrtDesc.rc.top = (int)row;

  int res = Print( Buffer, (int)(*col), TextFlags, PointSize );

  va_end( t );

  *col = GetNextLogicalColumn();

  int nLineSpacing = m_Spacing > 1 
    ? (int)( ConvertToMappedUnits( m_PrtDesc.PointSize / 72.0, VERTRES ) * ( m_Spacing - 1 ) )
    : 0;

  return( ConvertToInches( res + nLineSpacing, VERTRES ) );
}
/* End of function "VMPage::Print"
/*****************************************************************************/


/*****************************************************************************/
/*

     FUNCTION NAME:  VMPage::Print

       DESCRIPTION:  Same as above except col is a pointer and is updated 
                     to the next logical print column

             INPUT:  row - Location Coordinates in inches
                     col - Location Coordinates in inches
                     TextFlags - 
                     PointSize - 
                     fmt - format string
                     ... - arguments
            OUTPUT:  

           RETURNS:  The next print line location in inches using the current
                     font size and line spacing 
*/
int VMPage::Print( int row, int* col, UINT TextFlags, int PointSize, const char* fmt, ... )
{
  va_list t;
  va_start( t, fmt );
  vsprintf( Buffer, fmt, t );

  m_PrtDesc.rc.top = row;

  int res = Print( Buffer, *col, TextFlags, PointSize );

  va_end( t );

  *col=(int)GetNextLogicalColumn( FALSE );

  int nLineSpacing = m_Spacing > 1 
    ? (int)( ConvertToMappedUnits( m_PrtDesc.PointSize / 72.0, VERTRES ) * ( m_Spacing - 1 ) ) 
    : 0;

  return( res + nLineSpacing );
}
/* End of function "VMPage::Print"
/*****************************************************************************/


/*****************************************************************************/
/*

     FUNCTION NAME:  VMPage::Print

       DESCRIPTION:  Prints into region using printf variable length print arguments

             INPUT:  pRegion - 
                     row - 
                     col - 
                     TextFlags - 
                     PointSize - 
                     fmt - 
                     ... - 
            OUTPUT:  

           RETURNS:  The next region print location in logical coordinates using
                     the current font size and line spacing 
*/
int VMPage::Print( VMPrintRegion* pRegion, int row, int col, UINT TextFlags, int PointSize, const char* fmt, ... )
{
  UINT  OldMode;
  UINT  OldColor;

  va_list t;

  SaveState();

  va_start( t, fmt );
  vsprintf( Buffer, fmt, t );

  m_PrtDesc.rc.top = row + pRegion->FirstY;

  m_PrtDesc.rc.bottom = pRegion->bottom;
  m_PrtDesc.rc.right  = pRegion->right;
  m_PrtDesc.rc.left   = pRegion->FirstX;

  if ( pRegion->FillColor > FILL_NONE )
  {
    OldMode = m_PrtDesc.pDC->SetBkMode( TRANSPARENT );     
  }

  if ( pRegion->FillColor > FILL_LTGRAY )
  {
    OldColor = SetColor( COLOR_WHITE );     
  }

  int res = Print( Buffer, col + pRegion->FirstX, TextFlags, PointSize );

  va_end( t );

  if ( pRegion->FillColor > FILL_NONE )
  {
    m_PrtDesc.pDC->SetBkMode( OldMode );     
  }

  if ( pRegion->FillColor > FILL_LTGRAY )
  {
    SetColor( OldColor );     
  }

  int nLineSpacing = m_Spacing > 1 
    ? (int)( ConvertToMappedUnits( m_PrtDesc.PointSize / 72.0, VERTRES ) * ( m_Spacing - 1 ) )
    : 0;

  RestoreState();

  return( ( res - pRegion->FirstY ) + nLineSpacing );
}
/* End of function "VMPage::Print"
/*****************************************************************************/


/*****************************************************************************/
/*

     FUNCTION NAME:  VMPage::Print

       DESCRIPTION:  Prints into region using printf variable length print arguments

             INPUT:  pRegion - 
                     row - 
                     col - 
                     TextFlags - 
                     PointSize - 
                     fmt - 
                     ... - 
            OUTPUT:  

           RETURNS:  The next region print location in inches using the current
                     font size and line spacing 
*/
double VMPage::Print( VMPrintRegion* pRegion, double row, double col, UINT TextFlags, int PointSize, const char* fmt, ... )
{
  UINT  OldColor;
  UINT  OldMode;

  va_list t;

  SaveState();

  va_start( t, fmt );
  vsprintf( Buffer, fmt, t );

  ConvertPosition( row, col );

  m_PrtDesc.rc.top = (int)row + pRegion->FirstY;

  m_PrtDesc.rc.bottom = pRegion->bottom;
  m_PrtDesc.rc.right  = pRegion->right;
  m_PrtDesc.rc.left   = pRegion->FirstX;

  if ( pRegion->FillColor > FILL_NONE )
  {
    OldMode = m_PrtDesc.pDC->SetBkMode( TRANSPARENT );     
  }

  if ( pRegion->FillColor > FILL_LTGRAY )
  {
    OldColor = SetColor( COLOR_WHITE );     
  }

  int res = Print( Buffer, (int)col + pRegion->FirstX, TextFlags, PointSize );

  va_end( t );

  if ( pRegion->FillColor > FILL_NONE )
  {
    m_PrtDesc.pDC->SetBkMode( OldMode );     
  }

  if ( pRegion->FillColor > FILL_LTGRAY )
  {
    SetColor( OldColor );     
  }

  int nLineSpacing = m_Spacing > 1 
    ? (int)( ConvertToMappedUnits( m_PrtDesc.PointSize / 72.0, VERTRES ) * ( m_Spacing - 1 ) )
    : 0;

  RestoreState();

  return( ConvertToInches( (int)( ( res-pRegion->FirstY ) + nLineSpacing ),VERTRES ) );
}
/* End of function "VMPage::Print"
/*****************************************************************************/


/*****************************************************************************/
/*

     FUNCTION NAME:  VMPage::Print

       DESCRIPTION:  Prints into a region using user defined function for data

             INPUT:  pRegion - 
                     row - 
                     col - 
                     TextFlags - 
                     PointSize - 
                     ID - 
            OUTPUT:  

           RETURNS:  The next logical print line using the current font size 
                     and line spacing 
*/
int VMPage::Print( VMPrintRegion* pRegion, int row, int col, UINT TextFlags, int PointSize, int ID )
{
  UINT OldColor;
  UINT OldMode;

  if ( pUserFunc == NULL )
  {
    return( 0 );
  }

  SaveState();

  m_PrtDesc.rc.top = row + pRegion->FirstY;

  m_PrtDesc.rc.bottom = pRegion->bottom;
  m_PrtDesc.rc.right  = pRegion->right;
  m_PrtDesc.rc.left   = pRegion->FirstX;

  if ( pRegion->FillColor > FILL_NONE )
  {
    OldMode = m_PrtDesc.pDC->SetBkMode( TRANSPARENT );     
  }
  
  if ( pRegion->FillColor > FILL_LTGRAY )
  {
    OldColor= SetColor( COLOR_WHITE );     
  }

  int res = Print( pUserFunc( ID ), col + pRegion->FirstX, TextFlags, PointSize );

  if ( pRegion->FillColor > FILL_NONE )
  {
    m_PrtDesc.pDC->SetBkMode( OldMode );     
  }
  
  if ( pRegion->FillColor > FILL_LTGRAY )
  {
    SetColor( OldColor );     
  }

  int nLineSpacing = m_Spacing > 1 
    ? (int)( ConvertToMappedUnits( m_PrtDesc.PointSize / 72.0, VERTRES ) * ( m_Spacing - 1 ) )
    : 0;

  RestoreState();

  return( ( res - pRegion->FirstY ) + nLineSpacing );

⌨️ 快捷键说明

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