System.Collections.Generic;
3usingSystem.ComponentModel;
8usingSystem.Windows.Forms;
9usingSystem.Runtime.InteropServices;
23 public partial class Form1: Form
25 private intWM_COPYDATA = 0x004A;
29InitializeComponent();
31 public Form1(String title)
33InitializeComponent();
42[MarshalAs(UnmanagedType.LPStr)]
46[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name =
"FullTrust")]
47 protected override voidWndProc(ref Message m)
49 if(m.Msg == WM_COPYDATA)
52Type mytype = mystr.GetType();
55 if(text.ToLower().Trim().Equals(
"@CopyToClipboard".ToLower()))
59 else if(text.ToLower().Trim().StartsWith(
"@SaveAs".ToLower()))
61String fileName = text.Split()[1];
64 else if(text.ToLower().Trim().Equals(
"@Terminate".ToLower()))
70this.richTextBox1.Text += DateTime.Now.ToString(
"HH:mm:ss tt") +
": "+ text + Environment.NewLine;
71this.richTextBox1.SelectionStart = this.richTextBox1.Text.Length;
72this.richTextBox1.ScrollToCaret();
78 private voidCopyToClipboard()
80 if(this.richTextBox1.Text !=
null&&
this.richTextBox1.Text !=
"")
81Clipboard.SetText(this.richTextBox1.Text);
84 private voidSaveAs(String fileName)
86this.richTextBox1.SaveFile(fileName, RichTextBoxStreamType.PlainText);
89 private voidbutton1_Click(
objectsender, EventArgs e)
94 private voidbutton2_Click(
objectsender, EventArgs e)
96SaveFileDialog sfd =
newSaveFileDialog();
97sfd.Filter =
"Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
98 if(sfd.ShowDialog() == DialogResult.OK)
The little example demonstrates how to implement a custom visual log. From GAMS one can send messages...
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4