Click here to Skip to main content
15,887,135 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Mail Merge Question Pin
camatulli18-Apr-08 4:34
camatulli18-Apr-08 4:34 
GeneralAdding Metadata Using Visual Basic 2008 Pin
Harold_Wishes18-Apr-08 3:35
Harold_Wishes18-Apr-08 3:35 
GeneralRe: Adding Metadata Using Visual Basic 2008 Pin
Dave Kreskowiak18-Apr-08 4:27
mveDave Kreskowiak18-Apr-08 4:27 
GeneralPrinting Text File In Dot Matrix Printer Pin
Member 366452518-Apr-08 2:08
Member 366452518-Apr-08 2:08 
GeneralRe: Printing Text File In Dot Matrix Printer Pin
Dave Kreskowiak18-Apr-08 4:23
mveDave Kreskowiak18-Apr-08 4:23 
Questioncapture Pin
swathi chandra18-Apr-08 1:21
swathi chandra18-Apr-08 1:21 
GeneralRe: capture Pin
Smithers-Jones18-Apr-08 1:40
Smithers-Jones18-Apr-08 1:40 
GeneralRe: capture Pin
manavharsh18-Apr-08 3:24
manavharsh18-Apr-08 3:24 
you cant work with screen shot

this code will work out for coz this code will take control as bitmap

so if its works tell me if not i'll give some other suggesstion

manavharsh@yahoo.com my mail id
there is one more option to print the control also
its an vb.net code with vb

Imports System.Drawing.Printing
Imports System.Drawing.Imaging


Public Class Form1



Private m_PrintBitmap As Bitmap
Private WithEvents m_PrintDocument As PrintDocument

Private Declare Auto Function BitBlt Lib "gdi32.dll" (ByVal hdcDest As IntPtr, ByVal nXDest As Integer, ByVal nYDest As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hdcSrc As IntPtr, ByVal nXSrc As Integer, ByVal nYSrc As Integer, ByVal dwRop As System.Int32) As Boolean
Private Const SRCCOPY As Integer = &HCC0020

Private Function GetFormImage() As Bitmap
' Get this form's Graphics object.
Dim me_gr As Graphics = Me.CreateGraphics

' Make a Bitmap to hold the image.
Dim bm As New Bitmap(Me.ClientSize.Width, Me.ClientSize.Height, me_gr)
Dim bm_gr As Graphics = me_gr.FromImage(bm)
Dim bm_hdc As IntPtr = bm_gr.GetHdc

' Get the form's hDC. We must do this after
' creating the new Bitmap, which uses me_gr.
Dim me_hdc As IntPtr = me_gr.GetHdc

' BitBlt the form's image onto the Bitmap.
BitBlt(bm_hdc, 0, 0, Me.ClientSize.Width, Me.ClientSize.Height, _
me_hdc, 0, 0, SRCCOPY)
me_gr.ReleaseHdc(me_hdc)
bm_gr.ReleaseHdc(bm_hdc)

' Return the result.
Return bm
End Function


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


End Sub

Private Sub btnprint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnprint.Click
m_PrintBitmap = GetFormImage()

' Make a PrintDocument and print.
m_PrintDocument = New PrintDocument
m_PrintDocument.DefaultPageSettings.Landscape = True
m_PrintDocument.Print()

End Sub

Private Sub m_PrintDocument_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles m_PrintDocument.PrintPage
' Draw the image centered.
Dim x As Integer = e.MarginBounds.X + _
(e.MarginBounds.Width - m_PrintBitmap.Width) \ 2
Dim y As Integer = e.MarginBounds.Y + _
(e.MarginBounds.Height - m_PrintBitmap.Height) \ 2
e.Graphics.DrawImage(m_PrintBitmap, x, y)

' There's only one page.
e.HasMorePages = False
End Sub


End Class
QuestionQuick question on config file Pin
AHeavey17-Apr-08 23:54
AHeavey17-Apr-08 23:54 
GeneralRe: Quick question on config file Pin
Christian Graus18-Apr-08 0:34
protectorChristian Graus18-Apr-08 0:34 
GeneralRe: Quick question on config file Pin
AHeavey18-Apr-08 0:36
AHeavey18-Apr-08 0:36 
GeneralHelp with Integrating MS Word in VB.NET Pin
Jats_4ru17-Apr-08 23:27
Jats_4ru17-Apr-08 23:27 
GeneralRe: Help with Integrating MS Word in VB.NET Pin
parth.p18-Apr-08 0:19
parth.p18-Apr-08 0:19 
GeneralRe: Help with Integrating MS Word in VB.NET [modified] Pin
Jats_4ru18-Apr-08 1:53
Jats_4ru18-Apr-08 1:53 
GeneralRe: Help with Integrating MS Word in VB.NET Pin
parth.p18-Apr-08 2:46
parth.p18-Apr-08 2:46 
GeneralRe: Help with Integrating MS Word in VB.NET Pin
Jats_4ru18-Apr-08 3:14
Jats_4ru18-Apr-08 3:14 
QuestionHashing password, HOW ? Pin
masoodp66617-Apr-08 22:49
masoodp66617-Apr-08 22:49 
AnswerRe: Hashing password, HOW ? Pin
Guffa18-Apr-08 0:42
Guffa18-Apr-08 0:42 
GeneralRe: Hashing password, HOW ? [modified] Pin
Rob Smiley18-Apr-08 5:51
Rob Smiley18-Apr-08 5:51 
GeneralRe: Hashing password, HOW ? Pin
masoodp66618-Apr-08 8:02
masoodp66618-Apr-08 8:02 
GeneralRe: Hashing password, HOW ? Pin
Guffa18-Apr-08 12:06
Guffa18-Apr-08 12:06 
GeneralRe: Hashing password, HOW ? Pin
Rob Smiley18-Apr-08 23:33
Rob Smiley18-Apr-08 23:33 
QuestionString or binary data would be truncated. The statement has been terminated Pin
zaimah17-Apr-08 18:11
zaimah17-Apr-08 18:11 
GeneralRe: String or binary data would be truncated. The statement has been terminated Pin
Christian Graus17-Apr-08 19:46
protectorChristian Graus17-Apr-08 19:46 
GeneralRe: String or binary data would be truncated. The statement has been terminated Pin
darkelv17-Apr-08 19:48
darkelv17-Apr-08 19:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.