日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > HTML >内容正文

HTML

html添加工具栏,添加带有命令的工具栏 (HTML)

發布時間:2025/3/12 HTML 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 html添加工具栏,添加带有命令的工具栏 (HTML) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

添加帶有命令的工具欄 (HTML)

03/04/2016

本文內容

[ 本文適用于編寫 Windows 運行時應用的 Windows 8.x 和 Windows Phone 8.x 開發人員。如果你要針對 Windows 10 進行開發,請參閱 最新文檔 ]

ToolBar 是一個簡單的控件,用于解決命令擴展問題。它具有一個 action area,其中的命令可以立即使用;還具有一個 overflow area,其中的命令處于隱藏狀態,但可以根據最終用戶發出的請求進行顯示。該控件通過在空間受限時,允許命令以動態方式從主要區域移動到輔助區域,從而支持自適應行為。 ToolBar 不限于某個應用中的單個位置,而可以位于如 Splitview、Flyout 等多個位置中以及 canvas 上。

注意??可以在嘗試 WinJS 網站上查看以下編碼方案的詳細信息。

創建帶有以聲明方式添加的命令的工具欄

可以以聲明方式將命令添加到工具欄。在此方案中,工具欄具有四個主要命令和兩個輔助命令。

WinJS.Namespace.define("Sample", {

outputCommand: WinJS.UI.eventHandler(function (ev) {

var status = document.querySelector(".status");

var command = ev.currentTarget;

if (command.winControl) {

var label = command.winControl.label || command.winControl.icon || "button";

var section = command.winControl.section || "";

var msg = section + " command " + label + " was pressed";

status.textContent = msg;

}

})

});

WinJS.UI.processAll();

指定命令的分組和退出順序

開發人員可以針對不遵循可見的從右到左順序的溢出區域指定命令的分組和退出順序。這可用于屏幕空間受限的情況。控件按從最高值到最低值的順序退出。默認情況下,這些命令按從右到左的順序退出。但優先級的默認值是未定義的。

WinJS.Namespace.define("Sample", {

outputCommand: WinJS.UI.eventHandler(function (ev) {

var status = document.querySelector(".status");

var command = ev.currentTarget;

if (command.winControl) {

var label = command.winControl.label || command.winControl.icon || "button";

var section = command.winControl.section || "";

var priority = command.winControl.priority;

var msg = section + " command " + label + " with priority " + priority + " was pressed";

status.textContent = msg;

}

})

});

WinJS.UI.processAll();

同時顯示多個工具欄

開發人員可以創建多個工具欄,并同時顯示它們。

WinJS.Namespace.define("Sample", {

outputCommand: WinJS.UI.eventHandler(function (ev) {

var status = document.querySelector(".status");

var command = ev.currentTarget;

if (command.winControl) {

var label = command.winControl.label || command.winControl.icon || "button";

var section = command.winControl.section || "";

var msg = section + " command " + label + " was pressed";

status.textContent = msg;

}

})

});

WinJS.UI.processAll();

創建帶有使用 WinJS.Binding.List 添加的命令的工具欄

WinJS.Binding.List 可用于通過帶有命令的工具欄的 data 屬性,填充該工具欄。

data-win-options="{data: Sample.commandList}">

WinJS.Namespace.define("Sample", {

commandList: null,

outputCommand: WinJS.UI.eventHandler(function (ev) {

var status = document.querySelector(".status");

var command = ev.currentTarget;

if (command.winControl) {

var label = command.winControl.label || command.winControl.icon || "button";

var section = command.winControl.section || "";

var msg = section + " command " + label + " was pressed";

status.textContent = msg;

}

})

});

var dataArray = [

new WinJS.UI.Command(null,

{ id: 'cmdEdit', label: 'edit', section: 'primary', type: 'button', icon: 'edit', onclick: Sample.outputCommand }),

new WinJS.UI.Command(null,

{ id: 'cmdDelete', label: 'delete', section: 'primary', type: 'button', icon: 'delete', onclick: Sample.outputCommand }),

new WinJS.UI.Command(null,

{ id: 'cmdFavorite', label: 'favorite', section: 'primary', type: 'toggle', icon: 'favorite',

onclick: Sample.outputCommand }),

new WinJS.UI.Command(null,

{ id: 'cmdOpenWith', label: 'open with', section: 'primary', type: 'button', icon: 'openfile',

onclick: Sample.outputCommand }),

new WinJS.UI.Command(null,

{ id: 'cmdDownload', label: 'download', section: 'primary', type: 'button', icon: 'download',

onclick: Sample.outputCommand }),

new WinJS.UI.Command(null,

{ id: 'cmdPin', label: 'pin', section: 'primary', type: 'button', icon: 'pin', onclick: Sample.outputCommand }),

new WinJS.UI.Command(null,

{ id: 'cmdZoom', label: 'zoom', section: 'primary', type: 'button', icon: 'zoomin', onclick: Sample.outputCommand }),

new WinJS.UI.Command(null,

{ id: 'cmdFullscreen', label: 'full screen', section: 'primary', type: 'button', icon: 'fullscreen',

onclick: Sample.outputCommand })

];

Sample.commandList = new WinJS.Binding.List(dataArray);

WinJS.UI.processAll();

自定義工具欄

工具欄的默認顏色由 ui-dark.css 或 ui-light.css 樣式表設置,具體取決于加載的是哪個樣式表。 可以通過重寫相應的 CSS 規則來自定義工具欄的顏色。在此示例中,將工具欄的背景色設置為透明,將工具欄的溢出區域的背景色自定義為與它后面的背景圖像相匹配。

/* Add your CSS here */

body {

background-color: rgb(112,112,112);

}

#content {

text-align: center;

overflow: hidden;

}

.image {

position: relative;

margin: auto;

margin-top: 50px;

margin-bottom:50px;

}

img {

max-width: 100%;

}

.win-toolbar-actionarea {

background: transparent;

}

.win-toolbar-overflowarea {

background-color: rgb(74, 61, 78);

border: 0;

}

WinJS.UI.processAll();

備注

可以在嘗試 WinJS 網站上查看以下編碼示例和其他編碼示例的詳細信息。使用代碼并立即看到結果。

相關主題

總結

以上是生活随笔為你收集整理的html添加工具栏,添加带有命令的工具栏 (HTML)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。