Microsoft MVP성태의 닷넷 이야기
.NET Framework: 105. WPF - 닫기 버튼을 없애려면. [링크 복사], [링크+제목 복사],
조회: 25231
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 


WPF - 닫기 버튼을 없애려면.


결론부터 말하면. 아직(?) WPF에서는 닫기 버튼을 없애는 방법이 제공되지 않습니다. 이에 대해서는 아래의 토픽에 나오는데요.

How do you disable Minimize, Maximize, Close buttons + remove app icon on a WPF window?
; http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/d74820db-a002-4d4e-b96e-02d29dc4a119/

근데, 위에서 알려준 코드가 ^^; WS_EX_DLGMODALFRAME을 설정하는 것이 아닌지라 별 도움이 안됩니다. 그래서 일단, 제가 알던 Win32 API 프로그래밍 실력대로 만들어 보면, 아래와 같지요. ^^

IntPtr hwnd = new System.Windows.Interop.WindowInteropHelper(this).Handle;

int windowLong = SafeNativeMethod.GetWindowLong(hwnd, SafeNativeMethod.GWL_STYLE);
windowLong = windowLong ^ SafeNativeMethod.WS_SYSMENU;
UnsafeNativeMethods.SetWindowLong(hwnd, SafeNativeMethod.GWL_STYLE, windowLong);

보시는 것처럼, 그냥 WS_SYSMENU 스타일만 제거해 주시면 됩니다. 해보진 않았지만, 위의 포럼에서 "Hamid Mahmood"의 답변에서는 Window 클래스의 SourceInitialized 이벤트에서만 설정이 가능하다고 했지만, WS_SYSMENU 스타일만 제거하는 코드는 어디서 불러도 상관없을 것입니다.

(GetWindowLong/SetWindowLong, WS_SYSMENT/GWL_STYLE 값들은 PInvoke 사이트에서 참조하십시오. ^^)




[이 토픽에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]







[최초 등록일: ]
[최종 수정일: 4/10/2022]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 61  62  63  64  65  66  67  68  69  70  [71]  72  73  74  75  ...
NoWriterDateCnt.TitleFile(s)
12162정성태2/26/202021840디버깅 기술: 166. C#에서 만든 COM 객체를 C/C++로 P/Invoke Interop 시 메모리 누수(Memory Leak) 발생 [6]파일 다운로드2
12161정성태2/26/202017885오류 유형: 597. manifest - The value "x64" of attribute "processorArchitecture" in element "assemblyIdentity" is invalid.
12160정성태2/26/202018248개발 환경 구성: 469. Reg-free COM 개체 사용을 위한 manifest 파일 생성 도구 - COMRegFreeManifest
12159정성태2/26/202015357오류 유형: 596. Visual Studio - The project needs to include ATL support
12158정성태2/25/202017937디버깅 기술: 165. C# - Marshal.GetIUnknownForObject/GetIDispatchForObject 사용 시 메모리 누수(Memory Leak) 발생파일 다운로드1
12157정성태2/25/202017977디버깅 기술: 164. C# - Marshal.GetNativeVariantForObject 사용 시 메모리 누수(Memory Leak) 발생 및 해결 방법파일 다운로드1
12156정성태2/25/202016554오류 유형: 595. LINK : warning LNK4098: defaultlib 'nafxcw.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
12155정성태2/25/202016012오류 유형: 594. Warning NU1701 - This package may not be fully compatible with your project
12154정성태2/25/202015388오류 유형: 593. warning LNK4070: /OUT:... directive in .EXP differs from output filename
12153정성태2/23/202019507.NET Framework: 898. Trampoline을 이용한 후킹의 한계파일 다운로드1
12152정성태2/23/202018570.NET Framework: 897. 실행 시에 메서드 가로채기 - CLR Injection: Runtime Method Replacer 개선 - 세 번째 이야기(Trampoline 후킹)파일 다운로드1
12151정성태2/22/202019356.NET Framework: 896. C# - Win32 API를 Trampoline 기법을 이용해 C# 메서드로 가로채는 방법 - 두 번째 이야기 (원본 함수 호출)파일 다운로드1
12150정성태2/21/202019607.NET Framework: 895. C# - Win32 API를 Trampoline 기법을 이용해 C# 메서드로 가로채는 방법 [1]파일 다운로드1
12149정성태2/20/202018417.NET Framework: 894. eBEST C# XingAPI 래퍼 - 연속 조회 처리 방법 [1]
12148정성태2/19/202020944디버깅 기술: 163. x64 환경에서 구현하는 다양한 Trampoline 기법 [1]
12147정성태2/19/202018624디버깅 기술: 162. x86/x64의 기계어 코드 최대 길이
12146정성태2/18/202019372.NET Framework: 893. eBEST C# XingAPI 래퍼 - 로그인 처리파일 다운로드1
12145정성태2/18/202019233.NET Framework: 892. eBEST C# XingAPI 래퍼 - Sqlite 지원 추가파일 다운로드1
12144정성태2/13/202019424.NET Framework: 891. 실행 시에 메서드 가로채기 - CLR Injection: Runtime Method Replacer 개선 - 두 번째 이야기파일 다운로드1
12143정성태2/13/202015991.NET Framework: 890. 상황별 GetFunctionPointer 반환값 정리 - x64파일 다운로드1
12142정성태2/12/202018346.NET Framework: 889. C# 코드로 접근하는 MethodDesc, MethodTable파일 다운로드1
12141정성태2/10/202017381.NET Framework: 888. C# - ASP.NET Core 웹 응용 프로그램의 출력 가로채기 [2]파일 다운로드1
12140정성태2/10/202017923.NET Framework: 887. C# - ASP.NET 웹 응용 프로그램의 출력 가로채기파일 다운로드1
12139정성태2/9/202019185.NET Framework: 886. C# - Console 응용 프로그램에서 UI 스레드 구현 방법
12138정성태2/9/202023208.NET Framework: 885. C# - 닷넷 응용 프로그램에서 SQLite 사용 [6]파일 다운로드1
12137정성태2/9/202016432오류 유형: 592. [AhnLab] 경고 - 디버거 실행을 탐지했습니다.
... 61  62  63  64  65  66  67  68  69  70  [71]  72  73  74  75  ...