Пример #1
0
        private static void RaporDokum()
        {
            BaslikEkle();
            RaporuKagidaSigdir();
            _tablo.OptionsPrint.PrintHorzLines = _dp.YatayCizgileriGoster == COMMON.Enums.EvetHayir.Evet;
            _tablo.OptionsPrint.PrintVertLines = _dp.DikeyCizgileriGoster == COMMON.Enums.EvetHayir.Evet;
            _tablo.OptionsPrint.PrintHeader    = _dp.SutunBasliklariniGoster == COMMON.Enums.EvetHayir.Evet;
            _tablo.OptionsView.ShowViewCaption = false;

            _link.Component = _tablo.GridControl;
            _link.PaperKind = System.Drawing.Printing.PaperKind.Letter;
            _link.Margins   = new System.Drawing.Printing.Margins(59, 59, 115, 48);
            _link.CreateMarginalHeaderArea += _Link_CreateMarginalHeaderArea;
            _link.CreateDocument(_ps);

            switch (_dp.DokumSekli)
            {
            case COMMON.Enums.DokumSekli.TabloBaslikOnIzleme:
                ShowRibbonForms <RaporOnIzleme> .ShowForm(true, _ps, _dp.RaporBaslik);

                break;

            case COMMON.Enums.DokumSekli.TabloYazdir:
                for (int i = 0; i < _dp.YazdirilacakAdet; i++)
                {
                    _link.Print(_dp.YaziciAdi);
                }
                break;
            }

            _tablo.OptionsView.ShowViewCaption = true;
        }
        private static void PrintViaLink(IPrintable srv)
        {
            PrintableComponentLink link = new PrintableComponentLink(new PrintingSystem());

            link.Component = srv;
            // Disable warnings.
            link.PrintingSystem.ShowMarginsWarning    = false;
            link.PrintingSystem.ShowPrintStatusDialog = false;
            // Find a printer containing Canon in its name
            PrinterSettings settings    = new PrinterSettings();
            string          printerName = String.Empty;

            for (int i = 0; i < PrinterSettings.InstalledPrinters.Count; i++)
            {
                string pName = PrinterSettings.InstalledPrinters[i];
                if (pName.Contains("Canon"))
                {
                    printerName = pName;
                    break;
                }
            }
            // Print to the specified printer.
            link.Print(printerName);
        }