Code/C# (72) 썸네일형 리스트형 [C#] Exception Tracing Sample Code string exceptionLogFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), @"Exception.txt"); private void checkBoxTopMost_CheckedChanged(object sender, EventArgs e) { try { this.TopMost = this.checkBoxTopMost.Checked; } catch (Exception ex) { StackFrame fr = new StackFrame(true); StackTrace st = new StackTrace(fr); MethodBase mb = fr.GetMethod(); recordExceptionLog(ex, mb.Name, f.. [C#] Windows UI Automation Sample add UIAutomationClient.dll and UIAutomationTypes.dll libraries to project references using System.Diagnostics; using System.Threading; using System.Windows.Automation; namespace AutoTest { class Program { static void Main(string[] args) { bool isRun = false; Process[] myProcesses = Process.GetProcesses(); foreach (Process item in myProcesses) { if (item.ProcessName == "calc") { isRun = true; bre.. [C#] indexer sample using System; namespace IndexerSample { class Program { static void Main(string[] args) { IntBits bits = new IntBits(Int32.MaxValue); printIntBits(bits); printBinaryString(Int32.MaxValue); bits.Value = 1; printIntBits(bits); printBinaryString(1); bits.Value = 0; printIntBits(bits); printBinaryString(0); bits.Value = -1; printIntBits(bits); printBinaryString(-1); bits.Value = Int32.MinValue; prin.. [C#] Shift Operator perform a circular bit shift in C# (int32variable > (32 - bits)) using System; namespace Shifting { class Program { static void Main(string[] args) { int num; int cnt; Console.WriteLine("> Int32.MaxValue"); num = Int32.MaxValue; cnt = 0; do { printBinaryString(num, cnt); num = num >> 1; cnt++; } while (cnt > Int32.MinValue"); num = Int32.MinValue; .. [C#] Register/Unregister ActiveX Control regsvr32 acawebthumb.dll regsvr32 /u acawebthumb.dll using System; using System.Runtime.InteropServices; namespace WebThumbSample { class RegCOMServer { [DllImport("kernel32.dll")] static extern bool FreeLibrary(IntPtr hModule); [DllImport("kernel32.dll")] static extern IntPtr LoadLibrary(string lpFilename); [DllImport("kernel32.dll")] static extern UIntPtr GetProcAddress(IntPtr hModule, string .. [C#] Detect UserControl's Closing using System.Windows.Forms; namespace DetectUserControlClosing { public partial class UserControl1 : UserControl { public UserControl1() { InitializeComponent(); } protected override void OnCreateControl() { base.OnCreateControl(); this.ParentForm.FormClosing += new FormClosingEventHandler(ParentForm_FormClosing); } private void ParentForm_FormClosing(object sender, FormClosingEventArgs e) { Dia.. [C#] DockPanel Suite Sample using WeifenLuo.WinFormsUI.Docking; namespace DockPanelSample { public partial class FormChild : DockContent { public FormChild() { InitializeComponent(); } } } using System; using System.Windows.Forms; namespace DockPanelSample { public partial class FormMain : Form { private FormChild formChild1; private FormChild formChild2; private FormChild formChild3; private FormChild formChild4; public F.. [C#] DockPanel Suite Sample using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using WeifenLuo.WinFormsUI.Docking; namespace DockPanelSample { public partial class FormChild : DockContent { public FormChild() { InitializeComponent(); } } } using System; using System.Collections.Generic; using System.ComponentMo.. 이전 1 2 3 4 ··· 9 다음