Click here to Skip to main content
15,897,151 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.3K   3.2K   102  
A small framework to design and print documents containing shapes, text, images, bar codes...
using System;
using System.Windows.Forms;
using System.Drawing;
using BizDraw.Objects;
using BizDraw.Controls;
using System.Reflection;
using System.IO;
using System.Collections.Generic;
namespace BizDraw.Tools
{
    [System.Runtime.InteropServices.ComVisible(true)]
	/// <summary>
	/// Base class for all drawing tools
	/// </summary>
	public abstract class Tool
	{
        private Dictionary<string , Cursor > Cursors = new Dictionary<string,Cursor>();
        protected Cursor GetCursor(string name)
        {
            if (Cursors.ContainsKey(name))
                return Cursors[name];
            else
            {
                Stream s = Assembly.GetAssembly(typeof(Tool)).GetManifestResourceStream("BizDraw.Resources." + name + ".cur");
                Cursor c = new Cursor(s);
                Cursors.Add(name, c);
                return c;
            }
        }

        /// <summary>
        /// Left nous button is pressed
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public virtual void OnMouseDown(DrawArea drawArea, MouseEventArgs e)
        {
        }


        /// <summary>
        /// Mouse is moved, left mouse button is pressed or none button is pressed
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public virtual void OnMouseMove(DrawArea drawArea, MouseEventArgs e)
        {
        }


        /// <summary>
        /// Left mouse button is released
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public virtual void OnMouseUp(DrawArea drawArea, MouseEventArgs e)
        {
        }

        /// <summary>
        /// Left mouse button is released
        /// </summary>
        /// <param name="drawArea"></param>
        /// <param name="e"></param>
        public virtual void OnDoubleClick(DrawArea drawArea,EventArgs  e)
        {
        }
    }
}

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