private string GetShapeText(eShape Shape) { switch (Shape) { case eShape.Box: return("box"); case eShape.Cone: return("cone"); case eShape.ConeToMax: return("coneToMax"); case eShape.Cylinder: return("cylinder"); case eShape.Pyramid: return("pyramid"); case eShape.PyramidToMax: return("pyramidToMax"); default: return("box"); } }
public ShapeDrawTool(mPlayground iPlayground) { playground = iPlayground; curShape = eShape.Rect; currentShape = null; drawing = false; }
public ComplexShape(List <PointOnGrid> inputPoints, MaxMin maxmin, eShape shape) { Vertices = inputPoints; //oMaxMin = new MaxMin(10000, 8000); oMaxMin = maxmin; stateVec = new StateVector() { PitchAngle = 0, RollAngle = 0, YawAngle = 0, XCG = 100, YCG = 0, ZCG = 0 }; ShapeID = (uint)shape; }
static void Main(string[] args) { while (true) { eShape s = getShapeFromUser(); switch (s) { case eShape.Quit: return; case eShape.Student: studentInfo(); break; } } }
public GraphicsPath GetPath(eShape Shape, RectangleF rect, [Optional, DefaultParameterValue(0f)] float RI) { PointF S1; PointF S2; PointF[] S0; GraphicsPath gp = new GraphicsPath(); switch (Shape) { case eShape.Ellipse: gp.AddEllipse(rect); return(gp); case eShape.Rectangle: return(this.GetRoundedRectPath(rect, this.Corners)); case eShape.Triangle: { S0 = new PointF[3]; S0[0] = new PointF(rect.Width / 2f, rect.Y); S1 = new PointF(rect.Width, rect.Y + rect.Height); S0[1] = S1; S2 = new PointF(rect.X, rect.Y + rect.Height); S0[2] = S2; PointF[] pts = S0; gp.AddPolygon(pts); return(gp); } case eShape.Diamond: { S0 = new PointF[4]; S2 = new PointF(rect.Width / 2f, rect.Y); S0[0] = S2; S1 = new PointF(rect.X + rect.Width, (rect.Y + rect.Height) / 2f); S0[1] = S1; S0[2] = new PointF(rect.X + (rect.Width / 2f), rect.Y + rect.Height); PointF S3 = new PointF(rect.X, (rect.Y + rect.Height) / 2f); S0[3] = S3; PointF[] pts = S0; gp.AddPolygon(pts); return(gp); } } return(gp); }
static void Main(string[] args) { while (true) { eShape s = getShapeFromUser(); switch (s) { case eShape.Quit: return; case eShape.Square: drawSquare(); break; case eShape.Rectangle: drawRectangle(); break; case eShape.Triangle: drawTriangle(); break; } } }
public static Shape Create(eShape shape) { Shape result = new Shape(shape); switch (shape) { case eShape.I: AddBlock(ref result, 3, 0); AddBlock(ref result, 3, 1); AddBlock(ref result, 3, 2); AddBlock(ref result, 3, 3); AddBlock(ref result, 2, 3); result.SetColor(Color.Yellow); result.BlockCnt = 5; break; case eShape.J: AddBlock(ref result, 2, 0); AddBlock(ref result, 2, 1); AddBlock(ref result, 2, 2); AddBlock(ref result, 2, 3); AddBlock(ref result, 1, 3); result.SetColor(Color.Red); result.BlockCnt = 5; break; case eShape.L: AddBlock(ref result, 2, 0); AddBlock(ref result, 2, 1); AddBlock(ref result, 2, 2); AddBlock(ref result, 2, 3); AddBlock(ref result, 3, 3); result.SetColor(Color.LimeGreen); result.BlockCnt = 5; break; case eShape.O: AddBlock(ref result, 1, 1); AddBlock(ref result, 2, 1); AddBlock(ref result, 1, 2); AddBlock(ref result, 2, 2); result.SetColor(Color.Purple); result.BlockCnt = 4; break; case eShape.Z: AddBlock(ref result, 1, 1); AddBlock(ref result, 2, 1); AddBlock(ref result, 2, 2); AddBlock(ref result, 3, 2); result.SetColor(Color.Orange); break; case eShape.T: AddBlock(ref result, 2, 1); AddBlock(ref result, 1, 2); AddBlock(ref result, 2, 2); AddBlock(ref result, 3, 2); result.SetColor(Color.Blue); result.BlockCnt = 4; break; case eShape.S: AddBlock(ref result, 1, 2); AddBlock(ref result, 2, 2); AddBlock(ref result, 2, 1); AddBlock(ref result, 3, 1); result.SetColor(Color.Pink); result.BlockCnt = 4; break; #region ExtendedShapes case eShape.X1: AddBlock(ref result, 1, 1); AddBlock(ref result, 2, 2); AddBlock(ref result, 3, 3); AddBlock(ref result, 1, 3); AddBlock(ref result, 3, 1); result.SetColor(Color.Silver); result.BlockCnt = 5; break; case eShape.Plus1: AddBlock(ref result, 2, 1); AddBlock(ref result, 2, 2); AddBlock(ref result, 2, 3); AddBlock(ref result, 1, 2); AddBlock(ref result, 3, 2); result.SetColor(Color.SeaShell); result.BlockCnt = 5; break; case eShape.Rectangle: AddBlock(ref result, 1, 1); AddBlock(ref result, 2, 1); AddBlock(ref result, 3, 1); AddBlock(ref result, 1, 2); AddBlock(ref result, 2, 2); AddBlock(ref result, 3, 2); result.SetColor(Color.Purple); result.BlockCnt = 6; break; #endregion #region Insane shapes case eShape.X2: AddBlock(ref result, 0, 0); AddBlock(ref result, 1, 1); AddBlock(ref result, 2, 2); AddBlock(ref result, 3, 3); AddBlock(ref result, 4, 4); AddBlock(ref result, 0, 4); AddBlock(ref result, 1, 3); AddBlock(ref result, 4, 0); AddBlock(ref result, 3, 1); result.SetColor(Color.Silver); result.BlockCnt = 9; break; case eShape.Plus2: AddBlock(ref result, 2, 0); AddBlock(ref result, 2, 1); AddBlock(ref result, 2, 2); AddBlock(ref result, 2, 3); AddBlock(ref result, 2, 4); AddBlock(ref result, 0, 2); AddBlock(ref result, 1, 2); AddBlock(ref result, 3, 2); AddBlock(ref result, 4, 2); result.SetColor(Color.SeaShell); result.BlockCnt = 9; break; #endregion default: throw new CaseStatementMissingException(); } // Random colors if (!Level.Instance.OriginalColors) { result.SetColor(Misc.RandomColor()); } // Return return(result); }
public void Draw(Graphics f_G, eShape f_Shape, bool f_bFill) { if (!IsInvisible) { if (f_bFill) { SolidBrush brush = new SolidBrush(Color.FromArgb(m_iAlpha, m_Color)); if (f_Shape == eShape.Rectangle) f_G.FillRectangle(brush, m_fPosition.X, m_fPosition.Y, m_fSize.X, m_fSize.Y); else f_G.FillEllipse(brush, m_fPosition.X, m_fPosition.Y, m_fSize.X, m_fSize.Y); } else { Pen pen = new Pen(Color.FromArgb(m_iAlpha, m_Color)); if (f_Shape == eShape.Rectangle) f_G.DrawRectangle(pen, m_fPosition.X, m_fPosition.Y, m_fSize.X, m_fSize.Y); else f_G.DrawEllipse(pen, m_fPosition.X, m_fPosition.Y, m_fSize.X, m_fSize.Y); } } }
public static Grid GetBlock(Color color, String text, double width, double height, eShape shape) { double shade = 0.4; Color light = new Color() { A = 255, R = (byte)((1 - shade) * color.R + shade * 255), G = (byte)((1 - shade) * color.G + shade * 255), B = (byte)((1 - shade) * color.B + shade * 255) }; Color dark = new Color() { A = 255, R = (byte)((1 - shade) * color.R), G = (byte)((1 - shade) * color.G), B = (byte)((1 - shade) * color.B) }; GradientBrush fill = new LinearGradientBrush(new GradientStopCollection() { new GradientStop(light, 0), new GradientStop(dark, 1), }, 90); Color stroke = MainWindow.IntToColor(MainWindow.theme == 0 ? MainWindow.CHART_FORE_COLOR : MainWindow.CHART_BACK_COLOR); Grid block = new Grid() { Width = width, Height = height, }; switch (shape) { case eShape.DIAMOND: Polygon polygon = new Polygon(); polygon.Points.Add(new Point(0, height / 2)); polygon.Points.Add(new Point(width / 2, 0)); polygon.Points.Add(new Point(width, height / 2)); polygon.Points.Add(new Point(width / 2, height)); polygon.Fill = fill; polygon.Stroke = new SolidColorBrush(stroke); polygon.StrokeThickness = 1; block.Children.Add(polygon); break; case eShape.ELLIPSE: Ellipse ellipse = new Ellipse() { Width = width, Height = height, Fill = fill, Stroke = new SolidColorBrush(stroke), StrokeThickness = 1, }; block.Children.Add(ellipse); break; case eShape.RECTANGLE: Rectangle rectangle = new Rectangle() { Width = width, Height = height, Fill = fill, Stroke = new SolidColorBrush(stroke), StrokeThickness = 1, RadiusX = 5, RadiusY = 5, }; block.Children.Add(rectangle); break; } TextBlock textBlock = new TextBlock() { Foreground = new SolidColorBrush(MainWindow.IntToColor(MainWindow.CHART_CODE_COLOR)), Text = text, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, TextAlignment = TextAlignment.Center, //FontFamily = new FontFamily("Consolas"), Margin = new Thickness(2), }; block.Children.Add(textBlock); return(block); }
public GraphicsPath GetPath(eShape Shape, RectangleF rect, [Optional, DefaultParameterValue(0f)] float RI) { PointF S1; PointF S2; PointF[] S0; GraphicsPath gp = new GraphicsPath(); switch (Shape) { case eShape.Ellipse: gp.AddEllipse(rect); return gp; case eShape.Rectangle: return this.GetRoundedRectPath(rect, this.Corners); case eShape.Triangle: { S0 = new PointF[3]; S0[0] = new PointF(rect.Width / 2f, rect.Y); S1 = new PointF(rect.Width, rect.Y + rect.Height); S0[1] = S1; S2 = new PointF(rect.X, rect.Y + rect.Height); S0[2] = S2; PointF[] pts = S0; gp.AddPolygon(pts); return gp; } case eShape.Diamond: { S0 = new PointF[4]; S2 = new PointF(rect.Width / 2f, rect.Y); S0[0] = S2; S1 = new PointF(rect.X + rect.Width, (rect.Y + rect.Height) / 2f); S0[1] = S1; S0[2] = new PointF(rect.X + (rect.Width / 2f), rect.Y + rect.Height); PointF S3 = new PointF(rect.X, (rect.Y + rect.Height) / 2f); S0[3] = S3; PointF[] pts = S0; gp.AddPolygon(pts); return gp; } } return gp; }
internal Piece(Location i_Location, eShape i_Shape, ePlayerColor i_Color) { m_Shape = i_Shape; m_Color = i_Color; m_Location = i_Location; }
private void 동그라미ToolStripMenuItem_Click(object sender, EventArgs e) { Shape = eShape.CIRCLE; Invalidate(); }
private string GetShapeText(eShape Shape) { switch (Shape) { case eShape.Box: return "box"; case eShape.Cone: return "cone"; case eShape.ConeToMax: return "coneToMax"; case eShape.Cylinder: return "cylinder"; case eShape.Pyramid: return "pyramid"; case eShape.PyramidToMax: return "pyramidToMax"; default: return "box"; } }
internal void setBoardSquare(int i_Row, int i_Col, eShape i_Shape, ePlayerColor i_Color) { m_BoardSquares[i_Row, i_Col] = new BoardSquare(i_Shape, new Location(i_Row, i_Col), i_Color); }
public Shape(eShape shape) { ShapeType = shape; GridIdx = new Point((Grid.RowCnt / 2) - BlocksRowCnt / 2, 0); }
public void Update() { if (InputManager.IsKeyPressed(Keys.Q)) { if (curShape == eShape.Rect) { curShape = eShape.Ellps; } else { curShape = eShape.Rect; } } if (!leftClicked && InputManager.IsPressed(MouseInput.LeftButton)) { if (curShape == eShape.Rect) { currentShape = new mRectangle(1, 1, Color.Red); } if (curShape == eShape.Ellps) { currentShape = new mEllipse(1, 1, Color.Red); } xPos1 = InputManager.CurrentMouseState.X; yPos1 = InputManager.CurrentMouseState.Y; currentShape.X = xPos1; currentShape.Y = yPos1; currentShape.LoadWhileDrawing(); drawing = true; Console.WriteLine("Start drawing at: [" + xPos1 + " | " + yPos1 + "]"); } else if (leftClicked && InputManager.IsReleased(MouseInput.LeftButton)) { currentShape.Width = Util.Clamp(rWidth, 1, playground.Width); currentShape.Height = Util.Clamp(rHeight, 1, playground.Height); currentShape.Load(); playground.ExecuteCommand(new DrawCommand(currentShape, playground)); drawing = false; Console.WriteLine("Added: " + currentShape.ToString()); } else if (leftClicked) { xPos2 = InputManager.CurrentMouseState.X; yPos2 = InputManager.CurrentMouseState.Y; rWidth = xPos2 - xPos1; rHeight = yPos2 - yPos1; currentShape.Width = Util.Clamp(rWidth, 1, playground.Width); currentShape.Height = Util.Clamp(rHeight, 1, playground.Height); currentShape.LoadWhileDrawing(); } if (InputManager.IsPressed(MouseInput.LeftButton)) { leftClicked = true; } if (InputManager.IsReleased(Input.MouseInput.LeftButton)) { leftClicked = false; } }
private void 사각형ToolStripMenuItem_Click(object sender, EventArgs e) { Shape = eShape.RECT; Invalidate(); }
private void 직선ToolStripMenuItem_Click(object sender, EventArgs e) { Shape = eShape.LINE; Invalidate(); }
internal BoardSquare(eShape i_Shape, Location i_Location, ePlayerColor i_Color) { m_Checker = new Piece(i_Shape, i_Color); m_Coordinates = i_Location; }
private void SetTypeProperties(ExcelDrawings drawings, eChartType type) { /******* Bar direction *******/ if (type == eChartType.BarClustered || type == eChartType.BarStacked || type == eChartType.BarStacked100 || type == eChartType.BarClustered3D || type == eChartType.BarStacked3D || type == eChartType.BarStacked1003D || type == eChartType.ConeBarClustered || type == eChartType.ConeBarStacked || type == eChartType.ConeBarStacked100 || type == eChartType.CylinderBarClustered || type == eChartType.CylinderBarStacked || type == eChartType.CylinderBarStacked100 || type == eChartType.PyramidBarClustered || type == eChartType.PyramidBarStacked || type == eChartType.PyramidBarStacked100) { Direction = eDirection.Bar; } else if ( type == eChartType.ColumnClustered || type == eChartType.ColumnStacked || type == eChartType.ColumnStacked100 || type == eChartType.Column3D || type == eChartType.ColumnClustered3D || type == eChartType.ColumnStacked3D || type == eChartType.ColumnStacked1003D || type == eChartType.ConeCol || type == eChartType.ConeColClustered || type == eChartType.ConeColStacked || type == eChartType.ConeColStacked100 || type == eChartType.CylinderCol || type == eChartType.CylinderColClustered || type == eChartType.CylinderColStacked || type == eChartType.CylinderColStacked100 || type == eChartType.PyramidCol || type == eChartType.PyramidColClustered || type == eChartType.PyramidColStacked || type == eChartType.PyramidColStacked100) { Direction = eDirection.Column; } /****** Shape ******/ if (type == eChartType.ColumnClustered || type == eChartType.ColumnStacked || type == eChartType.ColumnStacked100 || type == eChartType.Column3D || type == eChartType.ColumnClustered3D || type == eChartType.ColumnStacked3D || type == eChartType.ColumnStacked1003D || type == eChartType.BarClustered || type == eChartType.BarStacked || type == eChartType.BarStacked100 || type == eChartType.BarClustered3D || type == eChartType.BarStacked3D || type == eChartType.BarStacked1003D) { Shape = eShape.Box; } else if ( type == eChartType.CylinderBarClustered || type == eChartType.CylinderBarStacked || type == eChartType.CylinderBarStacked100 || type == eChartType.CylinderCol || type == eChartType.CylinderColClustered || type == eChartType.CylinderColStacked || type == eChartType.CylinderColStacked100) { Shape = eShape.Cylinder; } else if ( type == eChartType.ConeBarClustered || type == eChartType.ConeBarStacked || type == eChartType.ConeBarStacked100 || type == eChartType.ConeCol || type == eChartType.ConeColClustered || type == eChartType.ConeColStacked || type == eChartType.ConeColStacked100) { Shape = eShape.Cone; } else if ( type == eChartType.PyramidBarClustered || type == eChartType.PyramidBarStacked || type == eChartType.PyramidBarStacked100 || type == eChartType.PyramidCol || type == eChartType.PyramidColClustered || type == eChartType.PyramidColStacked || type == eChartType.PyramidColStacked100) { Shape = eShape.Pyramid; } }
private void SetTypeProperties(ExcelDrawings drawings, eChartType type) { /******* Bar direction *******/ if (type == eChartType.BarClustered || type == eChartType.BarStacked || type == eChartType.BarStacked100 || type == eChartType.BarClustered3D || type == eChartType.BarStacked3D || type == eChartType.BarStacked1003D || type == eChartType.ConeBarClustered || type == eChartType.ConeBarStacked || type == eChartType.ConeBarStacked100 || type == eChartType.CylinderBarClustered || type == eChartType.CylinderBarStacked || type == eChartType.CylinderBarStacked100 || type == eChartType.PyramidBarClustered || type == eChartType.PyramidBarStacked || type == eChartType.PyramidBarStacked100) { Direction = eDirection.Bar; } else if ( type == eChartType.ColumnClustered || type == eChartType.ColumnStacked || type == eChartType.ColumnStacked100 || type == eChartType.Column3D || type == eChartType.ColumnClustered3D || type == eChartType.ColumnStacked3D || type == eChartType.ColumnStacked1003D || type == eChartType.ConeCol || type == eChartType.ConeColClustered || type == eChartType.ConeColStacked || type == eChartType.ConeColStacked100 || type == eChartType.CylinderCol || type == eChartType.CylinderColClustered || type == eChartType.CylinderColStacked || type == eChartType.CylinderColStacked100 || type == eChartType.PyramidCol || type == eChartType.PyramidColClustered || type == eChartType.PyramidColStacked || type == eChartType.PyramidColStacked100) { Direction = eDirection.Column; } /****** Shape ******/ if (/*type == eChartType.ColumnClustered || * type == eChartType.ColumnStacked || * type == eChartType.ColumnStacked100 ||*/ type == eChartType.Column3D || type == eChartType.ColumnClustered3D || type == eChartType.ColumnStacked3D || type == eChartType.ColumnStacked1003D || /*type == eChartType.BarClustered || * type == eChartType.BarStacked || * type == eChartType.BarStacked100 ||*/ type == eChartType.BarClustered3D || type == eChartType.BarStacked3D || type == eChartType.BarStacked1003D) { Shape = eShape.Box; } else if ( type == eChartType.CylinderBarClustered || type == eChartType.CylinderBarStacked || type == eChartType.CylinderBarStacked100 || type == eChartType.CylinderCol || type == eChartType.CylinderColClustered || type == eChartType.CylinderColStacked || type == eChartType.CylinderColStacked100) { Shape = eShape.Cylinder; } else if ( type == eChartType.ConeBarClustered || type == eChartType.ConeBarStacked || type == eChartType.ConeBarStacked100 || type == eChartType.ConeCol || type == eChartType.ConeColClustered || type == eChartType.ConeColStacked || type == eChartType.ConeColStacked100) { Shape = eShape.Cone; } else if ( type == eChartType.PyramidBarClustered || type == eChartType.PyramidBarStacked || type == eChartType.PyramidBarStacked100 || type == eChartType.PyramidCol || type == eChartType.PyramidColClustered || type == eChartType.PyramidColStacked || type == eChartType.PyramidColStacked100) { Shape = eShape.Pyramid; } }