加上
eportViewer newViewer = new ReportViewer();
newViewer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
newViewer.Location = new System.Drawing.Point(0, 0);
int height = this.Size.Height - 40;
int width = this.Size.Width - 300;
newViewer.Size = new System.Drawing.Size(width, height);
if (coll == null)
{
coll = (ControlCollection)rv_销量统计.Parent.Controls;
oldIndex = coll.IndexOf(rv_销量统计);
coll.Add(newViewer);
coll.SetChildIndex(newViewer, oldIndex);
coll.Remove(rv_销量统计);
}
else
{
coll.Add(newViewer);
coll.SetChildIndex(newViewer, oldIndex);
}