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>