/// <summary>
 /// auto-detect if the edit box is click and allow user to update the cell contect accordingly
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void EditBox_KeyPressed(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (EnterCellContentEvent != null)
         {
             EnterCellContentEvent(EditBox.Text);
             IsModified = true;
         }
         EditBox.Clear();
     }
 }
Beispiel #2
0
 private void setProperties()
 {
     foreach (Control control in grpTongTien.Controls)
     {
         if (control is Janus.Windows.GridEX.EditControls.EditBox)
         {
             Janus.Windows.GridEX.EditControls.EditBox txtTien = new EditBox();
             txtTien = (Janus.Windows.GridEX.EditControls.EditBox)control;
             if (!txtTien.Name.Equals(txtTieuDe.Name))
             {
                 txtTien.Clear();
                 txtTien.ReadOnly     = true;
                 txtTien.TextChanged += new EventHandler(txtEventTongTien_TextChanged);
                 txtTien.KeyPress    += new KeyPressEventHandler(txtEventTongTien_KeyPress);
                 // txtTien.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                 txtTien.TextAlignment = TextAlignment.Far;
             }
         }
     }
 }
Beispiel #3
0
 private void setProperties()
 {
     try
     {
         foreach (Control control in this.Controls)
         {
             if (control is EditBox)
             {
                 var _item = new EditBox();
                 _item = ((EditBox)(control));
                 _item.Clear();
                 _item.ReadOnly      = true;
                 _item.TextAlignment = Janus.Windows.GridEX.TextAlignment.Far;
                 _item.TextChanged  += txtEventTongTien_TextChanged;
             }
         }
     }
     catch (Exception exception)
     {
     }
 }
Beispiel #4
0
 private void setProperties()
 {
     try
     {
         foreach (Control control in pnlInfor.Controls)
         {
             if (control is EditBox)
             {
                 var txtFormantTongTien = new EditBox();
                 txtFormantTongTien = ((EditBox)(control));
                 txtFormantTongTien.Clear();
                 txtFormantTongTien.ReadOnly      = true;
                 txtFormantTongTien.TextAlignment = TextAlignment.Far;
                 txtFormantTongTien.TextChanged  += txtEventTongTien_TextChanged;
             }
         }
     }
     catch (Exception exception)
     {
     }
 }
Beispiel #5
0
        void Colorize()
        {
#if PARSER
            if (_colorizing)
            {
                return;
            }
            _colorizing = true;
            var text = EditBox.Text;
            var sel  = EditBox.SelectionStart;
            EditBox.Clear();
            var sb = new StringBuilder();
            sb.Append("{\\rtf1");
            sb.Append(RtfUtility.ToColorTable(
                          Color.Black,
                          Color.DarkGreen,
                          Color.DarkRed,
                          Color.DarkOliveGreen,
                          Color.Blue,
                          Color.DarkCyan,
                          Color.BlueViolet,
                          Color.DarkGray));
            var p    = new EbnfParser(ParseContext.Create(text));
            var pos  = 0L;
            var cols = new Stack <int>();
            cols.Push(0);
            while (p.Read())
            {
                switch (p.NodeType)
                {
                case LLNodeType.NonTerminal:
                    switch (p.SymbolId)
                    {
                    case EbnfParser.attribute:
                        cols.Push(3);
                        break;

                    case EbnfParser.symbol:
                    case EbnfParser.expressions:
                        cols.Push(4);
                        break;

                    default:
                        cols.Push(0);
                        break;
                    }
                    break;

                case LLNodeType.EndNonTerminal:
                    cols.Pop();
                    break;

                case LLNodeType.Terminal:
                case LLNodeType.Error:
                    if (p.Position > pos)
                    {
                        sb.Append("\\cf1 ");
                        sb.Append(RtfUtility.Escape(text.Substring((int)pos, (int)(p.Position - pos))));
                    }
                    if (LLNodeType.Error == p.NodeType)
                    {
                        sb.Append("\\cf2");
                    }
                    else
                    {
                        sb.Append("\\cf");

                        switch (p.SymbolId)
                        {
                        case EbnfParser.literal:
                            sb.Append(5);
                            break;

                        case EbnfParser.regex:
                            sb.Append(6);
                            break;


                        default:
                            sb.Append(cols.Peek());
                            break;
                        }
                    }
                    sb.Append(RtfUtility.Escape(p.Value));
                    pos = p.Position + p.Value.Length;
                    break;
                }
            }
            sb.Append("}");
            System.Diagnostics.Debug.WriteLine(sb.ToString());
            EditBox.Rtf            = sb.ToString();
            EditBox.SelectionStart = sel;
            _colorizing            = false;
#endif
        }