Example #1
0
		/// <summary>
		/// Creates a PaperSize from Xml
		/// </summary>
		internal static PaperSize CreatePaperSizeFromXml(XmlElement root, Metric metric)
		{
			MetricHInch hInch = new MetricHInch();
			float width, height;
            PaperSize paper;

			if (root.HasAttribute("Metric"))
				metric = Metric.GetMetricParser(root.GetAttribute("Metric"));
			else
				metric = new MetricCentimeter();

			width = hInch.Reverse(metric.Parse(root.GetAttribute("Width")));
			height = hInch.Reverse(metric.Parse(root.GetAttribute("Height")));

            paper = new PaperSize(
				"Custom",
				(int) Math.Round(width),
				(int) Math.Round(height));

#if DEBUG
            if (paper.Width < Math.Round(width) || paper.Height < Math.Round(height))
                throw new Exception("DEBUG: Invalid paper size!");
#endif

            return paper;
		}
		/// <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();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PageLayoutDesign));
            Report.Layout.MetricCentimeter metricCentimeter4 = new Report.Layout.MetricCentimeter();
            this.picPage = new System.Windows.Forms.PictureBox();
            this.vRuler = new Report.Designer.Ruler();
            this.hRuler = new Report.Designer.Ruler();
            this.pageLayout = new Report.Layout.Complex.PageLayout(this.components);
            ((System.ComponentModel.ISupportInitialize)(this.picPage)).BeginInit();
            this.SuspendLayout();
            // 
            // picPage
            // 
            this.picPage.BackColor = System.Drawing.Color.White;
            this.picPage.Location = new System.Drawing.Point(24, 24);
            this.picPage.Name = "picPage";
            this.picPage.Size = new System.Drawing.Size(464, 288);
            this.picPage.TabIndex = 5;
            this.picPage.TabStop = false;
            this.picPage.MouseLeave += new System.EventHandler(this.picPage_MouseLeave);
            this.picPage.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picPage_MouseDown);
            this.picPage.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picPage_MouseMove);
            this.picPage.Paint += new System.Windows.Forms.PaintEventHandler(this.picPage_Paint);
            this.picPage.Resize += new System.EventHandler(this.picPage_Resize);
            this.picPage.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picPage_MouseUp);
            // 
            // vRuler
            // 
            this.vRuler.FarDistance = 0F;
            this.vRuler.Location = new System.Drawing.Point(0, 24);
            this.vRuler.Name = "vRuler";
            this.vRuler.NearDistance = 0F;
            this.vRuler.RulerOrientation = Report.Designer.Ruler.Orientation.Vertical;
            this.vRuler.Size = new System.Drawing.Size(24, 288);
            this.vRuler.TabIndex = 4;
            this.vRuler.Unit = System.Drawing.GraphicsUnit.Millimeter;
            // 
            // hRuler
            // 
            this.hRuler.BackColor = System.Drawing.SystemColors.Control;
            this.hRuler.FarDistance = 0F;
            this.hRuler.Location = new System.Drawing.Point(24, 0);
            this.hRuler.Name = "hRuler";
            this.hRuler.NearDistance = 0F;
            this.hRuler.Size = new System.Drawing.Size(464, 24);
            this.hRuler.TabIndex = 3;
            this.hRuler.Unit = System.Drawing.GraphicsUnit.Millimeter;
            // 
            // pageLayout
            // 
            this.pageLayout.DefaultAlignment = System.Drawing.ContentAlignment.TopLeft;
            this.pageLayout.DefaultMetric = metricCentimeter4;
            this.pageLayout.DefaultTextFont = new System.Drawing.Font("Microsoft Sans Serif", 12F);
            // 
            // PageLayoutDesign
            // 
            this.AutoScroll = true;
            this.Controls.Add(this.picPage);
            this.Controls.Add(this.vRuler);
            this.Controls.Add(this.hRuler);
            this.Name = "PageLayoutDesign";
            this.Size = new System.Drawing.Size(488, 312);
            this.Load += new System.EventHandler(this.PageLayoutDesign_Load);
            this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.PageLayoutDesign_KeyUp);
            ((System.ComponentModel.ISupportInitialize)(this.picPage)).EndInit();
            this.ResumeLayout(false);

		}