private void paint_blocks(block block)//绘制滑块 { //Pen pen = new Pen(block.Color,4); SolidBrush brush = new SolidBrush(block.Color); //pen.Brush = brush; Rectangle j = new Rectangle(block.position, block.Size); g.FillRectangle(brush, j); }
private int getColor(block b) { if (b.Color == Color.Red) { return(0); } if (b.Color == Color.Orange) { return(1); } if (b.Color == Color.Yellow) { return(2); } if (b.Color == Color.Green) { return(3); } if (b.Color == Color.Blue) { return(4); } if (b.Color == Color.Purple) { return(5); } if (b.Color == Color.Black) { return(6); } if (b.Color == Color.Gray) { return(7); } if (b.Color == Color.Brown) { return(8); } return(0); }//获取颜色