Solved

Combine several System.Drawing.Graphics into a new or existing Graphics object

Posted on 2007-03-30
3
396 Views
Last Modified: 2013-11-07
Is it possible to add/combine/merge several System.Drawing.Graphics objects into a new or existing Graphics object.

e.g. when using a printdocument and building the printout within the PrintPage and using e.Graphics, is it possible to have several graphics objects that I can combine into the e.Graphics object without making them into images first. purpose is to handle header, content, and footer in different sections when building the document.

Using:
DotNet 2.0
VS2005 / Csharp

/ Mikael
0
Comment
Question by:activephoto
  • 2
3 Comments
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 18824425
Not sure exactly what you are tyring to do here...

But you can pass the Graphics instance to another sub if you need to:

    Public Sub MakeHeader(ByVal G As Graphics)
        G.DrawString(....)
    End Sub

Just pass in "e.Graphics" from your PrintPage:

    MakeHeader(e.Graphics)

Is that what you are asking?...
0
 
LVL 6

Author Comment

by:activephoto
ID: 18841479
Hi Idle Mind,
it is not exacly what I am looking for, I have e.g. 3 graphics obect already that I want to combin after each other into e.g. e.Graphics.

/ Mikael
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 18846246
"I have e.g. 3 graphics obect already"

But WHERE did these three graphics come from if they are not "e.Graphics"?

A Graphics is a context for drawing onto SOMETHING so there has to be a drawing surface of some kind associated with them already.

Did you make Bitmaps and get a Graphics from that?

But in answer to your question I don't know of any way to merge two EXISTING Graphics.

You can create a NEW Graphics using Graphics.FromHDC() but eventually you have to use the graphics supplied to you in "e.Graphics"...you can't replace it with something else.


0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question