نمایش نتایج 1 تا 7 از 7

نام تاپیک: تنظیمات پرینتر

  1. #1
    کاربر تازه وارد آواتار amin mohamadi
    تاریخ عضویت
    فروردین 1389
    محل زندگی
    تهران
    پست
    57

    تنظیمات پرینتر

    با سلام خدمت اساتید محترم
    من توی برنامم از یه فرم عکس گرفتم و میخوام چاپ کنم
    فقط یه مشکل دارم که جوابشو جایی پیدا نکردم
    میخوام این عکس رو روی کاغذ A5 چاپ کنم بدون اینکه کاربر مجبور باشه خودش تنظیمات پرینترو انجام بده
    یعنی خودم با کد نویسی paper size رو تغییر بدم و بفرستم برای پرینت

    printDocument1.PrintPage += PDoc_PrintPage;
    System.Drawing.Printing.
    PaperSize a = new System.Drawing.Printing.PaperSize("A5", 148, 210);
    PageSettings ps = newPageSettings();
    ps.PaperSize = a;
    ps.Landscape =
    true;
    ps.Margins.Top = 10;
    ps.Margins.Bottom = 10;
    ps.Margins.Left = 5;
    ps.Margins.Right = 25;
    printDocument1.OriginAtMargins =
    true;
    printDocument1.DefaultPageSettings = ps;
    printDocument1.Print();

    همه چی درست کار میکنه جز a5

  2. #2

    نقل قول: تنظیمات پرینتر


  3. #3
    کاربر تازه وارد آواتار amin mohamadi
    تاریخ عضویت
    فروردین 1389
    محل زندگی
    تهران
    پست
    57

    نقل قول: تنظیمات پرینتر

    میشه دوباره چک کنید
    من که نتونستم برم

  4. #4
    کاربر تازه وارد آواتار amin mohamadi
    تاریخ عضویت
    فروردین 1389
    محل زندگی
    تهران
    پست
    57

    نقل قول: تنظیمات پرینتر

    اگه کسی پیدا بشه که کدشو بذاره ممنون میشم به همراه یکم توضیح
    printDocument1.PrinterSettings.PaperSizes با این نمیشه انگار نمیشه تغییرش داد پیغام read only میده

  5. #5

    نقل قول: تنظیمات پرینتر

    Help Msdn بود:

    // Add list of supported paper sizes found on the printer.
    // The DisplayMember property is used to identify the property that will provide the display string.
    comboPaperSize.DisplayMember = "PaperName";

    PaperSize pkSize;
    for (int i = 0; i < printDoc.PrinterSettings.PaperSizes.Count; i++){
    pkSize = printDoc.PrinterSettings.PaperSizes[i];
    comboPaperSize.Items.Add(pkSize);
    }

    // Create a PaperSize and specify the custom paper size through the constructor and add to combobox.
    PaperSize pkCustomSize1 = new PaperSize("First custom size", 100, 200);

    comboPaperSize.Items.Add(pkCustomSize1);



    ...


    // Add list of paper sources found on the printer to the combo box.
    // The DisplayMember property is used to identify the property that will provide the display string.
    comboPaperSource.DisplayMember="SourceName";

    PaperSource pkSource;
    for (int i = 0; i < printDoc.PrinterSettings.PaperSources.Count; i++){
    pkSource = printDoc.PrinterSettings.PaperSources[i];
    comboPaperSource.Items.Add(pkSource);
    }


    ...


    // Add list of printer resolutions found on the printer to the combobox.
    // The PrinterResolution's ToString() method will be used to provide the display string.

    PrinterResolution pkResolution;
    for (int i = 0; i < printDoc.PrinterSettings.PrinterResolutions.Count; i++){
    pkResolution = printDoc.PrinterSettings.PrinterResolutions[i];
    comboPrintResolution.Items.Add(pkResolution);
    }


    ...


    private void MyButtonPrint_Click(object sender, System.EventArgs e)
    {
    // Set the paper size based upon the selection in the combo box.
    if (comboPaperSize.SelectedIndex != -1) {
    printDoc.DefaultPageSettings.PaperSize =
    printDoc.PrinterSettings.PaperSizes[comboPaperSize.SelectedIndex];
    }

    // Set the paper source based upon the selection in the combo box.
    if (comboPaperSource.SelectedIndex != -1) {
    printDoc.DefaultPageSettings.PaperSource =
    printDoc.PrinterSettings.PaperSources[comboPaperSource.SelectedIndex];
    }

    // Set the printer resolution based upon the selection in the combo box.
    if (comboPrintResolution.SelectedIndex != -1)
    {
    printDoc.DefaultPageSettings.PrinterResolution=
    printDoc.PrinterSettings.PrinterResolutions[comboPrintResolution.SelectedIndex];
    }

    // Print the document with the specified paper size, source, and print resolution.
    printDoc.Print();
    }

  6. #6
    کاربر تازه وارد آواتار amin mohamadi
    تاریخ عضویت
    فروردین 1389
    محل زندگی
    تهران
    پست
    57

    نقل قول: تنظیمات پرینتر

    این کد کل سایز های پرینترو میگیره نمایش میده بعد باید یکیشو انتخاب کنی تا پرینت بگیره
    تقریبا مثل printdialog
    من میخوام بدون اینکه کاربر کاری بکنه تنظیمات انجام بشه

    System.Drawing.Printing.
    PaperSize a = new System.Drawing.Printing.PaperSize("A5", 148, 210);
    PageSettings ps = newPageSettings();
    ps.PaperSize = a;
    ps.Landscape =
    true;
    ps.Margins.Top = 30;
    ps.Margins.Bottom = 30;
    ps.Margins.Left = 5;
    ps.Margins.Right = 100;
    printDocument1.OriginAtMargins =
    true;
    printDocument1.DefaultPageSettings = ps;

    همه چی درست کار میکنه فقط سایز کاغذ A5 نمیشه

  7. #7
    کاربر تازه وارد آواتار amin mohamadi
    تاریخ عضویت
    فروردین 1389
    محل زندگی
    تهران
    پست
    57

    نقل قول: تنظیمات پرینتر

    درستش کردم فقط وقتی کار میکنه که پرینتر A5 رو ساپورت کنه
    یعنی تو تنظیماتش داشته باشه
    امیدوارم به درد یکی بخوره
    پرینت از فرم و چاپ در کاغذ A5

    private
    void PDoc_PrintPage(object sender, PrintPageEventArgs e)
    {
    this.FormBorderStyle = FormBorderStyle.None;
    Bitmap bmp = newBitmap(this.Width, this.Height);
    this.DrawToBitmap(bmp, newRectangle(0, 0, bmp.Width, bmp.Height));
    e.Graphics.DrawImage(bmp, 10, 10);
    e.Graphics.RotateTransform(90);
    this.FormBorderStyle = FormBorderStyle.Fixed3D;
    }
    privatevoid button8_Click(object sender, EventArgs e)
    {
    PrintDocument printDocument1 = newPrintDocument();
    printDocument1.PrintPage += PDoc_PrintPage;

    PageSettings ps = newPageSettings();

    for (int i = 0; i < printDocument1.PrinterSettings.PaperSizes.Count; i++)
    {
    if (printDocument1.PrinterSettings.PaperSizes[i].Kind.ToString() == "A5")
    {
    ps.PaperSize = printDocument1.PrinterSettings.PaperSizes[i];
    break;
    }
    }
    ps.Landscape =
    true;
    ps.Margins.Top = 30;
    ps.Margins.Bottom = 30;
    ps.Margins.Left = 20;
    ps.Margins.Right = 50;
    printDocument1.OriginAtMargins =
    true;
    printDocument1.DefaultPageSettings = ps;
    printDocument1.Print();

    }

تاپیک های مشابه

  1. سوال: تنظیمات پرینتر در ASP.NET
    نوشته شده توسط Emziper_just در بخش ASP.NET Web Forms
    پاسخ: 0
    آخرین پست: دوشنبه 22 اسفند 1390, 18:54 عصر
  2. پاسخ: 2
    آخرین پست: یک شنبه 13 آذر 1390, 21:47 عصر
  3. تنظیمات پرینتر
    نوشته شده توسط MKhrmat در بخش ابزارهای گزارشگیری در VB6
    پاسخ: 8
    آخرین پست: دوشنبه 31 فروردین 1388, 01:04 صبح
  4. تغییر تنظیمات پرینتر پیش فرض در FastReport
    نوشته شده توسط dkhatibi در بخش ابزارهای گزارش سازی در دلفی
    پاسخ: 0
    آخرین پست: پنج شنبه 22 آذر 1386, 20:48 عصر
  5. تغییر تنظیمات پرینتر و کاغذ
    نوشته شده توسط once4ever در بخش C#‎‎
    پاسخ: 11
    آخرین پست: سه شنبه 16 مرداد 1386, 13:52 عصر

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •