mirror of
https://gitee.com/energye/energy.git
synced 2024-12-02 19:57:48 +08:00
Chromium zoom 开发示例
This commit is contained in:
parent
b4b7b41d98
commit
d36f0ddab5
@ -86,6 +86,22 @@
|
||||
<button onclick="find()">查找</button>
|
||||
<button onclick="findStop()">停止查找</button>
|
||||
<br>
|
||||
<script>
|
||||
function ZoomPct() {
|
||||
ipc.emit("ZoomPct");
|
||||
}
|
||||
function ZoomLevel() {
|
||||
ipc.emit("ZoomLevel");
|
||||
}
|
||||
function SetZoomStep() {
|
||||
ipc.emit("SetZoomStep");
|
||||
}
|
||||
</script>
|
||||
Chromium其它
|
||||
<button onclick="ZoomPct()">ZoomPct</button>
|
||||
<button onclick="ZoomLevel()">ZoomLevel</button>
|
||||
<button onclick="SetZoomStep()">SetZoomStep</button>
|
||||
<br>
|
||||
UI操作
|
||||
<button onclick="disabledUIBtn()">禁用【打印PDF】按钮</button>
|
||||
<button onclick="ipcServerOn()">IPC Server ON测试</button>
|
||||
|
@ -51,6 +51,26 @@ func AppBrowserInit() {
|
||||
//主进程 IPC事件
|
||||
ipc.IPC.Browser().SetOnEvent(func(event ipc.IEventOn) {
|
||||
fmt.Println("主进程IPC事件注册")
|
||||
event.On("ZoomPct", func(context ipc.IIPCContext) {
|
||||
fmt.Println("ZoomPct")
|
||||
bw := cef.BrowserWindow.GetWindowInfo(context.BrowserId())
|
||||
bw.Chromium().SetZoomPct(150.2)
|
||||
fmt.Println(bw.Chromium().ZoomPct())
|
||||
bw.Chromium().SetDefaultEncoding("UTF-8")
|
||||
fmt.Println(bw.Chromium().DefaultEncoding())
|
||||
})
|
||||
event.On("ZoomLevel", func(context ipc.IIPCContext) {
|
||||
fmt.Println("ZoomLevel")
|
||||
bw := cef.BrowserWindow.GetWindowInfo(context.BrowserId())
|
||||
bw.Chromium().SetZoomLevel(150.2)
|
||||
fmt.Println(bw.Chromium().ZoomLevel())
|
||||
})
|
||||
event.On("SetZoomStep", func(context ipc.IIPCContext) {
|
||||
fmt.Println("SetZoomStep")
|
||||
bw := cef.BrowserWindow.GetWindowInfo(context.BrowserId())
|
||||
bw.Chromium().SetZoomStep(1)
|
||||
fmt.Println(bw.Chromium().ZoomStep())
|
||||
})
|
||||
//这个事件监听演示了几个示例
|
||||
//1.
|
||||
event.On("subWindowIPCOn", func(context ipc.IIPCContext) {
|
||||
|
Loading…
Reference in New Issue
Block a user