TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sundarvathul
NA
1
0
graphics.hdc
Sep 25 2003 5:38 PM
Hi, I have an image in a form that i have to print. so i am trying to graphics.hdc for it. I get an error "invalid handle" at Dim dc1 As IntPtr = g.GetHdc what is the reason for this. thanks in advance. Private Sub print_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintForm.Click Me.BuildFormImage(Me.PictureBox1.CreateGraphics) PrintDialog1.Document = PrintDocument1 If PrintDialog1.ShowDialog = DialogResult.OK Then PrintDocument1.Print() End If End Sub Private Sub BuildFormImage(ByVal g As Graphics) g.DrawImage(Me.PictureBox1.Image, 0, 0) Dim buf() As Byte Dim myStream As FileStream Dim myReader As BinaryReader Dim bytesRead As Integer Try Dim dc1 As IntPtr = g.GetHdc myStream = New FileStream(dc1, FileMode.Open) ' i get an error invalid handle at this point myReader = New BinaryReader(myStream) ReDim buf(LOF(1)) bytesRead = myReader.Read(buf, 0, buf.Length) g.ReleaseHdc(dc1) MsgBox("file not found") Catch ex As Exception MsgBox(ex.ToString) End Try End Sub Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage BuildFormImage(e.Graphics) End Sub
Reply
Answers (
1
)
Add-in : menu item doesn't aapeared in menu after install
Anyone notice DirectX 9.0b and Many Video Boards is simply not working as of Sept 30?