Groups | Blog | Home
all groups > dotnet drawing api > april 2006 >

dotnet drawing api : Outer limits of DrawLine?


Owkmann
4/4/2006 6:22:11 PM
When I run the following code, I get two lines, the first draws normally,
but the second looks like an error. Simply reducing 8.4e6 to 8.3e6 causes
the line to draw correctly. Am I doing something wrong here, or is this a
bug? Is there a way to use the larger X value without scaling? I am using
..Net 1.1.4322 SP1.

Thanks,

Owkmann





using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace DrawTest
{
public class Form1 : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.Size = new System.Drawing.Size(300,300);
this.Text = "Form1";
}
#endregion
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
using (Pen pen = new Pen(Color.DarkBlue, 1f))
{
g.DrawLine(pen, 50f, 150f, 1e6f, 150f);
g.DrawLine(pen, 50f, 200f, 8.4e6f, 200f);
}
base.OnPaint (e);
}
}
}

Bob Powell [MVP]
4/5/2006 12:00:00 AM
See the GDI+ FAQ for an article on the maximum extents of the drawing
surface.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.



[quoted text, click to view]

AddThis Social Bookmark Button