您的位置:首页 > 其它

关于webbrowser更改字体大小的方法

2015-01-09 15:15 204 查看
1.用js(不推荐这种动态更改的方法,因为有“更改瞬间”),关键代码:

private const string Js = @"<script>
function zoomIn() {
document.body.style.fontSize =1.4 + 'em';
document.body.style.lineHeight = 40 + 'px';
}

function zoomMiddle() {
document.body.style.fontSize = 1.2 + 'em';
document.body.style.lineHeight = 30 + 'px';
}
function zoomOut() {
document.body.style.fontSize = 1.0 + 'em';
document.body.style.lineHeight = 30 + 'px';
}
</script>  ";


2.用css控制(推荐),关键代码:

<style type='text/css'>body {margin-left:auto; margin-right:auto; word-break:break-all;font-family:Microsoft Yahei;font-size:1.2em;line-height:40px;}</style>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: