求指教,我该怎么入手。老师可以附送完整的源程序。
if (this.IsHandleCreated
&& this.Document != null
&& this.DesignMode == false )
{
using (Graphics g = pnlView.CreateGraphics())
{
// 计算页面框架视图边界
_PageBounds = new Rectangle(
10,
10,
(int)(g.DpiX * this.PageSettings.Bounds.Width / 100f),
(int)(g.DpiY * this.PageSettings.Bounds.Height / 100f));
if (_PageBounds.Width + 20 < this.ClientSize.Width)
{
_PageBounds.X = 10 + (this.ClientSize.Width - _PageBounds.Width) / 2;
}
// 计算文档视图边界
_DocumentBounds.X = _PageBounds.X + (int)(this.PageSettings.Margins.Left * g.DpiX / 100f);
_DocumentBounds.Y = _PageBounds.Y + (int)(this.PageSettings.Margins.Top * g.DpiY / 100f);
_DocumentBounds.Width = _PageBounds.Right - (int)(this.PageSettings.Margins.Right * g.DpiX / 100f) - _DocumentBounds.Left;
_DocumentBounds.Height = _PageBounds.Bottom - (int)(this.PageSettings.Margins.Bottom * g.DpiY / 100f) - _DocumentBounds.Top; Size viewSize = new Size(
_PageBounds.Left + 10 ,
_PageBounds.Bottom + 10 );
if (pnlView.AutoScrollMinSize != viewSize)
{
pnlView.AutoScrollMinSize = viewSize;
}
if (this.IsHandleCreated
&& this.Document != null
&& this.DesignMode == false )
{
using (Graphics g = pnlView.CreateGraphics())
{
// 计算页面框架视图边界
_PageBounds = new Rectangle(
10,
10,
(int)(g.DpiX * this.PageSettings.Bounds.Width / 100f),
(int)(g.DpiY * this.PageSettings.Bounds.Height / 100f));
if (_PageBounds.Width + 20 < this.ClientSize.Width)
{
_PageBounds.X = 10 + (this.ClientSize.Width - _PageBounds.Width) / 2;
}
// 计算文档视图边界
_DocumentBounds.X = _PageBounds.X + (int)(this.PageSettings.Margins.Left * g.DpiX / 100f);
_DocumentBounds.Y = _PageBounds.Y + (int)(this.PageSettings.Margins.Top * g.DpiY / 100f);
_DocumentBounds.Width = _PageBounds.Right - (int)(this.PageSettings.Margins.Right * g.DpiX / 100f) - _DocumentBounds.Left;
_DocumentBounds.Height = _PageBounds.Bottom - (int)(this.PageSettings.Margins.Bottom * g.DpiY / 100f) - _DocumentBounds.Top; Size viewSize = new Size(
_PageBounds.Left + 10 ,
_PageBounds.Bottom + 10 );
if (pnlView.AutoScrollMinSize != viewSize)
{
pnlView.AutoScrollMinSize = viewSize;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货