[Mono-bugs] [Bug 456371] New: DrawRectangle, FillRectangle and DrawLine draw error when using GraphicsUnit. Millimeter PageUnit

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Dec 4 05:03:51 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=456371


           Summary: DrawRectangle, FillRectangle and DrawLine draw error
                    when using GraphicsUnit.Millimeter PageUnit
           Product: Mono: Runtime
           Version: 2.0.x
          Platform: i386
        OS/Version: Windows XP
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: jerauskin at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Community User


Description of Problem:
Using GraphicsUnit.Millimeter in Graphics PageUnit, DrawRectangle,
FillRectangle and DrawLine functions doesn't draw correctly using decimal Pen
thick. Using Microsoft .NET draws correctly.

Steps to reproduce the problem:
1. Run Test example

How often does this happen? All


Additional Information: Test code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Test
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        // Test
        private void test()
        {
            Graphics g = panel1.CreateGraphics();
            g.PageUnit = GraphicsUnit.Millimeter;
            // First Example
            Rectangle rect = new Rectangle(1, 1, 10, 10);
            // Filled rectangle
            using (Brush b = new SolidBrush(Color.DarkCyan))
            {
                g.FillRectangle(b, rect);
            }
            // Normal rectangle
            using (Pen p = new Pen(Brushes.Black, 1))
            {
                g.DrawRectangle(p, rect);
            }
            // Line
            using (Pen p = new Pen(Brushes.Orange,1))
            {
                g.DrawLine(p, 11, 6, 21, 6);
            }
            // Second Example
            rect = new Rectangle(1, 15, 10, 10);
            // Filled rectangle
            using (Brush b = new SolidBrush(Color.DarkCyan))
            {
                g.FillRectangle(b, rect);
            }
            // Normal rectangle
            using (Pen p = new Pen(Brushes.Black, (float)0.2))
            {
                g.DrawRectangle(p, rect);
            }
            // Line
            using (Pen p = new Pen(Brushes.Orange, (float)0.2))
            {
                g.DrawLine(p, 11, 20, 21, 20);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            test();
        }
    }

    partial class Form1
    {
        /// <summary>
        /// Variable del diseñador requerida.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Limpiar los recursos que se estén utilizando.
        /// </summary>
        /// <param name="disposing">true si los recursos administrados se deben
eliminar; false en caso contrario, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Código generado por el Diseñador de Windows Forms

        /// <summary>
        /// Método necesario para admitir el Diseñador. No se puede modificar
        /// el contenido del método con el editor de código.
        /// </summary>
        private void InitializeComponent()
        {
            this.panel1 = new System.Windows.Forms.Panel();
            this.button1 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // panel1
            // 
            this.panel1.BackColor =
System.Drawing.SystemColors.ControlLightLight;
            this.panel1.Location = new System.Drawing.Point(33, 34);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(227, 196);
            this.panel1.TabIndex = 0;
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(98, 5);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 1;
            this.button1.Text = "Test";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(292, 266);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.panel1);
            this.Name = "Form1";
            this.Text = "Test form";
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.Panel panel1;
        private System.Windows.Forms.Button button1;
    }
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list