Exemplo n.º 1
0
 private void TsbSave_Click(object sender, EventArgs e)
 {
     if (save)
     {
         if (title.Trim() != "")
         {
             string filename = TsbTbx.Text + "\\" + title.Trim() + ".xml";
             if (File.Exists(filename))
             {
                 DialogResult dr = MessageBox.Show("文件已存在,是否覆盖?", "保存", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                 if (dr == DialogResult.OK)
                 {
                     File.Delete(filename);
                     Rtb.SaveFile(filename, RichTextBoxStreamType.PlainText);
                 }
             }
             else
             {
                 MessageBox.Show("保存成功!");
                 Rtb.SaveFile(filename, RichTextBoxStreamType.PlainText);
             }
         }
     }
     else
     {
         MessageBox.Show("保存失败,请确保语法无误");
     }
 }
Exemplo n.º 2
0
 public ShowStringForm(string title, string text, bool scrollToBottom)
 {
     InitializeComponent();
     Text          = title + " - InputMaster";
     StartPosition = FormStartPosition.CenterScreen;
     Rtb.Text      = text;
     if (scrollToBottom)
     {
         Rtb.ScrollToBottom();
     }
 }
Exemplo n.º 3
0
 private void LineFun(string value)
 {
     if (Rtb.Lines.Length > 1000)
     {
         Rtb.Select(0, Rtb.Lines[0].Length);
         Rtb.SelectedText = string.Empty;
     }
     Rtb.Select(Rtb.TextLength, 0);
     Rtb.SelectionColor = Color;
     Rtb.SelectedText   = value + "\r\n";
 }
Exemplo n.º 4
0
 public void Line(string value)
 {
     if (Rtb == null)
     {
         return;
     }
     try
     {
         Rtb.Invoke(new MethodInvoker(delegate()  //初始化
         {
             LineFun(value);
         }));
     }
     catch
     {
     }
 }
Exemplo n.º 5
0
 private void TsbTransform_TextChanged(object sender, EventArgs e)
 {
     if (TsbTransform.Text == "TXT")
     {
         //Console.WriteLine("Rtb已经显示");
         Ste.Hide();
         Rtb.Show();
         TsbTransform.ToolTipText = "显示超文本视图";
     }
     //if (TsbTransform.ToolTipText == "显示超文本视图")
     else
     {
         Rtb.Hide();
         Ste.Show();
         TsbTransform.ToolTipText = "显示文本视图";
     }
 }
Exemplo n.º 6
0
        }                                                 // (disable this adorner for debugging purposes)


        public WhitespaceAdorner(MyRichTextBox rtb, ChangeEventHelper ceh) : base(rtb)
        {
            ChangeEventHelper = ceh;
            Debug.Assert(ChangeEventHelper != null);

            WsBrush.Freeze( );
            TabPen.Freeze( );
            EolPen.Freeze( );
            EofPen.Freeze( );
            EofBrush.Freeze( );

            IsHitTestVisible = false;

            Rtb.TextChanged += Rtb_TextChanged;
            Rtb.AddHandler(ScrollViewer.ScrollChangedEvent, new RoutedEventHandler(Rtb_ScrollChanged), true);

            Loop = new ResumableLoop(ThreadProc, 33, 33, 444);
        }
Exemplo n.º 7
0
 public void novoDocumento()
 {
     if (!string.IsNullOrEmpty(Rtb.Text))
     {
         if (MessageBox.Show("Deseja salvar as alterações em Sem titulo?", "Editor de texto", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
         {
             salvarSimples();
             this.arquivoSalvo = false;
             this.diretorio    = "";
             Rtb.Clear();
             Rtb.Focus();
         }
         else
         {
             this.arquivoSalvo = false;
             this.diretorio    = "";
             this.Text         = "Sem título - Bloco de notas";
             Rtb.Clear();
             Rtb.Focus();
         }
     }
 }