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

User-driven applications

, 10 Apr 2010 CPOL
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 .Drawing;
using System .Windows .Forms;
using System .IO;
using Microsoft .Win32;

using MoveGraphLibrary;

namespace UserDrivenApplications
{
    public enum HouseType { Primitive, Rural, RuralPlusLeft, RuralPlusRight, Hangar };

    public abstract class Building : GraphicalObject
    {
        protected HouseType houseType;
        protected SolidBrush brushHouse, brushRoof, brushWindow, brushDoor;
        protected Pen penEdge;

        public abstract Point Location ();
        new public abstract RectangleF RectAround ();
        public abstract Building Copy (Point pt);
        public abstract void Draw (Graphics grfx);
        public abstract void IntoRegistry (RegistryKey regkey, string name);
        public abstract void IntoFile (BinaryWriter bw);

        // -------------------------------------------------        HouseType
        public HouseType HouseType
        {
            get { return (houseType); }
        }
        // -------------------------------------------------        GetColors
        public Color [] GetColors ()
        {
            return (new Color [] { brushHouse .Color, brushRoof .Color, brushWindow .Color, brushDoor .Color, penEdge .Color });
        }
        // -------------------------------------------------        SetColors
        public void SetColors (Color [] clrs)
        {
            if (clrs != null && clrs .Length >= 5)
            {
                brushHouse = new SolidBrush (clrs [0]);
                brushRoof = new SolidBrush (clrs [1]);
                brushWindow = new SolidBrush (clrs [2]);
                brushDoor = new SolidBrush (clrs [3]);
                penEdge = new Pen (clrs [4]);
            }
        }
        // -------------------------------------------------        HouseColor
        public Color HouseColor
        {
            get { return (brushHouse .Color); }
            set { brushHouse = new SolidBrush (value); }
        }
        // -------------------------------------------------        RoofColor
        public Color RoofColor
        {
            get { return (brushRoof .Color); }
            set { brushRoof = new SolidBrush (value); }
        }
        // -------------------------------------------------        WindowColor
        public Color WindowColor
        {
            get { return (brushWindow .Color); }
            set { brushWindow = new SolidBrush (value); }
        }
        // -------------------------------------------------        DoorColor
        public Color DoorColor
        {
            get { return (brushDoor .Color); }
            set { brushDoor = new SolidBrush (value); }
        }
        // -------------------------------------------------        EdgeColor
        public Color EdgeColor
        {
            get { return (penEdge .Color); }
            set { penEdge = new Pen (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, 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.141022.2 | Last Updated 10 Apr 2010
Article Copyright 2010 by SergeyAndreyev
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid