| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
-
- using System;
- using System.Windows.Forms;
- using PLC_S;
- namespace PLC_WF
- {
- public partial class F_Log : Form, IFormLogShow
- {
- public F_Log()
- {
- InitializeComponent();
- }
- public IShowFormLog ShowFormLog
- {
- get;
- set;
- }
- private void tsbWarp_Click(object sender, EventArgs e)
- {
- this.txtLog.WordWrap = !this.txtLog.WordWrap;
- if (this.txtLog.WordWrap)
- {
- this.tsbWarp.Text = "√折行";
- }
- else
- {
- this.tsbWarp.Text = " 折行";
- }
- }
- private void tsbClear_Click(object sender, EventArgs e)
- {
- this.txtLog.Text = null;
- }
- private int _loglen = 0;
- public void ShowLog(string log)
- {
- if (this.InvokeRequired)
- {
- this.BeginInvoke(new Action<string>(ShowLog), log);
- return;
- }
- if (_loglen > F_Main.PLC_LOG_LEN)
- {
- this.txtLog.Text = null;
- }
- this.txtLog.Text += log + System.Environment.NewLine;
- _loglen = this.txtLog.Text.Length;
- this.txtLog.SelectionStart = _loglen;
- this.txtLog.ScrollToCaret();
- }
- private void F_Log_FormClosed(object sender, FormClosedEventArgs e)
- {
- if (ShowFormLog != null)
- {
- ShowFormLog.FormLogShow = null;
- }
- }
- }
- }
|