Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
HZH_Controls
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit ee88a653
由
HZH
编写于
2019-08-29 15:52:51 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
解决无焦点窗体bug
1 个父辈
528e0a13
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
45 行增加
和
39 行删除
HZH_Controls/HZH_Controls/Controls/ComboBox/UCComboxGrid.cs
HZH_Controls/HZH_Controls/Forms/FrmAnchor.cs
HZH_Controls/Test/Form2.cs
HZH_Controls/HZH_Controls/Controls/ComboBox/UCComboxGrid.cs
查看文件 @
ee88a65
...
@@ -119,7 +119,7 @@ namespace HZH_Controls.Controls.ComboBox
...
@@ -119,7 +119,7 @@ namespace HZH_Controls.Controls.ComboBox
m_ucPanel
.
DataSource
=
m_dataSource
;
m_ucPanel
.
DataSource
=
m_dataSource
;
if
(
_frmAnchor
==
null
||
_frmAnchor
.
IsDisposed
||
_frmAnchor
.
Visible
==
false
)
if
(
_frmAnchor
==
null
||
_frmAnchor
.
IsDisposed
||
_frmAnchor
.
Visible
==
false
)
{
{
_frmAnchor
=
new
Forms
.
FrmAnchor
(
this
,
m_ucPanel
);
_frmAnchor
=
new
Forms
.
FrmAnchor
(
this
,
m_ucPanel
,
isNotFocus
:
false
);
_frmAnchor
.
Show
(
this
.
FindForm
());
_frmAnchor
.
Show
(
this
.
FindForm
());
}
}
...
...
HZH_Controls/HZH_Controls/Forms/FrmAnchor.cs
查看文件 @
ee88a65
...
@@ -28,6 +28,7 @@ namespace HZH_Controls.Forms
...
@@ -28,6 +28,7 @@ namespace HZH_Controls.Forms
private
bool
blnDown
=
true
;
private
bool
blnDown
=
true
;
Size
m_size
;
Size
m_size
;
Point
?
m_deviation
;
Point
?
m_deviation
;
bool
m_isNotFocus
=
true
;
#
region
构造函数
#
region
构造函数
/// <summary>
/// <summary>
/// 功能描述:构造函数
/// 功能描述:构造函数
...
@@ -38,8 +39,9 @@ namespace HZH_Controls.Forms
...
@@ -38,8 +39,9 @@ namespace HZH_Controls.Forms
/// <param name="parentControl">父控件</param>
/// <param name="parentControl">父控件</param>
/// <param name="childControl">子控件</param>
/// <param name="childControl">子控件</param>
/// <param name="deviation">偏移</param>
/// <param name="deviation">偏移</param>
public
FrmAnchor
(
Control
parentControl
,
Control
childControl
,
Point
?
deviation
=
null
)
public
FrmAnchor
(
Control
parentControl
,
Control
childControl
,
Point
?
deviation
=
null
,
bool
isNotFocus
=
true
)
{
{
m_isNotFocus
=
isNotFocus
;
m_parentControl
=
parentControl
;
m_parentControl
=
parentControl
;
InitializeComponent
();
InitializeComponent
();
this
.
Size
=
childControl
.
Size
;
this
.
Size
=
childControl
.
Size
;
...
@@ -62,13 +64,10 @@ namespace HZH_Controls.Forms
...
@@ -62,13 +64,10 @@ namespace HZH_Controls.Forms
parentControl
.
LocationChanged
+=
frmP_LocationChanged
;
parentControl
.
LocationChanged
+=
frmP_LocationChanged
;
}
}
void
frmP_LocationChanged
(
object
sender
,
EventArgs
e
)
{
this
.
Hide
();
}
public
FrmAnchor
(
Control
parentControl
,
Size
size
,
Point
?
deviation
=
null
)
public
FrmAnchor
(
Control
parentControl
,
Size
size
,
Point
?
deviation
=
null
,
bool
isNotFocus
=
true
)
{
{
m_isNotFocus
=
isNotFocus
;
m_parentControl
=
parentControl
;
m_parentControl
=
parentControl
;
InitializeComponent
();
InitializeComponent
();
this
.
Size
=
size
;
this
.
Size
=
size
;
...
@@ -79,6 +78,10 @@ namespace HZH_Controls.Forms
...
@@ -79,6 +78,10 @@ namespace HZH_Controls.Forms
m_deviation
=
deviation
;
m_deviation
=
deviation
;
}
}
void
frmP_LocationChanged
(
object
sender
,
EventArgs
e
)
{
this
.
Hide
();
}
#
endregion
#
endregion
private
void
FrmDownBoard_HandleDestroyed
(
object
sender
,
EventArgs
e
)
private
void
FrmDownBoard_HandleDestroyed
(
object
sender
,
EventArgs
e
)
...
@@ -93,37 +96,40 @@ namespace HZH_Controls.Forms
...
@@ -93,37 +96,40 @@ namespace HZH_Controls.Forms
#
region
无焦点窗体
#
region
无焦点窗体
//[System.Runtime.InteropServices.DllImport("user32.dll")]
[
System
.
Runtime
.
InteropServices
.
DllImport
(
"user32.dll"
)]
//private extern static IntPtr SetActiveWindow(IntPtr handle);
private
extern
static
IntPtr
SetActiveWindow
(
IntPtr
handle
);
//private const int WM_ACTIVATE = 0x006;
private
const
int
WM_ACTIVATE
=
0x006
;
//private const int WM_ACTIVATEAPP = 0x01C;
private
const
int
WM_ACTIVATEAPP
=
0x01C
;
//private const int WM_NCACTIVATE = 0x086;
private
const
int
WM_NCACTIVATE
=
0x086
;
//private const int WA_INACTIVE = 0;
private
const
int
WA_INACTIVE
=
0
;
//private const int WM_MOUSEACTIVATE = 0x21;
private
const
int
WM_MOUSEACTIVATE
=
0x21
;
//private const int MA_NOACTIVATE = 3;
private
const
int
MA_NOACTIVATE
=
3
;
//protected override void WndProc(ref Message m)
protected
override
void
WndProc
(
ref
Message
m
)
//{
{
// if (m.Msg == WM_MOUSEACTIVATE)
if
(
m_isNotFocus
)
// {
{
// m.Result = new IntPtr(MA_NOACTIVATE);
if
(
m
.
Msg
==
WM_MOUSEACTIVATE
)
// return;
{
// }
m
.
Result
=
new
IntPtr
(
MA_NOACTIVATE
);
// else if (m.Msg == WM_NCACTIVATE)
return
;
// {
}
// if (((int)m.WParam & 0xFFFF) != WA_INACTIVE)
else
if
(
m
.
Msg
==
WM_NCACTIVATE
)
// {
{
// if (m.LParam != IntPtr.Zero)
if
(((
int
)
m
.
WParam
&
0xFFFF
)
!=
WA_INACTIVE
)
// {
{
// SetActiveWindow(m.LParam);
if
(
m
.
LParam
!=
IntPtr
.
Zero
)
// }
{
// else
SetActiveWindow
(
m
.
LParam
);
// {
}
// SetActiveWindow(IntPtr.Zero);
else
// }
{
// }
SetActiveWindow
(
IntPtr
.
Zero
);
// }
}
// base.WndProc(ref m);
}
//}
}
}
base
.
WndProc
(
ref
m
);
}
#
endregion
#
endregion
...
...
HZH_Controls/Test/Form2.cs
查看文件 @
ee88a65
...
@@ -68,7 +68,7 @@ namespace Test
...
@@ -68,7 +68,7 @@ namespace Test
private
void
ucDropDownBtn1_BtnClick
(
object
sender
,
EventArgs
e
)
private
void
ucDropDownBtn1_BtnClick
(
object
sender
,
EventArgs
e
)
{
{
HZH_Controls
.
Forms
.
FrmTips
.
ShowTipsSuccess
(
this
,
sender
.
ToString
());
HZH_Controls
.
Forms
.
FrmTips
.
ShowTipsSuccess
(
this
,
sender
.
ToString
());
}
}
private
void
button1_Click_1
(
object
sender
,
EventArgs
e
)
private
void
button1_Click_1
(
object
sender
,
EventArgs
e
)
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论