画四条直线然后组合成矩形

private void button1_Click( object sender, EventArgs e)
{
        Excel.Shape lineA = Globals.Sheet1.Shapes.AddLine(25, 140, 495, 140);
        Excel.Shape lineB = Globals.Sheet1.Shapes.AddLine(495, 140, 495, 305);
        Excel.Shape lineC = Globals.Sheet1.Shapes.AddLine(25, 305, 495, 305);
        Excel.Shape lineD = Globals.Sheet1.Shapes.AddLine(25, 140, 25, 305);
         object[] shapes = { lineA.Name, lineB.Name, lineC.Name, lineD.Name };
        Excel.ShapeRange shapeRange = Globals.Sheet1.Shapes.get_Range(shapes);
        shapeRange.Group();
}



作者:laoyebin(Paladin.lao)
博客园出处: http://laoyebin.cnblogs.com/
个人网站英文出处: http://mrvsto.com/
个人网站中文出处: http://cn.mrvsto.com/

你可能感兴趣的:(Excel,职场,shape,休闲,VSTO)