Example #1
0
        }//chiusura form

        private void RTBText_TextChanged(object sender, EventArgs e)
        {
            RefreshControl.SuspendDrawing(MainSplit);
            ColorConfig.ColoraTesto(RTBText, color);


            if (RTBText.TextLength == 0)
            {
                RTBText.ForeColor = Color.White;
            }
            else
            if (RTBText.Text[RTBText.TextLength - 1] == ' ')
            {
                undoList.Push(RTBText.Text.Trim());
            }

            if (undoList.Count > 0)
            {
                annullaToolStripButton1.Enabled  = true;
                annullaToolStripMenuItem.Enabled = true;
            }

            if (!flag_modified)
            {
                flag_modified    = true;
                StatusLabel.Text = "Non Salvato";
            }
            RefreshControl.ResumeDrawing(MainSplit);
        }//Modifica Testo
Example #2
0
        }//gestione zoom

        private void RTBText_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\t')
            {
                RTBText.SelectedText  = "   ";
                RTBText.HideSelection = true;
                e.KeyChar             = ' ';
            }
            if (e.KeyChar == '\n' || e.KeyChar == '\r')
            {
                RefreshControl.SuspendDrawing(MainSplit);
                string line   = RTBText.Lines[RTBText.GetLineFromCharIndex(RTBText.SelectionStart) - 1];
                int    lineln = line.Length;
                line = line.Trim(' ');
                int _lineln = line.Length;
                int tabs    = (lineln - _lineln) / 4;
                for (int i = 0; i < tabs; i++)
                {
                    RTBText.SelectedText  = "    ";
                    RTBText.HideSelection = true;
                }
                RefreshControl.ResumeDrawing(MainSplit);
            }
        }