Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Error_1_'WindowsFormsApplication1.Form1.GetRandomWords()' is a 'method', which is not valid in the given context_C:\Users\User\documents\visual studio 2010\Projects\Final culminating\Final culminating\Form1.cs_63_29_Final culminating

$
0
0

namespace WindowsFormsApplication1

{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        enum BodyParts
        {
            Head,
            Right_Arm,
            Left_Arm,
            Body,
            Left_Leg,
            Right_Leg
        }

        void DrawingHangPost()
        {
            Graphics g = panel1.CreateGraphics();
            Pen p = new Pen(Color.Black,10);

            g.DrawLine(p, new Point(180, 346), new Point(180, 5));
            g.DrawLine(p, new Point(185, 5), new Point(65, 5));
            g.DrawLine(p, new Point(60,0), new Point(60, 50));
            DrawBodyParts(BodyParts.Head);
            DrawBodyParts(BodyParts.Body);
            DrawBodyParts(BodyParts.Left_Arm);
            DrawBodyParts(BodyParts.Right_Arm);
            DrawBodyParts(BodyParts.Left_Leg);
            DrawBodyParts(BodyParts.Right_Leg);
        }

        void DrawBodyParts(BodyParts bp)
        {
            Graphics g = panel1.CreateGraphics();
            Pen p = new Pen(Color.Brown,2);

            if (bp == BodyParts.Head)
                g.DrawEllipse(p, 40, 50, 40, 40);

            else if (bp == BodyParts.Body)
                g.DrawLine(p, new Point(60, 90), new Point(60, 200));
            else if (bp == BodyParts.Left_Arm)
                g.DrawLine(p, new Point(60, 100), new Point(30, 160));
            else if (bp == BodyParts.Right_Arm)
                g.DrawLine(p, new Point(60, 100), new Point(90, 160));
            else if (bp == BodyParts.Left_Leg)
                g.DrawLine(p, new Point(60, 198), new Point(30, 230));
            else if (bp == BodyParts.Right_Leg)
                g.DrawLine(p, new Point(60, 198), new Point(90, 230));
            MessageBox.Show(GetRandomWords.ToString())();

              }
        string GetRandomWords()
        {

            string[] array = new string[25];


            array[0] = "school";
            array[1] = "computer";
            array[2] = "blueberry";
            array[3] = "mouse";
            array[4] = "bunny";
            array[5] = "horse";
            array[6] = "boat";
            array[7] = "apple";
            array[8] = "keyboard";
            array[9] = "monitor";
            array[10] = "glasses";
            array[11] = "shoes";
            array[12] = "chair";
            array[13] = "chalkboard";
            array[14] = "sweater";
            array[15] = "pencil";
            array[16] = "pear";
            array[17] = "braces";
            array[18] = "disappointed";
            array[19] = "slippers";
            array[20] = "binder";
            array[21] = "electricity";
            array[22] = "sound";
            array[23] = "gravity";
            array[24] = "chemistry";

            Random a = new Random();
            int rand = a.Next(0, 24);
            char[] letters = array[rand].ToCharArray();
            string word = array[rand];
             return array[a.Next(0, array.Length - 1)];



        }
        private void Form1_Shown_1(object sender, EventArgs e)
        {
            DrawingHangPost();
        }

    }

                                               Here is my code


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>