Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
Ftt_Common
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Ftt_Common
Commits
cb4f5dc8
Commit
cb4f5dc8
authored
Aug 24, 2021
by
tr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、CEF示例:界面微调
parent
c9bb097e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
14 deletions
+39
-14
Tools.exe.config
AppHome/Tools.exe.config
+1
-1
Program.cs
Tools/Program.cs
+7
-0
wCefDemo.cs
Tools/UI/wCefDemo.cs
+31
-13
No files found.
AppHome/Tools.exe.config
View file @
cb4f5dc8
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
configuration
>
<
appSettings
>
<
appSettings
>
<
add
key
=
"UpdateTime"
value
=
"2021-08-1
1 17:21:10.5
23"
/>
<
add
key
=
"UpdateTime"
value
=
"2021-08-1
9 17:29:13.6
23"
/>
</
appSettings
>
</
appSettings
>
<
startup
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.8"
/>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.8"
/>
...
...
Tools/Program.cs
View file @
cb4f5dc8
...
@@ -5,6 +5,9 @@ using System.IO;
...
@@ -5,6 +5,9 @@ using System.IO;
using
System.Linq
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
using
System.Windows.Forms
;
//
using
CefSharp
;
using
CefSharp.WinForms
;
namespace
Tools
namespace
Tools
{
{
...
@@ -16,6 +19,10 @@ namespace Tools
...
@@ -16,6 +19,10 @@ namespace Tools
[
STAThread
]
[
STAThread
]
static
void
Main
()
static
void
Main
()
{
{
CefSettings
cefSettings
=
new
CefSettings
();
cefSettings
.
DisableGpuAcceleration
();
Cef
.
Initialize
(
cefSettings
);
//
Application
.
EnableVisualStyles
();
Application
.
EnableVisualStyles
();
Application
.
SetCompatibleTextRenderingDefault
(
false
);
Application
.
SetCompatibleTextRenderingDefault
(
false
);
Application
.
Run
(
new
wMain
());
Application
.
Run
(
new
wMain
());
...
...
Tools/UI/wCefDemo.cs
View file @
cb4f5dc8
...
@@ -33,13 +33,17 @@ namespace Tools.UI
...
@@ -33,13 +33,17 @@ namespace Tools.UI
//browser = new ChromiumWebBrowser("jhdsoft.gicp.net:21802/#/login?redirect=%2Fhome");
//browser = new ChromiumWebBrowser("jhdsoft.gicp.net:21802/#/login?redirect=%2Fhome");
browser
=
new
ChromiumWebBrowser
(
"jhdsoft.gicp.net:9201/lining_Dev/#/Home"
);
browser
=
new
ChromiumWebBrowser
(
"jhdsoft.gicp.net:9201/lining_Dev/#/Home"
);
toolStripContainer1
.
ContentPanel
.
Controls
.
Add
(
browser
);
toolStripContainer1
.
ContentPanel
.
Controls
.
Add
(
browser
);
browser
.
Show
();
//浏览器事件绑定
//浏览器事件绑定
browser
.
IsBrowserInitializedChanged
+=
OnIsBrowserInitializedChanged
;
browser
.
IsBrowserInitializedChanged
+=
OnIsBrowserInitializedChanged
;
browser
.
LoadingStateChanged
+=
OnLoadingStateChanged
;
browser
.
LoadingStateChanged
+=
OnLoadingStateChanged
;
browser
.
TitleChanged
+=
OnBrowserTitleChanged
;
browser
.
TitleChanged
+=
OnBrowserTitleChanged
;
browser
.
AddressChanged
+=
OnBrowserAddressChanged
;
browser
.
AddressChanged
+=
OnBrowserAddressChanged
;
//窗体事件
this
.
FormClosing
+=
WCefDemo_FormClosing
;
//菜单栏事件
//菜单栏事件
this
.
menuStrip1
.
Visible
=
false
;
this
.
tsmiShowDevTools
.
Click
+=
TsmiShowDevTools_Click
;
this
.
tsmiShowDevTools
.
Click
+=
TsmiShowDevTools_Click
;
this
.
tsmiExit
.
Click
+=
TsmiExit_Click
;
this
.
tsmiExit
.
Click
+=
TsmiExit_Click
;
//工具栏事件
//工具栏事件
...
@@ -51,6 +55,12 @@ namespace Tools.UI
...
@@ -51,6 +55,12 @@ namespace Tools.UI
}
}
}
}
//窗体:关闭前
private
void
WCefDemo_FormClosing
(
object
sender
,
FormClosingEventArgs
e
)
{
this
.
CloseBrowser
();
}
#
region
浏览器相关事件
#
region
浏览器相关事件
//浏览器上的初始化是否已更改
//浏览器上的初始化是否已更改
...
@@ -94,8 +104,7 @@ namespace Tools.UI
...
@@ -94,8 +104,7 @@ namespace Tools.UI
//退出
//退出
private
void
TsmiExit_Click
(
object
sender
,
EventArgs
e
)
private
void
TsmiExit_Click
(
object
sender
,
EventArgs
e
)
{
{
browser
.
Dispose
();
this
.
CloseBrowser
();
Cef
.
Shutdown
();
this
.
Close
();
this
.
Close
();
}
}
...
@@ -135,6 +144,26 @@ namespace Tools.UI
...
@@ -135,6 +144,26 @@ namespace Tools.UI
#
region
自定义方法
#
region
自定义方法
/// <summary>
/// 加载网页
/// </summary>
/// <param name="url"></param>
private
void
LoadUrl
(
string
url
)
{
if
(
Uri
.
IsWellFormedUriString
(
url
,
UriKind
.
RelativeOrAbsolute
))
{
browser
.
Load
(
url
);
}
}
/// <summary>
/// 关闭浏览器
/// </summary>
private
void
CloseBrowser
()
{
browser
.
Dispose
();
Cef
.
Shutdown
();
}
/// <summary>
/// <summary>
/// 重置地址栏长度(依赖:ToolStripItem.AutoSize=false)
/// 重置地址栏长度(依赖:ToolStripItem.AutoSize=false)
/// </summary>
/// </summary>
...
@@ -150,17 +179,6 @@ namespace Tools.UI
...
@@ -150,17 +179,6 @@ namespace Tools.UI
}
}
this
.
UrlTextBox
.
Width
=
Math
.
Max
(
0
,
width
-
UrlTextBox
.
Margin
.
Horizontal
-
18
);
this
.
UrlTextBox
.
Width
=
Math
.
Max
(
0
,
width
-
UrlTextBox
.
Margin
.
Horizontal
-
18
);
}
}
/// <summary>
/// 加载网页
/// </summary>
/// <param name="url"></param>
private
void
LoadUrl
(
string
url
)
{
if
(
Uri
.
IsWellFormedUriString
(
url
,
UriKind
.
RelativeOrAbsolute
))
{
browser
.
Load
(
url
);
}
}
#
endregion
#
endregion
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment