검색결과 리스트
winform에 해당되는 글 5건
- 2013.04.20 [.Net] Windows Service Current Directory
- 2013.03.13 [WinForm] OpenFileDialog
- 2013.02.22 [WinForm] 서브클래스에서 OnPaint가 안될때...
- 2013.01.28 [C#] Form close와 Dispose
- 2013.01.07 [.Net] pinvoke.net
글
윈도우즈 서비스에서
System.Environment.CurrentDirectory 을 호출하면 "C:\Windows\System32"를 카리킨다.
그럴때 두가지 방법이 있다.
1. System.Windows.Forms 을 참조하고 System.Windows.Forms.Application.StartupPath을 호출
2. System.Reflection.Assembly.GetEntryAssembly().Location
'.Net > .Net' 카테고리의 다른 글
[.Net] 닷넷프레임워크 버전 확인 (0) | 2013.05.10 |
---|---|
[.Net] TransactedInstaller (0) | 2013.04.22 |
[.Net] Changing Start Mode of a Windows Service (0) | 2013.04.20 |
[.Net] Mutex 클래스 (0) | 2013.04.19 |
[.Net] ServiceController (0) | 2013.04.18 |
트랙백
댓글
글
OpenFileDialog open_file_dialog = new OpenFileDialog();
open_file_dialog.Filter = "dat Files|*.dat|All Files|*.*";
open_file_dialog.FilterIndex = 1;
open_file_dialog.RestoreDirectory = true;try
{
if (open_file_dialog.ShowDialog() == DialogResult.OK)
{
import_path = open_file_dialog.FileName;
}
}
catch (System.Exception)
{
}
'.Net > WinForm' 카테고리의 다른 글
[.Net] FolderbrowserDialog Custom Action (0) | 2014.02.08 |
---|---|
[WinForm] 서브클래스에서 OnPaint가 안될때... (0) | 2013.02.22 |
트랙백
댓글
글
TextBox에 PlaceHolder 기능을 추가해야 해서 이것 저것 해보다가
OnPaint로 그릴 생각까지 했는데 분면 OnPaint를 오버라이드 했는데도 이벤트가 발생하지 않았습니다.
그럴때는 서브클래싱한 컨트롤에서 SetStyle을 설정('SetStyle(ControlStyles.userPaint, true)')해줘야 합니다.
SetStyle : http://msdn.microsoft.com/ko-kr/library/system.windows.forms.control.setstyle.aspx
그런데 구글링으로 찾은 소스중 보다 Win32 API를 이용해서 텍스트박스에 PlaceHolder 기능을 구현한게 있네요.
public class CueTextBox : TextBox
{
private static class NativeMethods
{
private const uint ECM_FIRST = 0x1500;
internal const uint EM_SETCUEBANNER = ECM_FIRST + 1;
[DllImport("user32.dll", EntryPoint = "SendMessageW")]
public static extern IntPtr SendMessageW(IntPtr hWnd, UInt32 Msg, IntPtr wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam);
}
private string _cue;
[
Description("PlaceHolder로 사용될 텍스트"),
Category("Appearance"),
Browsable(true),
]
public string Cue
{
get
{
return _cue;
}
set
{
_cue = value;
UpdateCue();
}
}
public CueTextBox()
{
this.SetStyle(ControlStyles.UserPaint, false);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
}
private void UpdateCue()
{
if (IsHandleCreated && _cue != null)
{
NativeMethods.SendMessageW(Handle, NativeMethods.EM_SETCUEBANNER, (IntPtr)1, _cue);
}
}
protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
UpdateCue();
}
}
'.Net > WinForm' 카테고리의 다른 글
[.Net] FolderbrowserDialog Custom Action (0) | 2014.02.08 |
---|---|
[WinForm] OpenFileDialog (0) | 2013.03.13 |
트랙백
댓글
글
링크 (Form.Dispose) : http://msdn.microsoft.com/ko-kr/library/aw58wzka(v=vs.90).aspx
링크 (Form.Close) : http://msdn.microsoft.com/ko-kr/library/system.windows.forms.form.close(v=vs.90).aspx
모달리스로 닫을시에는 Form.Close()를 호출
모달로 닫을시에는 Form.DialogResult 프로퍼티에 값을 대입
'.Net > C#' 카테고리의 다른 글
[C#] Mutex를 통한 다중 인스턴스 실행방지 (0) | 2013.02.08 |
---|---|
[C#] Visual Studio TODO 만들기 (0) | 2013.01.30 |
[C#] 정적 생성자 (static 멤버 초기화) (0) | 2013.01.15 |
[C#] Assemble.load (0) | 2013.01.15 |
[Visual Studio 2010] C# 선언할때 공백 제거 문제 (0) | 2013.01.14 |
트랙백
댓글
글
링크 : http://www.pinvoke.net/index.aspx
win32 API 를 .Net에서 사용할때 .Net에 맞게 DllImport를 해야 하는데 그 변환 문법이 만만치 않다.
각 함수별로 잘 정리되어 있는 사이트
* 사이트 메인 화면을 보면 Visual Studio 2010, 2012 Add-In 프로그램도 존재한다. Winform으로 개발시 유용할듯
'.Net > .Net' 카테고리의 다른 글
[.Net] Aspect Oriented Programming With .Net (0) | 2013.01.14 |
---|---|
[.Net] 웹 자동화 구현 클래스 (0) | 2013.01.09 |
[.Net] Windows 서비스 응용 프로그램 (0) | 2012.12.07 |
[.Net] Zlib Wrapper (0) | 2012.05.22 |
[.Net] Inter-Process Communication (0) | 2012.04.17 |
RECENT COMMENT