【问题标题】:'Rectangle' is an ambiguous reference between 'System.Drawing.Rectangle' and 'Microsoft.Office.Interop.Excel.Rectangle C# [duplicate]'Rectangle' 是 'System.Drawing.Rectangle' 和 'Microsoft.Office.Interop.Excel.Rectangle C# [重复]
【发布时间】:2015-07-13 11:21:37
【问题描述】:

private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { 整数高度 = 0; 整数宽度 = 0; Pen pen = new Pen(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
        }


    }

【问题讨论】:

    标签: c# visual-studio-2010


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2016-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-13
      相关资源
      最近更新 更多