Click here to Skip to main content
15,891,673 members
Articles / Desktop Programming / Windows Forms

BizDraw framework for .NET

Rate me:
Please Sign up or sign in to vote.
4.80/5 (21 votes)
30 May 20075 min read 128.1K   3.2K   102  
A small framework to design and print documents containing shapes, text, images, bar codes...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace BizDraw.Objects.Editors
{
    public partial class FrmLineEditor : Form, IDrawObjectEditor
    {
        private DrawLine line;
        private BizDraw.Core.Document _document;
        public FrmLineEditor()
        {
            InitializeComponent();
        }

        #region IDrawObjectEditor Members

        public DrawObject DrawSource
        {
            get
            {
                return line;
            }
            set
            {
                line = (DrawLine)value;
            }
        }

        #endregion

        private void FrmLineEditor_Load(object sender, EventArgs e)
        {
            if (this.DrawSource is DrawPolygon )
            {
                this.groupBox1.Enabled = false;
                this.Text = "Ploygone"; 
            }
            else
            {
                this.nX1.Pixels = this.line.StartPoint.X;
                this.nY1.Pixels = this.line.StartPoint.Y;
                this.nX2.Pixels = this.line.EndPoint.X;
                this.nY2.Pixels = this.line.EndPoint.Y;
            }
            this.penWidthEditor1.Value = (decimal ) this.line.PenWidth;
            this.colorEditor1.Color = this.line.Color;
        }

        private void nX_ValueChanged(object sender, EventArgs e)
        {

        }

        private void btOk_Click(object sender, EventArgs e)
        {
            //saving values 
            if (this.DrawSource is DrawLine )
            {
                this.line.StartPoint = new Point(this.nX1.Pixels, this.nY1.Pixels);
                this.line.EndPoint = new Point(this.nX2.Pixels, this.nY2.Pixels);
            }
            this.line.PenWidth =Convert.ToInt32( this.penWidthEditor1.Value);
            this.line.Color = this.colorEditor1.Color;
            this.DialogResult = DialogResult.OK;
        }

        private void btCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }
        public BizDraw.Core.Document Document
        {
            get
            {
                return _document;
            }
            set
            {
                _document = value;
            }
        }
    }
}

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.

License

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


Written By
Web Developer
France France
MCSD Asp.Net certified developer

Comments and Discussions