Example #1
0
        public ForBlock()
            : base("for")
        {
            ForInitializer = new StatementLine();
            ForCondition = new ExpressionBlock();
            ForIncrementStep = new ExpressionBlock();

            const int c = ShapeStyle.DefaultFontSize;

            ForInitializer.MyControl.Box.Margins.Left = c;
            ForInitializer.MyControl.Box.Margins.SetTopAndBottom(0);
            ForInitializer.MyControl.Box.MouseSensitivityArea.SetLeftAndRight(c);
            ForInitializer.Draggable = false;
            InitField(ForInitializer);

            ForCondition.MyControl.Box.Margins.Left = c;
            ForCondition.MyControl.Box.MouseSensitivityArea.SetLeftAndRight(c);
            InitField(ForCondition);

            ForIncrementStep.MyControl.Box.Margins.SetLeftAndRight(c);
            ForIncrementStep.MyControl.Box.MouseSensitivityArea.SetLeftAndRight(c);
            InitField(ForIncrementStep);

            LabelBlock firstSep = new LabelBlock(";");
            firstSep.MyControl.Enabled = false;
            LabelBlock secondSep = new LabelBlock(";");
            secondSep.MyControl.Enabled = false;

            this.HMembers.Add(ForInitializer);
            this.HMembers.Add(firstSep);
            this.HMembers.Add(ForCondition);
            this.HMembers.Add(secondSep);
            this.HMembers.Add(ForIncrementStep);
        }
Example #2
0
 protected override void OnKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
 {
     if (Strings.CanBeStartOfVariableName(e.KeyChar))
     {
         StatementLine s = new StatementLine();
         this.Replace(s);
         s.MyTextBox.OnKeyPress(e);
     }
 }