<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net%2FGUI%2FDialog_Print</id>
		<title>VB.Net/GUI/Dialog Print - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.vbex.ru/index.php?action=history&amp;feed=atom&amp;title=VB.Net%2FGUI%2FDialog_Print"/>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/GUI/Dialog_Print&amp;action=history"/>
		<updated>2026-04-05T15:52:55Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net/GUI/Dialog_Print&amp;diff=530&amp;oldid=prev</id>
		<title> в 16:40, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/GUI/Dialog_Print&amp;diff=530&amp;oldid=prev"/>
				<updated>2010-05-26T16:40:06Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 16:40, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://www.vbex.ru/index.php?title=VB.Net/GUI/Dialog_Print&amp;diff=531&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.vbex.ru/index.php?title=VB.Net/GUI/Dialog_Print&amp;diff=531&amp;oldid=prev"/>
				<updated>2010-05-26T12:44:22Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Common Dialog: FolderBrowser, Print, Color, Save, Open, Font Dialog==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Collections&lt;br /&gt;
Imports System.ruponentModel&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
Imports System.Data&lt;br /&gt;
Imports System.Configuration&lt;br /&gt;
Imports System.Resources&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Imports System.Drawing.Drawing2D&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Imports System.Drawing.Printing&lt;br /&gt;
&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
    Shared Sub Main()&lt;br /&gt;
        Dim myform As Form = New Dialogs()&lt;br /&gt;
        Application.Run(myform)&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
Public Class Dialogs&lt;br /&gt;
    &amp;quot;Declare variable&lt;br /&gt;
    Private strFileName As String&lt;br /&gt;
    Private objStreamToPrint As StreamReader&lt;br /&gt;
    Private objPrintFont As Font&lt;br /&gt;
    Private Sub btnOpen_Click(ByVal sender As Object, _&lt;br /&gt;
        ByVal e As System.EventArgs) Handles btnOpen.Click&lt;br /&gt;
        &amp;quot;Set the Open dialog properties&lt;br /&gt;
        With OpenFileDialog1&lt;br /&gt;
            .Filter = &amp;quot;Text files (*.txt)|*.txt|All files (*.*)|*.*&amp;quot;&lt;br /&gt;
            .FilterIndex = 1&lt;br /&gt;
            .Title = &amp;quot;Demo Open File Dialog&amp;quot;&lt;br /&gt;
        End With&lt;br /&gt;
        &amp;quot;Show the Open dialog and if the user clicks the Open button,&lt;br /&gt;
        &amp;quot;load the file&lt;br /&gt;
        If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then&lt;br /&gt;
            Dim allText As String&lt;br /&gt;
            Try&lt;br /&gt;
                &amp;quot;Save the file name&lt;br /&gt;
                strFileName = OpenFileDialog1.FileName&lt;br /&gt;
                &amp;quot;Read the contents of the file&lt;br /&gt;
                allText = My.ruputer.FileSystem.ReadAllText(strFileName)&lt;br /&gt;
                &amp;quot;Display the file contents in the TextBox&lt;br /&gt;
                txtFile.Text = allText&lt;br /&gt;
            Catch fileException As Exception&lt;br /&gt;
                Throw fileException&lt;br /&gt;
            End Try&lt;br /&gt;
        End If&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub btnSave_Click(ByVal sender As System.Object, _&lt;br /&gt;
        ByVal e As System.EventArgs) Handles btnSave.Click&lt;br /&gt;
        &amp;quot;Set the Save dialog properties&lt;br /&gt;
        With SaveFileDialog1&lt;br /&gt;
            .DefaultExt = &amp;quot;txt&amp;quot;&lt;br /&gt;
            .FileName = strFileName&lt;br /&gt;
            .Filter = &amp;quot;Text files (*.txt)|*.txt|All files (*.*)|*.*&amp;quot;&lt;br /&gt;
            .FilterIndex = 1&lt;br /&gt;
            .OverwritePrompt = True&lt;br /&gt;
            .Title = &amp;quot;Demo Save File Dialog&amp;quot;&lt;br /&gt;
        End With&lt;br /&gt;
        &amp;quot;Show the Save dialog and if the user clicks the Save button,&lt;br /&gt;
        &amp;quot;save the file&lt;br /&gt;
        If SaveFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then&lt;br /&gt;
            Try&lt;br /&gt;
                &amp;quot;Save the file name&lt;br /&gt;
                strFileName = SaveFileDialog1.FileName&lt;br /&gt;
                Dim filePath As String&lt;br /&gt;
                &amp;quot;Open or Create the file&lt;br /&gt;
                filePath = System.IO.Path.rubine( _&lt;br /&gt;
                    My.ruputer.FileSystem.SpecialDirectories.MyDocuments, _&lt;br /&gt;
                    strFileName)&lt;br /&gt;
                &amp;quot;Replace the contents of the file&lt;br /&gt;
                My.ruputer.FileSystem.WriteAllText(filePath, txtFile.Text, False)&lt;br /&gt;
            Catch fileException As Exception&lt;br /&gt;
                Throw fileException&lt;br /&gt;
            End Try&lt;br /&gt;
        End If&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub btnFont_Click(ByVal sender As System.Object, _&lt;br /&gt;
        ByVal e As System.EventArgs) Handles btnFont.Click&lt;br /&gt;
        &amp;quot;Set the FontDialog control properties&lt;br /&gt;
        FontDialog1.ShowColor = True&lt;br /&gt;
        &amp;quot;Show the Font dialog&lt;br /&gt;
        If FontDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then&lt;br /&gt;
            &amp;quot;If the OK button was clicked set the font&lt;br /&gt;
            &amp;quot;in the text box on the form&lt;br /&gt;
            txtFile.Font = FontDialog1.Font&lt;br /&gt;
            &amp;quot;Set the color of the font in the text box on the form&lt;br /&gt;
            txtFile.ForeColor = FontDialog1.Color&lt;br /&gt;
        End If&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub btnColor_Click(ByVal sender As System.Object, _&lt;br /&gt;
        ByVal e As System.EventArgs) Handles btnColor.Click&lt;br /&gt;
        &amp;quot;Show the Color dialog&lt;br /&gt;
        If ColorDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then&lt;br /&gt;
            &amp;quot;Set the BackColor property of the form&lt;br /&gt;
            Me.BackColor = ColorDialog1.Color&lt;br /&gt;
        End If&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub btnPrint_Click(ByVal sender As System.Object, _&lt;br /&gt;
        ByVal e As System.EventArgs) Handles btnPrint.Click&lt;br /&gt;
        &amp;quot;Declare an object for the PrintDocument class&lt;br /&gt;
        Dim objPrintDocument As PrintDocument = New PrintDocument()&lt;br /&gt;
        &amp;quot;Set the DocumentName property&lt;br /&gt;
        objPrintDocument.DocumentName = &amp;quot;Text File Print Demo&amp;quot;&lt;br /&gt;
        PrintDialog1.AllowPrintToFile = False&lt;br /&gt;
        PrintDialog1.AllowSelection = False&lt;br /&gt;
        PrintDialog1.AllowSomePages = False&lt;br /&gt;
        PrintDialog1.Document = objPrintDocument&lt;br /&gt;
        If PrintDialog1.ShowDialog() = DialogResult.OK Then&lt;br /&gt;
            objStreamToPrint = New StreamReader(strFileName)&lt;br /&gt;
            objPrintFont = New Font(&amp;quot;Arial&amp;quot;, 10)&lt;br /&gt;
            AddHandler objPrintDocument.PrintPage, _&lt;br /&gt;
                AddressOf objPrintDocument_PrintPage&lt;br /&gt;
            objPrintDocument.PrinterSettings = PrintDialog1.PrinterSettings&lt;br /&gt;
            objPrintDocument.Print()&lt;br /&gt;
            objStreamToPrint.Close()&lt;br /&gt;
            objStreamToPrint = Nothing&lt;br /&gt;
        End If&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub objPrintDocument_PrintPage(ByVal sender As Object, _&lt;br /&gt;
        ByVal e As System.Drawing.Printing.PrintPageEventArgs)&lt;br /&gt;
        Dim sngLinesPerpage As Single = 0&lt;br /&gt;
        Dim sngVerticalPosition As Single = 0&lt;br /&gt;
        Dim intLineCount As Integer = 0&lt;br /&gt;
        Dim sngLeftMargin As Single = e.MarginBounds.Left&lt;br /&gt;
        Dim sngTopMargin As Single = e.MarginBounds.Top&lt;br /&gt;
        Dim strLine As String&lt;br /&gt;
        sngLinesPerpage = _&lt;br /&gt;
           e.MarginBounds.Height / objPrintFont.GetHeight(e.Graphics)&lt;br /&gt;
        strLine = objStreamToPrint.ReadLine()&lt;br /&gt;
        While (intLineCount &amp;lt; sngLinesPerpage And Not (strLine Is Nothing))&lt;br /&gt;
            sngVerticalPosition = sngTopMargin + _&lt;br /&gt;
                (intLineCount * objPrintFont.GetHeight(e.Graphics))&lt;br /&gt;
            e.Graphics.DrawString(strLine, objPrintFont, Brushes.Black, _&lt;br /&gt;
                sngLeftMargin, sngVerticalPosition, New StringFormat())&lt;br /&gt;
            intLineCount = intLineCount + 1&lt;br /&gt;
            If (intLineCount &amp;lt; sngLinesPerpage) Then&lt;br /&gt;
                strLine = objStreamToPrint.ReadLine()&lt;br /&gt;
            End If&lt;br /&gt;
        End While&lt;br /&gt;
        If (strLine &amp;lt;&amp;gt; Nothing) Then&lt;br /&gt;
            e.HasMorePages = True&lt;br /&gt;
        Else&lt;br /&gt;
            e.HasMorePages = False&lt;br /&gt;
        End If&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub btnBrowse_Click(ByVal sender As System.Object, _&lt;br /&gt;
        ByVal e As System.EventArgs) Handles btnBrowse.Click&lt;br /&gt;
        FolderBrowserDialog1.Description = &amp;quot;Select a folder for your backups:&amp;quot;&lt;br /&gt;
        FolderBrowserDialog1.RootFolder = Environment.SpecialFolder.MyComputer&lt;br /&gt;
        FolderBrowserDialog1.ShowNewFolderButton = False&lt;br /&gt;
        If FolderBrowserDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then&lt;br /&gt;
            &amp;quot;Display the selected folder&lt;br /&gt;
            txtFile.Text = FolderBrowserDialog1.SelectedPath&lt;br /&gt;
        End If&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Global.Microsoft.VisualBasic.rupilerServices.DesignerGenerated()&amp;gt; _&lt;br /&gt;
Partial Public Class Dialogs&lt;br /&gt;
    Inherits System.Windows.Forms.Form&lt;br /&gt;
    &amp;quot;Form overrides dispose to clean up the component list.&lt;br /&gt;
    &amp;lt;System.Diagnostics.DebuggerNonUserCode()&amp;gt; _&lt;br /&gt;
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)&lt;br /&gt;
        If disposing AndAlso components IsNot Nothing Then&lt;br /&gt;
            components.Dispose()&lt;br /&gt;
        End If&lt;br /&gt;
        MyBase.Dispose(disposing)&lt;br /&gt;
    End Sub&lt;br /&gt;
    &amp;quot;Required by the Windows Form Designer&lt;br /&gt;
    Private components As System.ruponentModel.IContainer&lt;br /&gt;
    &amp;quot;NOTE: The following procedure is required by the Windows Form Designer&lt;br /&gt;
    &amp;quot;It can be modified using the Windows Form Designer.  &lt;br /&gt;
    &amp;quot;Do not modify it using the code editor.&lt;br /&gt;
    &amp;lt;System.Diagnostics.DebuggerStepThrough()&amp;gt; _&lt;br /&gt;
    Private Sub InitializeComponent()&lt;br /&gt;
        Me.txtFile = New System.Windows.Forms.TextBox&lt;br /&gt;
        Me.btnOpen = New System.Windows.Forms.Button&lt;br /&gt;
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog&lt;br /&gt;
        Me.btnSave = New System.Windows.Forms.Button&lt;br /&gt;
        Me.SaveFileDialog1 = New System.Windows.Forms.SaveFileDialog&lt;br /&gt;
        Me.btnFont = New System.Windows.Forms.Button&lt;br /&gt;
        Me.FontDialog1 = New System.Windows.Forms.FontDialog&lt;br /&gt;
        Me.btnColor = New System.Windows.Forms.Button&lt;br /&gt;
        Me.ColorDialog1 = New System.Windows.Forms.ColorDialog&lt;br /&gt;
        Me.btnPrint = New System.Windows.Forms.Button&lt;br /&gt;
        Me.PrintDialog1 = New System.Windows.Forms.PrintDialog&lt;br /&gt;
        Me.btnBrowse = New System.Windows.Forms.Button&lt;br /&gt;
        Me.FolderBrowserDialog1 = New System.Windows.Forms.FolderBrowserDialog&lt;br /&gt;
        Me.SuspendLayout()&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;txtFile&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.txtFile.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _&lt;br /&gt;
                    Or System.Windows.Forms.AnchorStyles.Left) _&lt;br /&gt;
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)&lt;br /&gt;
        Me.txtFile.Location = New System.Drawing.Point(8, 8)&lt;br /&gt;
        Me.txtFile.Multiline = True&lt;br /&gt;
        Me.txtFile.Name = &amp;quot;txtFile&amp;quot;&lt;br /&gt;
        Me.txtFile.ScrollBars = System.Windows.Forms.ScrollBars.Vertical&lt;br /&gt;
        Me.txtFile.Size = New System.Drawing.Size(352, 264)&lt;br /&gt;
        Me.txtFile.TabIndex = 0&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;btnOpen&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.btnOpen.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)&lt;br /&gt;
        Me.btnOpen.Location = New System.Drawing.Point(367, 8)&lt;br /&gt;
        Me.btnOpen.Name = &amp;quot;btnOpen&amp;quot;&lt;br /&gt;
        Me.btnOpen.Size = New System.Drawing.Size(75, 23)&lt;br /&gt;
        Me.btnOpen.TabIndex = 1&lt;br /&gt;
        Me.btnOpen.Text = &amp;quot;Open&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;OpenFileDialog1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.OpenFileDialog1.FileName = &amp;quot;OpenFileDialog1&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;btnSave&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.btnSave.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)&lt;br /&gt;
        Me.btnSave.Location = New System.Drawing.Point(367, 38)&lt;br /&gt;
        Me.btnSave.Name = &amp;quot;btnSave&amp;quot;&lt;br /&gt;
        Me.btnSave.Size = New System.Drawing.Size(75, 23)&lt;br /&gt;
        Me.btnSave.TabIndex = 2&lt;br /&gt;
        Me.btnSave.Text = &amp;quot;Save&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;btnFont&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.btnFont.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)&lt;br /&gt;
        Me.btnFont.Location = New System.Drawing.Point(367, 68)&lt;br /&gt;
        Me.btnFont.Name = &amp;quot;btnFont&amp;quot;&lt;br /&gt;
        Me.btnFont.Size = New System.Drawing.Size(75, 23)&lt;br /&gt;
        Me.btnFont.TabIndex = 3&lt;br /&gt;
        Me.btnFont.Text = &amp;quot;Font&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;btnColor&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.btnColor.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)&lt;br /&gt;
        Me.btnColor.Location = New System.Drawing.Point(367, 98)&lt;br /&gt;
        Me.btnColor.Name = &amp;quot;btnColor&amp;quot;&lt;br /&gt;
        Me.btnColor.Size = New System.Drawing.Size(75, 23)&lt;br /&gt;
        Me.btnColor.TabIndex = 4&lt;br /&gt;
        Me.btnColor.Text = &amp;quot;Color&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;btnPrint&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.btnPrint.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)&lt;br /&gt;
        Me.btnPrint.Location = New System.Drawing.Point(367, 128)&lt;br /&gt;
        Me.btnPrint.Name = &amp;quot;btnPrint&amp;quot;&lt;br /&gt;
        Me.btnPrint.Size = New System.Drawing.Size(75, 23)&lt;br /&gt;
        Me.btnPrint.TabIndex = 5&lt;br /&gt;
        Me.btnPrint.Text = &amp;quot;Print&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;btnBrowse&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.btnBrowse.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)&lt;br /&gt;
        Me.btnBrowse.Location = New System.Drawing.Point(367, 158)&lt;br /&gt;
        Me.btnBrowse.Name = &amp;quot;btnBrowse&amp;quot;&lt;br /&gt;
        Me.btnBrowse.Size = New System.Drawing.Size(75, 23)&lt;br /&gt;
        Me.btnBrowse.TabIndex = 6&lt;br /&gt;
        Me.btnBrowse.Text = &amp;quot;Browse&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;FolderBrowserDialog1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.FolderBrowserDialog1.SelectedPath = &amp;quot;FolderBrowserDialog1&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Dialogs&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)&lt;br /&gt;
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font&lt;br /&gt;
        Me.ClientSize = New System.Drawing.Size(448, 277)&lt;br /&gt;
        Me.Controls.Add(Me.btnBrowse)&lt;br /&gt;
        Me.Controls.Add(Me.btnPrint)&lt;br /&gt;
        Me.Controls.Add(Me.btnColor)&lt;br /&gt;
        Me.Controls.Add(Me.btnFont)&lt;br /&gt;
        Me.Controls.Add(Me.btnSave)&lt;br /&gt;
        Me.Controls.Add(Me.btnOpen)&lt;br /&gt;
        Me.Controls.Add(Me.txtFile)&lt;br /&gt;
        Me.Name = &amp;quot;Dialogs&amp;quot;&lt;br /&gt;
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen&lt;br /&gt;
        Me.Text = &amp;quot;Dialogs&amp;quot;&lt;br /&gt;
        Me.ResumeLayout(False)&lt;br /&gt;
        Me.PerformLayout()&lt;br /&gt;
    End Sub&lt;br /&gt;
    Friend WithEvents txtFile As System.Windows.Forms.TextBox&lt;br /&gt;
    Friend WithEvents btnOpen As System.Windows.Forms.Button&lt;br /&gt;
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog&lt;br /&gt;
    Friend WithEvents btnSave As System.Windows.Forms.Button&lt;br /&gt;
    Friend WithEvents SaveFileDialog1 As System.Windows.Forms.SaveFileDialog&lt;br /&gt;
    Friend WithEvents btnFont As System.Windows.Forms.Button&lt;br /&gt;
    Friend WithEvents FontDialog1 As System.Windows.Forms.FontDialog&lt;br /&gt;
    Friend WithEvents btnColor As System.Windows.Forms.Button&lt;br /&gt;
    Friend WithEvents ColorDialog1 As System.Windows.Forms.ColorDialog&lt;br /&gt;
    Friend WithEvents btnPrint As System.Windows.Forms.Button&lt;br /&gt;
    Friend WithEvents PrintDialog1 As System.Windows.Forms.PrintDialog&lt;br /&gt;
    Friend WithEvents btnBrowse As System.Windows.Forms.Button&lt;br /&gt;
    Friend WithEvents FolderBrowserDialog1 As System.Windows.Forms.FolderBrowserDialog&lt;br /&gt;
End Class&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Display Print dialog==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
&amp;lt;source lang=&amp;quot;vbnet&amp;quot;&amp;gt;&lt;br /&gt;
Imports System&lt;br /&gt;
Imports System.Collections&lt;br /&gt;
Imports System.Data&lt;br /&gt;
Imports System.IO&lt;br /&gt;
Imports System.Xml.Serialization&lt;br /&gt;
Imports System.Windows.Forms&lt;br /&gt;
Imports System.Drawing&lt;br /&gt;
Imports System.Drawing.Drawing2D&lt;br /&gt;
Imports System.Drawing.Text&lt;br /&gt;
Imports System.Drawing.Printing&lt;br /&gt;
&lt;br /&gt;
Public Class MainClass&lt;br /&gt;
    Shared Sub Main()&lt;br /&gt;
       Dim form1 As Form = New Form1()&lt;br /&gt;
       Application.Run(form1) &lt;br /&gt;
     End Sub&lt;br /&gt;
End Class&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Public Class Form1&lt;br /&gt;
    Inherits System.Windows.Forms.Form&lt;br /&gt;
#Region &amp;quot; Windows Form Designer generated code &amp;quot;&lt;br /&gt;
    Public Sub New()&lt;br /&gt;
        MyBase.New()&lt;br /&gt;
        &amp;quot;This call is required by the Windows Form Designer.&lt;br /&gt;
        InitializeComponent()&lt;br /&gt;
        &amp;quot;Add any initialization after the InitializeComponent() call&lt;br /&gt;
    End Sub&lt;br /&gt;
    &amp;quot;Form overrides dispose to clean up the component list.&lt;br /&gt;
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)&lt;br /&gt;
        If disposing Then&lt;br /&gt;
            If Not (components Is Nothing) Then&lt;br /&gt;
                components.Dispose()&lt;br /&gt;
            End If&lt;br /&gt;
        End If&lt;br /&gt;
        MyBase.Dispose(disposing)&lt;br /&gt;
    End Sub&lt;br /&gt;
    Friend WithEvents PrintDocument1 As System.Drawing.Printing.PrintDocument&lt;br /&gt;
    Friend WithEvents Button1 As System.Windows.Forms.Button&lt;br /&gt;
    Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox&lt;br /&gt;
    &amp;quot;Required by the Windows Form Designer&lt;br /&gt;
    Private components As System.ruponentModel.Container&lt;br /&gt;
    &amp;quot;NOTE: The following procedure is required by the Windows Form Designer&lt;br /&gt;
    &amp;quot;It can be modified using the Windows Form Designer.  &lt;br /&gt;
    &amp;quot;Do not modify it using the code editor.&lt;br /&gt;
    &amp;lt;System.Diagnostics.DebuggerStepThrough()&amp;gt; Private Sub InitializeComponent()&lt;br /&gt;
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))&lt;br /&gt;
        Me.PrintDocument1 = New System.Drawing.Printing.PrintDocument()&lt;br /&gt;
        Me.Button1 = New System.Windows.Forms.Button()&lt;br /&gt;
        Me.PictureBox1 = New System.Windows.Forms.PictureBox()&lt;br /&gt;
        Me.SuspendLayout()&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;PrintDocument1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Button1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.Button1.Location = New System.Drawing.Point(16, 216)&lt;br /&gt;
        Me.Button1.Name = &amp;quot;Button1&amp;quot;&lt;br /&gt;
        Me.Button1.Size = New System.Drawing.Size(264, 32)&lt;br /&gt;
        Me.Button1.TabIndex = 0&lt;br /&gt;
        Me.Button1.Text = &amp;quot;Print&amp;quot;&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;PictureBox1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.PictureBox1.Image = New System.Drawing.Bitmap(&amp;quot;figure2.bmp&amp;quot;)&lt;br /&gt;
        Me.PictureBox1.Location = New System.Drawing.Point(16, 8)&lt;br /&gt;
        Me.PictureBox1.Name = &amp;quot;PictureBox1&amp;quot;&lt;br /&gt;
        Me.PictureBox1.Size = New System.Drawing.Size(264, 200)&lt;br /&gt;
        Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage&lt;br /&gt;
        Me.PictureBox1.TabIndex = 1&lt;br /&gt;
        Me.PictureBox1.TabStop = False&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        &amp;quot;Form1&lt;br /&gt;
        &amp;quot;&lt;br /&gt;
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15)&lt;br /&gt;
        Me.ClientSize = New System.Drawing.Size(292, 268)&lt;br /&gt;
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.PictureBox1, Me.Button1})&lt;br /&gt;
        Me.Name = &amp;quot;Form1&amp;quot;&lt;br /&gt;
        Me.Text = &amp;quot;Printing demo&amp;quot;&lt;br /&gt;
        Me.ResumeLayout(False)&lt;br /&gt;
    End Sub&lt;br /&gt;
#End Region&lt;br /&gt;
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, _&lt;br /&gt;
  ByVal e As System.Drawing.Printing.PrintPageEventArgs) _&lt;br /&gt;
  Handles PrintDocument1.PrintPage&lt;br /&gt;
        Dim g As Graphics&lt;br /&gt;
        g = e.Graphics&lt;br /&gt;
        g.DrawImage(PictureBox1.Image, 0, 0)&lt;br /&gt;
        g.Dispose()&lt;br /&gt;
        e.HasMorePages = False&lt;br /&gt;
    End Sub&lt;br /&gt;
    Private Sub Button1_Click(ByVal sender As System.Object, _&lt;br /&gt;
    ByVal e As System.EventArgs) Handles Button1.Click&lt;br /&gt;
        Dim PrintDialog1 As New PrintDialog()&lt;br /&gt;
        PrintDialog1.Document = PrintDocument1&lt;br /&gt;
        If PrintDialog1.ShowDialog() = DialogResult.OK Then&lt;br /&gt;
            PrintDocument1.Print()&lt;br /&gt;
        End If&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>