Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
HZH_Controls
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 12f74f46
由
HZH
编写于
2019-09-12 16:19:57 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
组织结构图增加节点右键菜单
1 个父辈
bc45151d
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
104 行增加
和
6 行删除
HZH_Controls/HZH_Controls/Controls/FactoryControls/MindMapping/UCMindMapping.cs
HZH_Controls/HZH_Controls/Controls/FactoryControls/MindMapping/UCMindMappingPanel.cs
HZH_Controls/Test/Form5.Designer.cs
HZH_Controls/Test/Form5.cs
HZH_Controls/Test/Form5.resx
HZH_Controls/HZH_Controls/Controls/FactoryControls/MindMapping/UCMindMapping.cs
查看文件 @
12f74f4
...
...
@@ -31,6 +31,14 @@ namespace HZH_Controls.Controls
/// <seealso cref="System.Windows.Forms.UserControl" />
internal
class
UCMindMapping
:
UserControl
{
private
ContextMenuStrip
itemContextMenuStrip
;
[
Description
(
"节点关联的右键菜单"
),
Category
(
"自定义"
)]
public
ContextMenuStrip
ItemContextMenuStrip
{
get
{
return
itemContextMenuStrip
;
}
set
{
itemContextMenuStrip
=
value
;
}
}
private
Color
itemBackcolor
=
Color
.
FromArgb
(
255
,
77
,
59
);
[
Description
(
"节点背景色,优先级小于数据源中设置的背景色"
),
Category
(
"自定义"
)]
...
...
@@ -84,6 +92,14 @@ namespace HZH_Controls.Controls
/// The data source
/// </summary>
private
MindMappingItemEntity
dataSource
;
private
MindMappingItemEntity
selectEntity
;
[
Description
(
"选中的数据源"
),
Category
(
"自定义"
)]
public
MindMappingItemEntity
SelectEntity
{
get
{
return
selectEntity
;
}
private
set
{
selectEntity
=
value
;
}
}
/// <summary>
/// Gets or sets the data source.
/// </summary>
...
...
@@ -114,8 +130,11 @@ namespace HZH_Controls.Controls
this
.
Click
+=
UCMindMapping_Click
;
this
.
DoubleClick
+=
UCMindMapping_DoubleClick
;
this
.
Load
+=
UCMindMapping_Load
;
this
.
MouseClick
+=
UCMindMapping_MouseClick
;
}
/// <summary>
/// Handles the Load event of the UCMindMapping control.
/// </summary>
...
...
@@ -142,7 +161,7 @@ namespace HZH_Controls.Controls
{
var
mouseLocation
=
this
.
PointToClient
(
Control
.
MousePosition
);
bool
bln
=
Check
ExpansionDouble
Click
(
dataSource
,
mouseLocation
);
bool
bln
=
Check
DrawRect
Click
(
dataSource
,
mouseLocation
);
if
(
bln
)
{
ResetSize
();
...
...
@@ -167,13 +186,25 @@ namespace HZH_Controls.Controls
}
}
void
UCMindMapping_MouseClick
(
object
sender
,
MouseEventArgs
e
)
{
if
(
itemContextMenuStrip
!=
null
&&
e
.
Button
==
System
.
Windows
.
Forms
.
MouseButtons
.
Right
)
{
bool
bln
=
CheckDrawRectClick
(
dataSource
,
e
.
Location
,
false
);
if
(
bln
)
{
itemContextMenuStrip
.
Show
(
this
.
PointToScreen
(
e
.
Location
));
}
}
}
/// <summary>
/// 双击检查
/// </summary>
/// <param name="item">The item.</param>
/// <param name="mouseLocation">The mouse location.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
private
bool
Check
ExpansionDoubleClick
(
MindMappingItemEntity
item
,
Point
mouseLocation
)
private
bool
Check
DrawRectClick
(
MindMappingItemEntity
item
,
Point
mouseLocation
,
bool
blnDoExpansion
=
true
)
{
if
(
item
==
null
)
return
false
;
...
...
@@ -181,14 +212,15 @@ namespace HZH_Controls.Controls
{
if
(
item
.
DrawRectangle
.
Contains
(
mouseLocation
))
{
item
.
IsExpansion
=
!
item
.
IsExpansion
;
if
(
blnDoExpansion
)
item
.
IsExpansion
=
!
item
.
IsExpansion
;
return
true
;
}
if
(
item
.
Childrens
!=
null
&&
item
.
Childrens
.
Length
>
0
)
{
foreach
(
var
child
in
item
.
Childrens
)
{
var
bln
=
Check
ExpansionDoubleClick
(
child
,
mouseLocat
ion
);
var
bln
=
Check
DrawRectClick
(
child
,
mouseLocation
,
blnDoExpans
ion
);
if
(
bln
)
return
bln
;
}
...
...
@@ -209,10 +241,15 @@ namespace HZH_Controls.Controls
return
false
;
else
{
if
(
ItemClicked
!=
null
&&
item
.
DrawRectangle
.
Contains
(
mouseLocation
))
if
(
item
.
DrawRectangle
.
Contains
(
mouseLocation
))
{
ItemClicked
(
item
,
null
);
selectEntity
=
item
;
if
(
ItemClicked
!=
null
)
{
ItemClicked
(
item
,
null
);
}
}
if
(
item
.
ExpansionRectangle
.
Contains
(
mouseLocation
))
{
item
.
IsExpansion
=
!
item
.
IsExpansion
;
...
...
HZH_Controls/HZH_Controls/Controls/FactoryControls/MindMapping/UCMindMappingPanel.cs
查看文件 @
12f74f4
...
...
@@ -29,9 +29,23 @@ namespace HZH_Controls.Controls
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
[
DefaultEvent
(
"ItemClicked"
)]
public
partial
class
UCMindMappingPanel
:
UserControl
{
private
ContextMenuStrip
itemContextMenuStrip
;
[
Description
(
"节点关联的右键菜单"
),
Category
(
"自定义"
)]
public
ContextMenuStrip
ItemContextMenuStrip
{
get
{
return
itemContextMenuStrip
;
}
set
{
itemContextMenuStrip
=
value
;
this
.
ucMindMapping1
.
ItemContextMenuStrip
=
value
;
}
}
private
Color
itemBackcolor
=
Color
.
FromArgb
(
255
,
77
,
59
);
[
Description
(
"节点背景色,优先级小于数据源中设置的背景色"
),
Category
(
"自定义"
)]
...
...
@@ -89,6 +103,14 @@ namespace HZH_Controls.Controls
this
.
ucMindMapping1
.
LineColor
=
value
;
}
}
[
Description
(
"选中的数据源"
),
Category
(
"自定义"
)]
public
MindMappingItemEntity
SelectEntity
{
get
{
return
ucMindMapping1
.
SelectEntity
;
}
}
/// <summary>
/// Initializes a new instance of the <see cref="UCMindMappingPanel"/> class.
/// </summary>
...
...
HZH_Controls/Test/Form5.Designer.cs
查看文件 @
12f74f4
...
...
@@ -28,19 +28,41 @@
/// </summary>
private
void
InitializeComponent
()
{
this
.
components
=
new
System
.
ComponentModel
.
Container
();
this
.
contextMenuStrip1
=
new
System
.
Windows
.
Forms
.
ContextMenuStrip
(
this
.
components
);
this
.
aaaaaToolStripMenuItem
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
ucMindMappingPanel1
=
new
HZH_Controls
.
Controls
.
UCMindMappingPanel
();
this
.
contextMenuStrip1
.
SuspendLayout
();
this
.
SuspendLayout
();
//
// contextMenuStrip1
//
this
.
contextMenuStrip1
.
Items
.
AddRange
(
new
System
.
Windows
.
Forms
.
ToolStripItem
[]
{
this
.
aaaaaToolStripMenuItem
});
this
.
contextMenuStrip1
.
Name
=
"contextMenuStrip1"
;
this
.
contextMenuStrip1
.
Size
=
new
System
.
Drawing
.
Size
(
153
,
48
);
//
// aaaaaToolStripMenuItem
//
this
.
aaaaaToolStripMenuItem
.
Name
=
"aaaaaToolStripMenuItem"
;
this
.
aaaaaToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
152
,
22
);
this
.
aaaaaToolStripMenuItem
.
Text
=
"更改随机文本"
;
this
.
aaaaaToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
aaaaaToolStripMenuItem_Click
);
//
// ucMindMappingPanel1
//
this
.
ucMindMappingPanel1
.
AutoScroll
=
true
;
this
.
ucMindMappingPanel1
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
ucMindMappingPanel1
.
DataSource
=
null
;
this
.
ucMindMappingPanel1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
ucMindMappingPanel1
.
ItemBackcolor
=
System
.
Drawing
.
Color
.
FromArgb
(((
int
)(((
byte
)(
255
)))),
((
int
)(((
byte
)(
77
)))),
((
int
)(((
byte
)(
59
)))));
this
.
ucMindMappingPanel1
.
ItemContextMenuStrip
=
this
.
contextMenuStrip1
;
this
.
ucMindMappingPanel1
.
LineColor
=
System
.
Drawing
.
Color
.
Black
;
this
.
ucMindMappingPanel1
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
ucMindMappingPanel1
.
Name
=
"ucMindMappingPanel1"
;
this
.
ucMindMappingPanel1
.
Size
=
new
System
.
Drawing
.
Size
(
654
,
566
);
this
.
ucMindMappingPanel1
.
TabIndex
=
0
;
this
.
ucMindMappingPanel1
.
ItemClicked
+=
new
System
.
EventHandler
(
this
.
ucMindMappingPanel1_ItemClicked
);
//
// Form5
//
...
...
@@ -51,6 +73,7 @@
this
.
Name
=
"Form5"
;
this
.
Text
=
"Form5"
;
this
.
Load
+=
new
System
.
EventHandler
(
this
.
Form5_Load
);
this
.
contextMenuStrip1
.
ResumeLayout
(
false
);
this
.
ResumeLayout
(
false
);
}
...
...
@@ -58,5 +81,7 @@
#
endregion
private
HZH_Controls
.
Controls
.
UCMindMappingPanel
ucMindMappingPanel1
;
private
System
.
Windows
.
Forms
.
ContextMenuStrip
contextMenuStrip1
;
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
aaaaaToolStripMenuItem
;
}
}
\ No newline at end of file
HZH_Controls/Test/Form5.cs
查看文件 @
12f74f4
...
...
@@ -60,5 +60,16 @@ namespace Test
MessageBox
.
Show
(
exc
.
ToString
(),
"错误"
);
}
}
private
void
ucMindMappingPanel1_ItemClicked
(
object
sender
,
EventArgs
e
)
{
HZH_Controls
.
Forms
.
FrmTips
.
ShowTipsSuccess
(
this
,
ucMindMappingPanel1
.
SelectEntity
.
Text
);
}
private
void
aaaaaToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
{
ucMindMappingPanel1
.
SelectEntity
.
Text
=
Guid
.
NewGuid
().
ToString
();
ucMindMappingPanel1
.
Refresh
();
}
}
}
HZH_Controls/Test/Form5.resx
查看文件 @
12f74f4
...
...
@@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论