Click here to Skip to main content
15,894,740 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.2K   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
{
    [System.Runtime.InteropServices.ComVisible(true)]
    public partial class FrmImageEditor : Form, IDrawObjectEditor
    {
        private DrawImage  img;
        private BizDraw.Core.Document _document;
        public FrmImageEditor()
        {
            InitializeComponent();
        }

        #region IDrawObjectEditor Members

        public DrawObject DrawSource
        {
            get
            {
                return img;
            }
            set
            {
                img = (DrawImage)value;
            }
        }

        #endregion

        private void FrmLineEditor_Load(object sender, EventArgs e)
        {
            this.nX.Pixels = this.img.Rectangle.X;
            this.nY.Pixels = this.img.Rectangle.Y;
            this.nWidth.Pixels = this.img.Rectangle.Width;
            this.nHeight.Pixels = this.img.Rectangle.Height;

            this.penWidthEditor1.Value = (decimal)this.img.PenWidth;
            this.colorEditor1.Color = this.img.Color;
        }

        private void nX_ValueChanged(object sender, EventArgs e)
        {

        }

        private void btOk_Click(object sender, EventArgs e)
        {
            //saving values 
            this.img.Rectangle = new Rectangle(this.nX.Pixels, this.nY.Pixels, this.nWidth.Pixels, this.nHeight.Pixels);

            this.img.PenWidth = Convert.ToInt32(this.penWidthEditor1.Value);
            this.img.Color = this.colorEditor1.Color;
            if (tbPath.Text != string.Empty && System.IO.File.Exists(tbPath.Text))
                img.PicturePath = tbPath.Text;
            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;
            }
        }

        private void btBrowse_Click(object sender, EventArgs e)
        {
            OpenFileDialog fd = new OpenFileDialog();
            fd.Filter = "JPEG Files (*.jpg)|*.jpg|Bitmap files (*.bmp)|*.bmp|GIF Files (*.GIF)|*.gif|All files (*.*)|*.*";
            if (fd.ShowDialog() == DialogResult.OK)
            {
                this.tbPath.Text = fd.FileName;
            }
        }
    }
}

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