コード例 #1
0
ファイル: CritterPanel.cs プロジェクト: t4h3d1f/critters
        //added to support visual studio forms designer
        public void setModel(CritterModel model)
        {
            myModel = model;
            // construct font and compute char width once in constructor
            // for efficiency
            myFont    = new Font(FontFamily.GenericMonospace, FONT_SIZE + 4, FontStyle.Bold);
            BackColor = Color.Cyan;

            Size = new Size(FONT_SIZE * model.getWidth() + 20, FONT_SIZE * model.getHeight() + 20);
        }
コード例 #2
0
ファイル: CritterPanel.cs プロジェクト: t4h3d1f/critters
        public CritterPanel(CritterModel model)
        {
            InitializeComponent();
            // this prevents someone from trying to create their own copy of
            // the GUI components
            if (created)
            {
                throw new SystemException("Only one world allowed");
            }
            created = true;

            myModel = model;
            // construct font and compute char width once in constructor
            // for efficiency
            myFont    = new Font(FontFamily.GenericMonospace, FONT_SIZE + 4, FontStyle.Bold);
            BackColor = Color.Cyan;

            Size = new Size(FONT_SIZE * model.getWidth() + 20, FONT_SIZE * model.getHeight() + 20);
        }
コード例 #3
0
ファイル: CritterFrame.cs プロジェクト: t4h3d1f/critters
        public CritterFrame(int width, int height)
        {
            InitializeComponent();
            // this prevents someone from trying to create their own copy of
            // the GUI components
            if (created)
            {
                throw new SystemException("Only one world allowed");
            }
            created = true;

            // create model
            myModel = new CritterModel(width, height);

            // set up critter picture panel
            //   myPicture = new CritterPanel(myModel);
            myPicture.setModel(myModel);

            // initially it has not started
            started = false;
        }