|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using BizDraw.Core;
using BizDraw.Controls;
using BizDraw.Tools;
namespace BizDraw.Controls
{
[System.Runtime.InteropServices.ComVisible(true)]
public partial class DocumentArea : UserControl
{
public DocumentArea()
{
InitializeComponent();
CenterDrawingArea();
this.Resize += new EventHandler(DocumentArea_Resize);
}
#region Controls Positions
void DocumentArea_Resize(object sender, EventArgs e)
{
CenterDrawingArea();
}
void CenterDrawingArea()
{
double UnitSize = (double)((1 / 25.4) * 96.0);
this.drawArea1.Size = new Size(Convert.ToInt32(UnitSize * this.Document.Width * Zoom ), Convert.ToInt32(UnitSize * this.Document.Height * Zoom ));
this.drawArea1.Left = Convert.ToInt32((this.panel1.Width - this.drawArea1.Width) / 2);
this.drawArea1.Top = Convert.ToInt32((this.panel1.Height - this.drawArea1.Height) / 2);
this.hRuler1.RulerMargin = this.drawArea1.Left + this.hRuler2.Width;
this.hRuler2.RulerMargin = this.drawArea1.Top;
}
#endregion
#region Properties
public Document Document
{
get
{
return this.drawArea1.Document;
}
set
{
this.drawArea1.Document = value;
}
}
public Tool ActiveTool
{
get
{
return drawArea1.ActiveTool;
}
set
{
drawArea1.ActiveTool = value;
}
}
public float Zoom
{
get { return this.drawArea1.Zoom; }
set
{
this.drawArea1.Zoom = value;
CenterDrawingArea();
this.hRuler1.ZoomFactor = value;
this.hRuler2.ZoomFactor = value;
this.Refresh();
}
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here