3월, 2012의 게시물 표시

WPF RichTextBox 의 기본 단축키 해제

RichTextBox의 Ctrl + I 같은 기본 단축키는 그냥 덮어씌우니 동작이 안되었다. 구글신에게 도움을 요청해서 겨우 찾았다. 아래 코드로 해제시킨후 쓰고자하는 command를 바인딩 한다. =========================아래 ============================== KeyBinding  keyBinding =  new   KeyBinding ( ApplicationCommands .NotACommand,  Key .L,                                                           ModifierKeys .Control);             richTextBoxMain.InputBindings.Add(keyBinding);             keyBinding =  new   KeyBinding ( ApplicationCommands .NotACommand,  Key .I,                                                           ModifierKeys .Control);             richTextBoxMain.InputBindings.Add(keyBinding);              ICommand  MyCmd =  new   MyCmd ();             keyBinding =  new   KeyBinding (MyCmd                          ,  Key .I,  ModifierKeys .Control             );             richTextBoxMain.InputBindings.Add(keyBinding); ================================= MyCmd는 적당히 ICommand 상속받아 사용하면 된다.

C# 에서 process invoke(fork)

c#에서 다른 프로세서를 호출하고 리턴값을 받기위한 소스이다. ==일단 c++===================================== #include   "stdafx.h" #include <iostream> int  _tmain( int  argc, _TCHAR* argv[]) { return  -12; } ===================================== == c#에서는 ================================= using  System; using  System.Diagnostics; using  System.Runtime.InteropServices; namespace  ConsoleCreateProcess {      public   struct   PROCESS_INFORMATION     {          public   IntPtr  hProcess;          public   IntPtr  hThread;          public   uint  dwProcessId;          public   uint  dwThreadId;     }      public   struct   STARTUPINFO     {          public   uint  cb;          public   string  lpReserved;          public   string  lpDesktop;          public   string  lpTitle;          public   uint  dwX;          public   uint  dwY;          public   uint  dwXSize;          public   uint  dwYSize;          public   uint  dwXCountChars;          public   uint  dwYCountChars;