Exemplo n.º 1
0
        private void CetakTulisan(object sender, PrintPageEventArgs e)
        {
            int JumBarisPerHalaman = (int)((e.MarginBounds.Height - MarginBawah) / JenisFont.GetHeight(e.Graphics));

            float y = MarginAtas;

            int jumBaris = 0;

            string tulisanCetak = FileCetak.ReadLine();

            while (jumBaris < JumBarisPerHalaman && tulisanCetak != null)
            {
                y = MarginAtas + (jumBaris * jenisFont.GetHeight(e.Graphics));

                e.Graphics.DrawString(tulisanCetak, JenisFont, Brushes.Black, MarginKiri, y);

                jumBaris++;

                tulisanCetak = FileCetak.ReadLine();
            }

            if (tulisanCetak != null)
            {
                e.HasMorePages = true;
            }
            else
            {
                e.HasMorePages = false;
            }
        }
Exemplo n.º 2
0
        private void PrintLine(object sender, PrintPageEventArgs e)
        {
            int    totalrowsperpage = (int)((e.MarginBounds.Height - MarginBawah) / JenisFont.GetHeight(e.Graphics));
            float  y         = MarginAtas;
            int    totalrows = 0;
            string Line      = FilePrint.ReadLine();

            while (totalrows < totalrowsperpage && Line != null)
            {
                y = MarginAtas + (totalrows * JenisFont.GetHeight(e.Graphics));
                e.Graphics.DrawString(Line, JenisFont, Brushes.Black, MarginKiri, y);
                totalrows++;
                Line = FilePrint.ReadLine();
            }
            if (Line != null)
            {
                e.HasMorePages = true;
            }
            else
            {
                e.HasMorePages = false;
            }
        }