Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The following are my code samples:

The Graphical Classes in which public variables are set by users at runtime. The two classes Geometry and FallingLines

C#
public class Geometry
    {
        private int width;
        private int height;

        public int repetation = 6;
        public bool IsOffset = true;
        public GeometricalShapes shape = GeometricalShapes.Circle;

        private List<Rectangle> rectangle;
        private int offSetTimes = 3;

        public Geometry(int width, int height)
        {
            this.width = width;
            this.height = height;
        }

        public GraphicsPath[] Draw()
        {
            //implementation
        }
        
        private int[] GetIncBoxSize(int repetation)
        {
            //implementation
        }

        private GraphicsPath GetPath(int x, int y, int wt, int ht)
        {
            //implementation
        }
    }



C#
public class FallingLines
    {
        public int width;
        public int height;
        
        public bool IsTop = true;
        public bool IsBtm = false;
        public bool IsOffset = true;

        public int repetation = 10;

        public LineType lineType = LineType.Irregular;
        
        public FallingLines(int width, int height)
        {
            this.width = width;
            this.height = height;            
        }

        public GraphicsPath[] Draw()
        {
            // implementation
        }

        private Rectangle[] GetRectangle(int randomOffset)
        {
            // implementation
        }

        private GraphicsPath GetPath(int x, int y, int width, int height)
        {
            // implementation
        }

        private Point[] GetPoints(int count)
        {
            // implementation
        }

        private Point[] DrawWave(Point top, Point btm, int cntWave)
        {
            // implementation
        }

        private GraphicsPath DrawIrregularity(Point[] points, int width)
        {
            // implementation
        }

        private Point[] GetRandomPointInLine(Point[] points, int curveCnt)
        {
            // implementation
        }

        private Point[] DrawIrregularWave(Point top, Point btm, int width)
        {
            // implementation
        }
    }


I will be making controls for the user so that they can manipulate.
So, i want something that can interact back and forth.

I want my MyForm to send info to these classes and vice versa. later after a Button Press i want the Draw() to return the graphicsPath[] to my mainForm.

How do i do these...
Posted
Updated 10-Apr-12 19:22pm
v4
Comments
bbirajdar 10-Apr-12 7:38am    
Not clear
leFestin 10-Apr-12 7:50am    
i have updated my question. Hope this make clear.
[no name] 10-Apr-12 7:52am    
Okay.... what makes you think that you need an abstract class in this case?

Quote:
//should this be an abstract class which interact with Graphical Classes below....


Yes ,as per one possibility
 
Share this answer
 
Your GraphicsClass classes have to implement an Interface. Since all classes have one property and one method in common, I'd suggest
C#
public Interface IGraphics
{
   bool a { get; set; }
   GraphicsPath Draw();
}

I do not sse any need for your "interactor" class.
 
Share this answer
 
Comments
leFestin 10-Apr-12 14:31pm    
The above was just a sample. In my graphics class, I have public properties, public draw() and other private function and properties...

Since you have seen above all the public properties of different graphics classes donot match. So, i was wondering how to call all these classes easily through one central parent class. Is "interface" still applicable there...

and how do i make these classes accessible to my MainForm. I donot want to write a silly code where i manually do each process of code for all the graphics class. Could you help me with some examples on this one.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900