Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > .NET Framework > Forum > VB.NET ไม่ทรายว่าตัว Print Preview Dialog สามารถเพิ่มรูปภาพเข้าไปได้ไหหมครับ



 

VB.NET ไม่ทรายว่าตัว Print Preview Dialog สามารถเพิ่มรูปภาพเข้าไปได้ไหหมครับ

 



Topic : 129605



โพสกระทู้ ( 2 )
บทความ ( 0 )



สถานะออฟไลน์




พอดีผมทำให้มีสั่งปริ้นหลังจากกดซื้อสินค้า คล้ายๆออกใบเสร็จอยากจะให้มีโลโก้บริษํท

อยากทราบว่าสามารถ insert รูปภาพได้ไหมครับ

ถ้าได้ต้องใช้โค้ดยังไงหว่า

ขอบคุณครับ



Tag : .NET, Ms SQL Server 2008, VBScript, VB.NET







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2017-11-29 14:27:07 By : bankwwe999 View : 3527 Reply : 1
 

 

No. 1



โพสกระทู้ ( 23 )
บทความ ( 0 )



สถานะออฟไลน์


How to print images, pictures, texts and high quality barcodes using VB.NET or C#
Requirements
# Neodynamic Barcode Professional 6.0 for Windows Forms (WinControl)
# Microsoft .NET Framework (any version)
# Microsoft Visual Studio .NET (any version) or Microsoft Visual Basic Express or Visual C# Express Editions
------------------------------------------------------------------
In this guide you will learn how to print images or pictures, texts and barcodes by using Barcode Professional and .NET PrintDocument class.

The following sample code prints a fictitious coupon featuring the company logo, coupon info as well as barcode. To reproduce the sample app, please follow these steps:
------------------------------------------------------------------
NOTE
Please download the following image to C:\temp folder before running the sample code.
image1
------------------------------------------------------------------
#Open Visual Studio and create a new Windows Forms app using your preferred .NET language VB or C#
#In your project add a reference to Neodynamic.WinControls.BarcodeProfessional.dll
#Open the default form in design view and drag & drop a Button control, a PrintDialog and PrintDocument components from VS toolbox
#Double-click on the Button control and paste the following code inside the button's Click event handler
Code (VB.NET)
'show print dialog...
If printDialog1.ShowDialog() = DialogResult.OK Then
    'set printer settings on printdocument object
    printDocument1.PrinterSettings = printDialog1.PrinterSettings
    'print...
    printDocument1.Print()
End If


Code (C#)
//show print dialog...
if (printDialog1.ShowDialog() == DialogResult.OK)
{
    //set printer settings on printdocument object
    printDocument1.PrinterSettings = printDialog1.PrinterSettings;
    //print...
    printDocument1.Print();
}

------------------------------------------------------------------
#Back to the form design view and now double-click on the PrintDocument component. In the code behind class, paste the following code inside the PrintDocument's PrintPage event handler
Code (VB.NET)
'printing barcode coupon...
  
'1. Print the company logo and % for coupon...
Dim logo As Image = Image.FromFile(@"C:\temp\AWCoupon.jpg")
e.Graphics.DrawImage(logo, New Point(0, 0))
logo.Dispose()
  
'2. Print barcode...
Dim barcode As New Neodynamic.WinControls.BarcodeProfessional.BarcodeProfessional()
  
'set barcode symbology... eg Code 128
barcode.Symbology = Neodynamic.WinControls.BarcodeProfessional.Symbology.Code128
'set barcode bars dimensions...
barcode.BarcodeUnit = Neodynamic.WinControls.BarcodeProfessional.BarcodeUnit.Inch
barcode.BarWidth = 0.015
barcode.BarHeight = 0.75
'set value to encode... this time a random value...
barcode.Code = Guid.NewGuid().ToString().ToUpper().Substring(0, 16)
'justify text...
barcode.CodeAlignment = Neodynamic.WinControls.BarcodeProfessional.Alignment.BelowJustify
'set font for barcode human readable text...
Dim fnt As New Font("Courier New", 10F)
barcode.Font = fnt
fnt.Dispose()
'print barcode below logo...
'IMPORTANT: barcode location unit depends on BarcodeUnit setting which in this case is INCH
barcode.DrawOnCanvas(e.Graphics, New PointF(0.1F, 1.5F))
  
'3. Print some texts...
Dim fnt1 As New Font("Arial", 12F, FontStyle.Bold)
Dim fnt2 As New Font("Arial", 8F, FontStyle.Regular)
    
e.Graphics.DrawString("RESELLER INTRUCTIONS", fnt1, Brushes.Black, New PointF(10F, 270F))
e.Graphics.DrawString("Use Item -% Off for the 15%. Scan coupon barcode or enter coupon code. Collect coupon with purchase as coupon may only be redeemed once per customer.", fnt2, Brushes.Black, New RectangleF(New PointF(10F, 290F), New SizeF(570F, 50F)))
  
e.Graphics.DrawString("COUPON OFFER DETAILS", fnt1, Brushes.Black, New PointF(10F, 350F))
e.Graphics.DrawString("This coupon can be redeemed once at any Adventure Works Cycles retail store." + Environment.NewLine + "This coupon is valid from May 21, 2009 to Jun 21, 2009.", fnt2, Brushes.Black, New RectangleF(New PointF(10F, 370F), New SizeF(570F, 50F)))
  
fnt1.Dispose()
fnt2.Dispose()


Code (C#)
//printing barcode coupon...
  
//1. Print the company logo and % for coupon...
using (Image logo = Image.FromFile(@"C:\temp\AWCoupon.jpg"))
{
    e.Graphics.DrawImage(logo, new Point(0, 0));
}
  
//2. Print barcode...
using (Neodynamic.WinControls.BarcodeProfessional.BarcodeProfessional barcode = new Neodynamic.WinControls.BarcodeProfessional.BarcodeProfessional())
{
    //set barcode symbology... eg Code 128
    barcode.Symbology = Neodynamic.WinControls.BarcodeProfessional.Symbology.Code128;
    //set barcode bars dimensions...
    barcode.BarcodeUnit = Neodynamic.WinControls.BarcodeProfessional.BarcodeUnit.Inch;
    barcode.BarWidth = 0.015;
    barcode.BarHeight = 0.75;
    //set value to encode... this time a random value...
    barcode.Code = Guid.NewGuid().ToString().ToUpper().Substring(0, 16);
    //justify text...
    barcode.CodeAlignment = Neodynamic.WinControls.BarcodeProfessional.Alignment.BelowJustify;
    //set font for barcode human readable text...
    using (Font fnt = new Font("Courier New", 10f))
    {
        barcode.Font = fnt;
    }
    //print barcode below logo...
    //IMPORTANT: barcode location unit depends on BarcodeUnit setting which in this case is INCH
    barcode.DrawOnCanvas(e.Graphics, new PointF(0.1f, 1.5f));
}
  
//3. Print some texts...
using (Font fnt1 = new Font("Arial", 12f, FontStyle.Bold))
{
    using (Font fnt2 = new Font("Arial", 8f, FontStyle.Regular))
    {
        e.Graphics.DrawString("RESELLER INTRUCTIONS", fnt1, Brushes.Black, new PointF(10f, 270f));
        e.Graphics.DrawString("Use Item -% Off for the 15%. Scan coupon barcode or enter coupon code. Collect coupon with purchase as coupon may only be redeemed once per customer.", fnt2, Brushes.Black, new RectangleF(new PointF(10f, 290f), new SizeF(570f, 50f)));
  
        e.Graphics.DrawString("COUPON OFFER DETAILS", fnt1, Brushes.Black, new PointF(10f, 350f));
        e.Graphics.DrawString("This coupon can be redeemed once at any Adventure Works Cycles retail store." + Environment.NewLine + "This coupon is valid from May 21, 2009 to Jun 21, 2009.", fnt2, Brushes.Black, new RectangleF(new PointF(10f, 370f), new SizeF(570f, 50f)));
    }
}


-------------------------------------------------------------------------------------
#That's it! Run the app, click on the button and after selecting a printer the following output should be printed out.
image2
A barcode coupon sample generated and printed by using Barcode Professional and PrintDocument
----------------------------------------------------------------------------------------
https://www.neodynamic.com/demo-faq/barcode-net/How-to-print-images-pictures-texts-and-high-quality-barcodes-VB-NET-C-sharp.aspx






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2017-11-30 21:20:17 By : Maka
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : VB.NET ไม่ทรายว่าตัว Print Preview Dialog สามารถเพิ่มรูปภาพเข้าไปได้ไหหมครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่