.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

Why does Graphics.FillRectangle behave differently on a Printer graphics than on the screen.

Posted By:      Posted Date: October 22, 2010    Points: 0   Category :.NET Framework

I'm trying to do something very simple. I have to draw a box with a border on it both on the screen and also onto the printer graphics surface.

But the printer graphics object appears to behave differently.To test this out, I am using a PictureBox and a PrintDocument to draw exactly the same thing in the exactly the same way:

        private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
            e.HasMorePages = false;

        private void pictureBox1_Paint(object sender, PaintEventArgs e)

        private void DrawSquare(Graphics graphics)
            int top = 100;

View Complete Post

More Related Resource Links

Changing the graphics on the home page of a SharePoint site

When you create a site in Microsoft Windows SharePoint Services by using the default Team Site template, the home page includes two default graphics. A Windows SharePoint Services graphic appears in the body of the page, and a picture of a house in a circle appears near the site title. You can change these graphics to customize your site. Changing the smaller graphic requires a Windows SharePoint Services compatible Web page editor

Foundations: Vector Graphics and the WPF Shape Class


The System.Windows.Shapes namespace is Charles Petzold's namespace of choice for rendering two-dimensional vector graphics in WPF. Here he explains why.

Charles Petzold

MSDN Magazine March 2008

Smarter Art: Create Custom SmartArt Graphics For Use In The 2007 Office System


SmartArt incorporates a gallery of templates and predefined shapes that can quickly be inserted and configured in your Microsoft Office documents. Find out how.

Janet Schorr

MSDN Magazine February 2007

Graphics To Go: Make A Mobile Imaging App With The .NET Compact Framework 2.0


This article focuses on developing for Pocket PCs, a skill which can then be transferred to Smartphone application development.

Rob Pierry

MSDN Magazine December 2006

Dazzling Graphics: Top Ten UI Development Breakthroughs In Windows Presentation Foundation


The Windows Presentation Foundation provides new techniques for UI-based developing applications and makes better use of current hardware and technologies. In this article, Ian Griffiths and Chris Sells explain 10 of the most significant advances that make WPF superior to its Win32 predecessors.

Ian Griffiths and Chris Sells

MSDN Magazine January 2006

DirectX 9.0: Introducing the New Managed Direct3D Graphics API in the .NET Framework


DirectX 9.0 is the latest evolution of the Microsoft 3D graphics technology for Windows. Direct3D, a major component of the DirectX Graphics subsystem, has evolved so rapidly in the last few years that the underlying programming paradigm has changed quite a bit from its origin. This article introduces the fundamental concepts of the unmanaged Direct3D architecture and illustrates how the managed Direct3D layer abstracts the unmanaged layer. Also, the author describes the Geometry, Texture, Device, and other classes and uses code from the Samples SDK.

Yahya H. Mirza and Henry da Costa

MSDN Magazine July 2003

Vector Graphics: Build Flexible, Lightweight XML-Based Images for ASP.NET Using Scalable Vector Grap


Scalable Vector Graphics (SVG), a W3C graphics standard built around XML, is one of several vector graphics technologies that allows fast, lightweight drawings such as charts and graphs to be rendered on the fly in an appropriate viewer. There are many advantages to such vector graphics, including conservation of bandwidth and storage media, and flexibility. This article explains these benefits and shows you how to easily add powerful, dynamic, interactive visual elements to your Web applications.

Dennis Forbes

MSDN Magazine July 2003

ASP.NET: Create Snazzy Web Charts and Graphics On the Fly with the .NET Framework


Knowledge workers can understand data more effectively when raw numbers are presented in a graphical format. This is especially true when displaying database information on a Web page, where a simple chart can make the difference between a dry presentation and a vivid data source. In the past, creating dynamic, data-based charts on the fly in ASP required purchasing a third-party, image-generating COM component. Now with ASP.NET, developers can access the .NET Framework's drawing classes directly with C# to create dynamic images and charts.

Scott Mitchell

MSDN Magazine February 2002

Graphics: Manipulate Digital Images in Internet Explorer with the DirectX Transform SDK


The Microsoft DirectX Transform is a Microsoft DirectX media API that can be used to create animated effects as well as to create and edit digital images for Windows-based applications. Scripting and HTML can be used to display an existing transform on a Web page, and improved transform support in Microsoft Internet Explorer 5.5 makes it easy to use transforms. This article provides step-by-step instructions for writing a transform as an ATL project and shows an example of an image transform. C++ is used to instantiate, configure, and display transforms in this project.

Alex Lerner

MSDN Magazine March 2001

Graphics Bitmaps & Rectangles

I am trying to draw 2 bitmap images on top of each other. 1 is a background image that only changes occasionally and the other is a foreground image the moves around a lot. The foreground image is usually an ellipse. But when I show it I always end up with the corners of the constraining rectangle being shown! I have included some basic code that demonstrates what I mean. How can I show two bit maps with the top one only showing the exact shape I require (without gray corners). Also if I want to remove the foreground image from being seen do I need to redraw the entire background? or can I just redraw the bit where the foreground image was. or can I just hide the foreground image somehow? This maybe a basic question - Graphics are a new area to me! Many thanks in advance!   using   System; using   System.Collections.Generic; using   System.ComponentModel; using   System.Data; using   System.Drawing; using   System.Drawing.Drawing2D; using   System.Text; using   System.Windows.Forms; namespace   TEST200 {   public partial class Form1 : Form {   private Bitmap bmpBACKGROUND;   private Bitmap bmpFOREGROUND;   public Form1() { InitializeComponent(); }   private void Form1_Load(object sender, EventArgs e) { bmpBACKGROUND = new Bitmap(this.ClientRectangle.Width,

Using variables with a URL for external graphics in a report

I have a company logo that should appear in all the reports I create. I uploaded it to an Images folder on my SSRS server using Report Manager and then have modified my first report to refer to it using the External option then typing in the URL http://DC2VTSTSV032/reportserver/Images/CompanyLogo.png?%2fImages%2fCompanyLogo.PNG&rs:Command=GetResourceContents This all works fine and the graphic displays in layout and preview mode in the BI editor and also when I deploy the report on that server. My problem is, I would prefer that I use a variable instead of the server name DC2VTSTSV032. I have an environment variable that holds the server name on each server so I tried using ="http://"+%INGISSQLServer%+"/..." but it didn't like the reference to the environment so I tried using +Mid(GLOBAL!ReportServerURL,8,12)+. That didn't work. I then tried specifying the original url enclosed in quotes after an equals and that didn't work either! I'm guessing that there may be an issue with the way some of the special characters in my URL are treated when I use a literal string in quotes. The issue is that I'd like to be able to deploy the reports to both this dev server and the production one without making any changes. For the moment, the dev environment should show the new company logo and production should show the old logo so I don't want

Graphics.DrawImage(image, bounds) vs SetResolution

Hi    this is what I am undertanding.   Image object never store inch information, it is two-dimentional array of pixels, thus Image object don't have a DPI.    so I conclude that Image.SetResolution is actually changing the Image width and height with the current Graphics.InterpolationMode   from the naming of enumerations of Graphics.InterpolationMode I conclude it is a Re-Sampling algorithms.   thus   If I am drawing image in terms of inches then   Image.SetResoultion(Image.Width * someFactor/ DPI, ........);  Graphics.Draw(Image)   is equivalent to   Graphics.Draw(Image, Bounds in inch)   Can some one validate this?

graphics in Visual C#

  Hi, I'm developing an application in Visual C#2008 to watch the measures that sends a micro. How could I show them in real time in a graphic? I should use the "Windows form application". To summarize, the question is how to make graphics in Visual C# Thank you very much

API SSRS 2008 for php graphics

Hi I use API SSRS on server SSRS 2008 with php 5.3. I display my reports with the api but , don't draw the graphics. Same parameters same reports on web manager SSRS , i see graphics and draw. It is histogram with one value. API can not diplay graphics ?   Regards Marc      

Charts and graphics with SSRS?

Can you do charts and advanced graphics with ssrs?

How to get around no Graphics for an indexed Bitmap

I'm building a library of bitmap graphics functions. I'm not sure how to handle the fact that the indexed formats do not allow a Graphics object. I suppose I could check the Bitmap supplied to the function and use the graphics object if it's possible and other methods if it is not. I'm hopping there is a better way. Can you suggest an approach or other helpful comments Also, I've read that GDI+ version 6 allows graphics with indexed data. If that is true is there any way I could make use of that fact?   Thanks

Loading graphics without Ajax on submit and before Post Back

Hi, In order to maintain the view state information, I have decided not to use update panel for the loading image. Instead is there a way where I can simply make an image invisible, and display the image on click of the search button and hide it when the page post back again ?    Please advise.  
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend