'矩形'是System.Drawing.Rectangle'之间的模糊参考。和' Microsoft.Office.Interop.Excel.Rectangle C#

时间:2015-07-13 03:16:58

标签: c# visual-studio-2010

private void printDocument1_PrintPage(object sender,System.Drawing.Printing.PrintPageEventArgs e)         {             int height = 0;             int width = 0;             钢笔=新笔(Brushes.Black,2.5f);

        if (tabRemainder.SelectedTab == tabBank)
        {
            #region noBank
            e.Graphics.FillRectangle(Brushes.DarkGray,new Rectangle(100,100,dataGridViewRemain.Columns[0].Width,dataGridViewRemain.Rows[0].Height));        
            e.Graphics.DrawRectangle(pen,new Rectangle(100,100,dataGridViewRemain.Columns[0].Width,dataGridViewRemain.Rows[0].Height));
            e.Graphics.DrawString(dataGridViewRemain.Columns[0].HeaderText.ToString(),dataGridViewRemain.Font,Brushes.Black,new Rectangle(100,100,dataGridViewRemain.Columns[0].Width,dataGridViewRemain.Rows[0].Height));
            #endregion
        }


    }

1 个答案:

答案 0 :(得分:0)

如果没有完整的代码,我猜您似乎正在使用名称空间System.DrawingMicrosoft.Office.Interop.Excel。这引起了歧义。请将Rectangle替换为完全限定名称System.Drawing.Rectangle