473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How can I print what I have drawn on a component..

I am using a "panel" component as a canvas to draw some graphics. How
can I print what’s on the panel component. Thanks in advance for your
help.

William Cruz

*** Sent via Developersdex http://www.developersdex.com ***
Dec 23 '05 #1
2 860
"William Cruz" <wc*****@msn.com> schrieb:
I am using a "panel" component as a canvas to draw some graphics. How
can I print what's on the panel component.


\\\
Private Sub Panel1_Paint( _
ByVal sender As Object, _
ByVal e As PaintEventArgs _
) Handles Panel1.Paint
e.Graphics.DrawLine( _
Pens.Red, _
0, 0, _
Me.Panel1.ClientSize.Width, Me.Panel1.ClientSize.Height _
)
e.Graphics.DrawLine( _
Pens.Red, _
0, Me.Panel1.ClientSize.Height, _
Me.Panel1.ClientSize.Width, 0 _
)
End Sub

Private WithEvents m_PrintDocument As PrintDocument

Private Sub ButtonPrint_Click(...) Handles Button1.Click
m_PrintDocument = New PrintDocument
m_PrintDocument.Print()
End Sub

Private Sub m_PrintDocument_PrintPage( _
ByVal sender As Object, _
ByVal e As PrintPageEventArgs _
) Handles m_PrintDocument.PrintPage
Dim mi As MethodInfo = _
Me.Panel1.GetType().GetMethod( _
"OnPaint", _
BindingFlags.Instance Or BindingFlags.NonPublic _
)
mi.Invoke( _
Me.Panel1, _
New Object() { _
New PaintEventArgs(e.Graphics, New Rectangle(0, 0, 0, 0)) _
} _
)
End Sub
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Dec 23 '05 #2
This works awesome, thanks. Now one more question. Currently the image
prints @ the top left corner of the page. How can I gain control of
location of the print out. Another thing, on the image, I have some
text_box’s that I also want to print but only the image prints & not the
text_box. Thanks.

William Cruz

*** Sent via Developersdex http://www.developersdex.com ***
Dec 24 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: mark | last post by:
I'm trying to do something like this: <?php foreach($apples as $key => $value){ print("<td class=<?php if ($myvar==$key){print (class1);} else {print (class2);} ?>>$value</td>"); } ?>
1
by: CrazyCoder | last post by:
Dear all, I'm trying to find the solution where to print my reports without using IE's print functions. Most of my required report needs to print out 'clean' ...... I checked around with...
1
by: Jordan | last post by:
I have written a small C# application that will print out labels from a little label printer we have. However the size (how long the label is) is determined by a database call. I need to...
1
by: greg7224 | last post by:
I am currently working on a C# project that uses the Janus schedule controls, and am having trouble getting it to print correctly in Day view. The problem is that it will not print out the owners...
0
by: Brian Henry | last post by:
Ok whats going on here... got a couple problems... this is relevant now to this group since .NET 2.0 is finally RTM 1) draws really slow when making it a large form (resizing speed is jerky) to...
3
by: Jeff Mason | last post by:
Hi, I'm looking for a component or code which will allow me to print an existing PDF file from a VB.NET app. I need the ability to specify the PDF file and the printer name on which it is to...
0
by: Brian Henry | last post by:
I cant seem to remember this one... I have a list view, and im owner drawing the items, i dont want the selection to hide when it loses focus so i have hideselection = false, but when i owner draw...
1
by: kiergaro | last post by:
I understand there is no way for the Server to see the Client printers, but I have a routine that generates a bunch of bar codes on a page and keeps it stored in a Graphics variable. Is there any...
4
by: Robson Felix | last post by:
It may sound like a silly question, but I would like to print a form or component from within Visual Studio when designing such form component. Is that possible?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.