본문 바로가기

프로그래밍105

[C#, WPF] 버튼 모서리 둥글게 만드는 방법 (원형 버튼) C#, WPF 기본 버튼의 스타일은 모서리가 네모 모양인데, 이를 둥글게 또는 원형 버튼으로 만드는 방법에 대해서 알아보도록 할게요. XAML에서 다음과 같이 코드를 수정하면 버튼의 모서리를 둥글게 만들 수 있어요. - 일반 버튼 - 모서리가 둥근 버튼 - 타원형의 버튼 CornerRadius의 Value의 숫자가 높을 수록 모서리가 둥글해지는 것을 확인할 수 있으며, 이를 통해 원형 모양의 버튼도 만들 수 있어요. - 전체 소스 코드 스타일 적용 시에는 모든 버튼 또는 해당 스타일을 적용한 버튼에 일괄 적용도 가능해요. 아래 스타일 적용 시에는 마우스 포인트가 버튼 위에 올라가면 나오는 마우스 오버 효과 등은 별도로 정의를 해줘야 하는니 참고하세요. (버튼 클릭 이벤트 등은 정상적으로 동작) - 스타일.. 2021. 4. 4.
[C#, WPF] 자기 자신의(실행 중인 프로그램)의 실행 경로 가져오는 방법 (실행 위치) * 코드 - 자기 자신(실행 중인 프로그램)의 실행 중인 경로 가져오기 string path = System.Reflection.Assembly.GetExecutingAssembly().Location; Debug.WriteLine(path); // 현재 실행중인 프로그램 명을 포함한 경로 path = System.IO.Path.GetDirectoryName(path); Debug.WriteLine(path); // 현재 실행중인 프로그램의 경로 * 실행 결과 D:\Test\WPF\WPF\bin\Debug\WPF_TEST.exe D:\Test\WPF\WPF\bin\Debug System.Reflection.Assembly.GetExecutingAssembly().Location; 는 현재 이 코드를 실행.. 2021. 3. 6.
[C#, WPF] INI 파일 쓰기, 읽는 방법 이번에는 C#에서 INI 파일을 쓰고, 읽어오는 방법에 대해서 알아보도록 할게요. * 코드 using System.Runtime.InteropServices; // INI 관련 [DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, string key, string val, string filePath); [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath); .. 2021. 3. 6.
[C#] 네트워크 인터페이스 정보 가져오기 (랜 카드, NIC) 이번에는 네트워크 인터페이스(네트워크 카드, NIC)를 정보를 가져오는 방법에 대해서 알아보도록 할게요. # 코드 using System.Net.NetworkInformation; // Code NetworkInterface[] nicArray = NetworkInterface.GetAllNetworkInterfaces(); foreach (NetworkInterface nic in nicArray) { Debug.Print("{0} / {1} / {2} / {3}", nic.Name, nic.Description, nic.NetworkInterfaceType.ToString(), nic.Id); } # 실행 결과 이더넷 / Realtek PCIe GbE Family Controller / Etherne.. 2021. 3. 1.
반응형