Beispiel #1
0
        private BangButton MakeNewBubbleButtonLocked()
        {
            ++NextButtonID;

            const int  height  = 30;
            BangButton button1 = new BangButton(Util);

            button1.Id = NextButtonID;

            button1.Location = new System.Drawing.Point(1, 1);
            button1.Name     = string.Format("{0}", NextButtonID);
            button1.Font     = new Font(FontFamily.GenericSansSerif, 8.0f);
            button1.Size     = new System.Drawing.Size(height, height);
            button1.TabIndex = (int)NextButtonID;
            button1.Text     = button1.Name;
            button1.Visible  = true;
            button1.Tag      = new Point(GetRandomish(), GetRandomish()); // this is its direction
            button1.Click   += new EventHandler(button1_Click);

            bool result;

            /* while */
            {
                uint allocatedEngineId = EngineIdAddHelper;
                button1.EngineId = allocatedEngineId;
                result           = myBubbles.AddBubble(allocatedEngineId, NextButtonID, (float)height, GetCoords);
                if (result)
                {
                    Controls.Add(button1);
                    ButtonList.Add(button1);
                }
            } while (result == false)
            {
                ;
            }

            string text = string.Format("group count={0}, engine count={1}, bubble count1={2}, bubble count2={3}",
                                        myBubbles.GetGroupCount(),
                                        myBubbles.GetEngineCount().ToString(),
                                        myBubbles.GetBubbleCount(EngineId1).ToString(),
                                        myBubbles.GetBubbleCount(EngineId2).ToString());

            Text = text;
            return(button1);
        }