//Form constructor public MainForm() { //Load the app language from xml XmlDocument XmlDocument = new XmlDocument(); try { XmlDocument.Load("config.xml"); XmlElement element = XmlDocument.DocumentElement; XmlNode node = element["Language"]; Language = (node["CurrL"].InnerText); XmlDocument.Save("config.xml"); Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(Language); } catch { Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); Language = "en-US"; } InitializeComponent(); //Instantiate shape object makers MCircle = new CircleMaker(); MLine = new LineMaker(); MOval = new OvalMaker(); MRectangle = new RectangleMaker(); MSquare = new SquareMaker(); MTriangle = new TriangleMaker(); //Instantiate a list of drawn shapes DrawnShapesList = new ShapeList(); //Initialize default options SelectedMaker = MLine; SelectedShapeName = MLine.EngName; CurrentShape.Text = StatusBarMessage + SelectedShapeName; penStyle = new PenStyle("Solid", "Сплошная", System.Drawing.Drawing2D.DashStyle.Solid); //Instantiate pen style list penStyleList = new List <PenStyle>(); //Adding penStyles to a list which'll be made to a data source for the combo box penStyleList.Add(penStyle); penStyleList.Add(new PenStyle("Dash", "Пунктир", System.Drawing.Drawing2D.DashStyle.Dash)); penStyleList.Add(new PenStyle("Dash-dot", "Штрих-пунктир", System.Drawing.Drawing2D.DashStyle.DashDot)); penStyleList.Add(new PenStyle("Dash-dot-dot", "Штрих-пунктир-пунктир", System.Drawing.Drawing2D.DashStyle.DashDotDot)); penStyleList.Add(new PenStyle("Dot", "Пунктир", System.Drawing.Drawing2D.DashStyle.Dot)); LineTypesComboBox.DataSource = penStyleList; LineTypesComboBox.DisplayMember = "EngName"; }
private void DrawAllBtn_Click(object sender, EventArgs e) { // Triangle triangle = new Triangle(); Circle circle = new Circle(); Ellipse ellipse = new Ellipse(); Line line = new Line(); Square square = new Square(); Rectangle rectangle = new Rectangle(); ShapeList shapeList = new ShapeList(); shapeList.myList.Add(line); shapeList.myList.Add(square); shapeList.myList.Add(rectangle); shapeList.myList.Add(ellipse); shapeList.myList.Add(circle); // shapeList.myList.Add(triangle); shapeList.Draw(graphics); PictureBox.Image = bmap; }