728x90
반응형
728x170
▶ NoScrollBarNativeWindow.cs
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
/// <summary>
/// 스크롤 바 없는 네이티브 윈도우
/// </summary>
public class NoScrollBarNativeWindow : NativeWindow
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Import
////////////////////////////////////////////////////////////////////////////////////////// Static
//////////////////////////////////////////////////////////////////////////////// Private
#region 스크롤 바 보여주기 - ShowScrollBar(windowHandle, scrollBarType, show)
/// <summary>
/// 스크롤 바 보여주기
/// </summary>
/// <param name="windowHandle">윈도우 핸들</param>
/// <param name="scrollBarType">스크롤 바 타입</param>
/// <param name="show">보여주기</param>
/// <returns>처리 결과</returns>
[DllImport("user32.dll")]
private static extern int ShowScrollBar(IntPtr windowHandle, int scrollBarType, int show);
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Field
////////////////////////////////////////////////////////////////////////////////////////// Private
#region Field
/// <summary>
/// WM_NCCALCSIZE
/// </summary>
private const int WM_NCCALCSIZE = 0x0083;
/// <summary>
/// SB_BOTH
/// </summary>
private const int SB_BOTH = 3;
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - NoScrollBarNativeWindow()
/// <summary>
/// 생성자
/// </summary>
public NoScrollBarNativeWindow()
{
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Protected
#region 윈도우 프로시저 처리하기 - WndProc(message)
/// <summary>
/// 윈도우 프로시저 처리하기
/// </summary>
/// <param name="message">Message</param>
protected override void WndProc(ref Message message)
{
switch(message.Msg)
{
case WM_NCCALCSIZE :
ShowScrollBar(message.HWnd, SB_BOTH, 0);
break;
}
base.WndProc(ref message);
}
#endregion
}
728x90
▶ MainForm.cs
using System;
using System.Windows.Forms;
/// <summary>
/// 메인 폼
/// </summary>
public partial class MainForm : Form
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainForm()
/// <summary>
/// 생성자
/// </summary>
public MainForm()
{
InitializeComponent();
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
#region 폼 로드시 처리하기 - Form_Load(sender, e)
/// <summary>
/// 폼 로드시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void Form_Load(object sender, EventArgs e)
{
NoScrollBarNativeWindow noScrollBarNativeWindow = new NoScrollBarNativeWindow();
for(int i = 0; i < Controls.Count; i++)
{
MdiClient mdiClient = Controls[i] as MdiClient;
if(mdiClient != null)
{
noScrollBarNativeWindow.ReleaseHandle();
noScrollBarNativeWindow.AssignHandle(mdiClient.Handle);
}
}
}
#endregion
}
728x90
반응형
그리드형(광고전용)
'C# > WinForm' 카테고리의 다른 글
[C#/WINFORM] WebBrowser 클래스 : 스크립트 오류 억제하기 (0) | 2014.12.03 |
---|---|
[C#/WINFORM] Form 클래스 : ProcessCmdKey 메소드를 재정의해 단축키 사용하기 (0) | 2014.12.03 |
[C#/WINFORM] Form 클래스 : Drag Drop 구현하기 (0) | 2014.12.03 |
[C#/WINFORM] DesignerCategoryAttribute 클래스 : 소스 코드 클릭시 디자이너 모드 방지하기 (0) | 2014.12.03 |
[C#/WINFORM] Form 클래스 : 대화 상자 폼에서 ProcessDialogKey 메소드 재정의 하기 (0) | 2014.12.03 |
[C#/WINFORM] Form 클래스 : 이벤트 발생 순서 (0) | 2014.12.03 |
[C#/WINFORM] TextBox 클래스 : 한글만 입력하기 (0) | 2014.12.03 |
[C#/WINFORM] Form 클래스 : 마우스로 폼 이동시키기 (0) | 2014.12.03 |
[C#/WINFORM] Form 클래스 : ALT+F4 키 방지하기 (0) | 2014.12.03 |
[C#/WINFORM] 마우스 이벤트 발생시키기 (0) | 2014.12.03 |
댓글을 달아 주세요