Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version
Go to top

User-driven applications

, 10 Apr 2010
User-driven applications are the programs in which full control is given to the users. Designers of such programs are responsible only for developing an instrument for solving some task, but they do not enforce users to work with this instrument according with a predefined scenario.
TheoryOfUserDrivenApplications.zip
TheoryOfUserDrivenApplications
TheoryOfUserDrivenApplications
bin
Debug
TheoryOfUserDrivenApplications.vshost.exe
Release
MoveGraphLibrary.dll
TheoryOfUserDrivenApplications.bin
TheoryOfUserDrivenApplications.exe
TheoryOfUserDrivenApplications.vshost.exe
Properties
Settings.settings
Resources
ArrowDown.bmp
ArrowUp.bmp
DELETE.BMP
Hangar.bmp
Lock.bmp
palette_.bmp
RuralHouse.bmp
RuralLeftPlus.bmp
RuralRightPlus.bmp
SimpleHouse.bmp
User_driven_applications.doc
User_driven_applications.pdf
using System;
using System .Collections .Generic;
using System .ComponentModel;
using System .Drawing;
using System .Windows .Forms;

using MoveGraphLibrary;

namespace UserDrivenApplications
{
    public partial class Form_About : Form
    {
        Mover mover;

        string strAbout = "This program is designed especially to accompany\n" +
                          "the article  \"User-Driven Applications\".\n" +
                          "All codes of this program are available.\n" +
                          "Other related programs and documents can be found at\n" +
                          "         www.sourceforge.net   \n" +
                          "                  in the project  MoveableGraphics";
        string [] strAuthor = new string [] {"By  Sergey Andreyev", 
                                             "( andreyev_sergey@yahoo.com )"};
        string strDate = "April 2010";
        Font fontAuthor;
        TextM infoAbout, infoDate;
        LinkedRectangles lrAuthor;
        TextMR citation;

        // -------------------------------------------------
        public Form_About ()
        {
            InitializeComponent ();
            mover = new Mover (this);

            int cxL = 20;
            int cyT = 20;
            infoAbout = new TextM (this, new Point (cxL, cyT), strAbout);
            infoAbout .BackColor = Color .LightYellow;
            Rectangle rcAbout = infoAbout .RectAround;

            fontAuthor = new Font (Font .Name, (float) (Font .SizeInPoints * 1.1), FontStyle .Bold);
            Size [] sizes = Auxi_Geometry .RoundMeasureStrings (this, strAuthor, fontAuthor);
            Rectangle [] rcs = new Rectangle [2];
            rcs [0] = new Rectangle (rcAbout .Left, rcAbout .Bottom + 12, sizes [0] .Width, sizes [0] .Height);
            rcs [1] = new Rectangle (rcs [0] .Left + rcs [0] .Width * 2 / 3, rcs [0] .Bottom, sizes [1] .Width, sizes [1] .Height);
            lrAuthor = new LinkedRectangles (rcs);

            citation = new TextMR (this, new Point (Auxi_Geometry .Middle (rcAbout) .X, rcs [1] .Bottom + 2 * rcs [1] .Height),
                                   "\"... for the joy of the working ...\"",
                                   new Font ("Times New Roman", (float) (Font .SizeInPoints * 1.8)), 12, Color .Blue, false, BackColor);
            citation .Location = new Point (citation .Location .X, rcs [1] .Bottom + citation .RectAround .Height / 2);

            infoDate = new TextM (this, new Point (rcAbout .Left, citation .RectAround .Bottom), strDate);
            infoDate .ShowFrame = false;
            infoDate .BackColor = Color .Transparent;
            infoDate .Move (infoAbout .Width - infoDate .Width, - infoDate .Height);
            ClientSize = new Size (infoDate .RectAround .Right + cxL, infoDate .RectAround .Bottom + cyT);

            mover .Add (infoDate);
            mover .Add (citation);
            mover .Add (lrAuthor);
            mover .Add (infoAbout);
        }
        // -------------------------------------------------        OnPaint
        private void OnPaint (object sender, PaintEventArgs e)
        {
            Graphics grfx = e .Graphics;

            infoAbout .Draw (grfx);
            for (int i = 0; i < strAuthor .Length; i++)
            {
                Auxi_Drawing .DrawText (grfx, strAuthor [i], fontAuthor, 0, ForeColor, lrAuthor .Rectangle (i) .Location, TextBasis .NW);
            }
            citation .Draw (grfx);
            infoDate .Draw (grfx);
        }
        // -------------------------------------------------        OnMouseDown
        private void OnMouseDown (object sender, MouseEventArgs mea)
        {
            mover .Catch (mea .Location, mea .Button);
        }
        // -------------------------------------------------        OnMouseUp
        private void OnMouseUp (object sender, MouseEventArgs e)
        {
            mover .Release ();
        }
        // -------------------------------------------------        OnMouseMove
        private void OnMouseMove (object sender, MouseEventArgs mea)
        {
            if (mover .Move (mea .Location))
            {
                Invalidate ();
            }
        }
    }
}

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

SergeyAndreyev

United States United States
No Biography provided

| Advertise | Privacy | Mobile
Web04 | 2.8.140926.1 | Last Updated 10 Apr 2010
Article Copyright 2010 by SergeyAndreyev
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid