Ejemplo n.º 1
0
        private float PrintChild(Panel _panel, float _intX, float _intY, int _fullwidth, System.Drawing.Printing.PrintPageEventArgs e)
        {
            float _ret, _result = 0;
            float intX = _intX;
            float intY = _intY;

            for (int i = _panel.Controls.Count; i > 0; i--)
            {
                _ret = _lineHeight;
                object _uc = _panel.Controls[i - 1];
                if (_uc.GetType() == typeof(SinoSZUC_RecordData))
                {
                    //标题栏
                    SinoSZUC_RecordData _mc = (SinoSZUC_RecordData)_uc;
                    if (++_currentNum > _finishNum)
                    {
                        _ret     = _mc.Print(intX, intY, e, _lineHeight, _fullwidth, _lineFont);
                        intY    += _ret;
                        _result += _ret;
                    }
                }


                if (intY > (e.MarginBounds.Top + e.MarginBounds.Height))
                {
                    e.HasMorePages = true;
                    _finishNum     = _currentNum;
                    return(_result);
                }
            }
            return(_result);
        }
Ejemplo n.º 2
0
        private void PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            float _ret;
            float leftMargin = e.MarginBounds.Left;
            float topMargin  = e.MarginBounds.Top;

            int fullWidth = e.MarginBounds.Width;

            float intX = leftMargin;
            float intY = topMargin;

            _currentNum = 0;

            for (int i = _panel.Controls.Count; i > 0; i--)
            {
                SinoSZUC_RecordData _currentRecordData = null;
                _ret = _lineHeight;
                object _uc = _panel.Controls[i - 1];
                if (_uc.GetType() == typeof(SinoSZUC_RecordData))
                {
                    //标题栏
                    _currentRecordData = (SinoSZUC_RecordData)_uc;

                    if (++_currentNum > _finishNum)
                    {
                        _ret  = _currentRecordData.Print(intX, intY, e, _lineHeight, fullWidth, _lineFont);
                        intY += _ret;
                    }
                }


                if (_uc.GetType() == typeof(Panel))
                {
                    Panel _pc = (Panel)_uc;
                    if (_pc.Visible)
                    {
                        _ret  = PrintChild(_pc, intX, intY, fullWidth, e);
                        intY += _ret;
                    }
                }

                if (intY > (e.MarginBounds.Top + e.MarginBounds.Height))
                {
                    e.HasMorePages = true;
                    _finishNum     = _currentNum;
                    intY           = topMargin;
                    return;
                }
            }
            _finishNum = 0;
        }