public override void Visualization(Form form, int x, int y) { status = new PictureBox(); knob = new Zeroit.Framework.Metro.ZeroitMetroKnob(); _switch = new Zeroit.Framework.Metro.ZeroitMetroSwitch(); picture.Left = x - picture.Width / 2; picture.Top = y - picture.Height - 10; picture.Image = Properties.Resources.voltage; //метод загрузки шрифта GlobalData.LoadFont(12); labelValue.Hide(); labelValue.Font = GlobalData.DigitalFont; labelValue.Left = 179; labelValue.Top = 39; labelValue.BackColor = Color.Black; labelValue.Width = 50; labelValue.ForeColor = Color.DeepSkyBlue; labelValue.TextAlign = HorizontalAlignment.Right; knob.Top = 20; knob.Left = 90; knob.Width = 63; knob.Height = 63; knob.BlockedAngle = 90; knob.Maximum = 50; knob.Minimum = 1; knob.Value = 1; knob.BorderColor = Color.DimGray; knob.LineColor = Color.DimGray; knob.AccentColor = Color.DimGray; knob.FillColor = Color.Black; knob.Cursor = Cursors.Hand; knob.LineWidth = 9; knob.LineLength = 100; knob.LinePen.EndCap = System.Drawing.Drawing2D.LineCap.Round; knob.LinePen.StartCap = System.Drawing.Drawing2D.LineCap.NoAnchor; knob.LinePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid; knob.LinePen.DashCap = System.Drawing.Drawing2D.DashCap.Flat; knob.ValueChanged += Knob_ValueChanged; knob.MouseDown += Knob_MouseDown; knob.MouseUp += Knob_MouseUp; status.Width = 10; status.Height = 10; status.Left = 20; status.Top = 22; status.SizeMode = PictureBoxSizeMode.AutoSize; status.BackColor = Color.Transparent; status.Image = Properties.Resources.status_volt_off; _switch.Width = 38; _switch.Height = 20; _switch.Left = 36; _switch.Top = 17; _switch.Cursor = Cursors.Hand; _switch.DefaultColor = Color.DodgerBlue; _switch.CheckColor = Color.Silver; _switch.HoverColor = Color.DodgerBlue; _switch.CheckedChanged += _switch_CheckedChanged; contactMinus.Width = 34; contactMinus.Height = 12; contactMinus.Left = 174; contactMinus.Top = 90; contactPlus.Width = 34; contactPlus.Height = 12; contactPlus.Left = 208; contactPlus.Top = 90; SetPositionControls(208, 2, 229, 2); picture.Controls.Add(labelValue); picture.Controls.Add(knob); picture.Controls.Add(status); picture.Controls.Add(_switch); picture.Controls.Add(contactMinus); picture.Controls.Add(contactPlus); // Установки свойств штекеров для подключения SetPositionsPlugs(form, 180, 209); // распределение составляющих компонента по слоям labelValue.BringToFront(); knob.BringToFront(); contactMinus.BringToFront(); contactPlus.BringToFront(); _switch.BringToFront(); plugMinusDU.BringToFront(); plugPlusDU.BringToFront(); pictureDelete.BringToFront(); pictureMove.BringToFront(); GlobalData.WorkForm.Controls.Add(picture); }
public void createTimeItem(string _Label, string _playingAnimation, bool[] _days, long _timestamp, int x, int y, int index, bool switchBool) { this.SuspendLayout(); Panel itemPannel = new Panel(); Zeroit.Framework.Metro.ZeroitMetroSwitch enableSwitch = new Zeroit.Framework.Metro.ZeroitMetroSwitch(); enableSwitch.BackColor = Color.Transparent; enableSwitch.BackgroundImageLayout = ImageLayout.None; enableSwitch.BorderColor = Color.FromArgb(98, 98, 98); enableSwitch.CheckColor = Color.FromArgb(98, 98, 98); enableSwitch.DefaultColor = Color.FromArgb(6, 215, 156); enableSwitch.Font = new Font("Segoe UI", 9F); enableSwitch.HoverColor = Color.FromArgb(6, 215, 156); enableSwitch.Location = new Point(380, 10); enableSwitch.Name = "enableSwitch"; enableSwitch.Size = new Size(40, 20); enableSwitch.SwitchColor = Color.White; enableSwitch.Text = "enableSwitch"; enableSwitch.TabIndex = index; enableSwitch.Checked = switchBool; enableSwitch.CheckedChanged += (sender, e) => { Items[enableSwitch.TabIndex - 10]["enable"] = enableSwitch.Checked; timeScheduleEnable?.Invoke(this, (JObject)Items[enableSwitch.TabIndex - 10]); }; Label animationName = new Label(); animationName.AutoSize = true; animationName.Font = new Font("Segoe UI", 9F); animationName.ForeColor = Color.White; animationName.Location = new Point(114, 23); animationName.Margin = new Padding(0); animationName.Name = "animationName"; animationName.Size = new Size(75, 15); animationName.Text = _playingAnimation; animationName.TabIndex = index; Label time = new Label(); time.AutoSize = true; time.Font = new Font("Segoe UI", 15F); time.ForeColor = Color.White; time.Location = new Point(34, 4); time.Margin = new Padding(0); time.Name = "time"; time.Size = new Size(75, 15); time.Text = UnixTimeStampToDateTime(_timestamp).ToString("HH:mm"); time.TabIndex = index; Label appName = new Label(); appName.AutoSize = true; appName.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold); appName.ForeColor = Color.White; appName.Location = new Point(114, 4); appName.Margin = new Padding(0); appName.Name = "Label"; appName.Size = new Size(75, 17); appName.Text = _Label; appName.TabIndex = index; Button removeButton = new Button(); removeButton.BackColor = Color.FromArgb(244, 67, 54); removeButton.FlatAppearance.BorderSize = 0; removeButton.FlatStyle = FlatStyle.Flat; removeButton.ForeColor = Color.White; removeButton.Location = new Point(0, 0); removeButton.Margin = new Padding(0); removeButton.Name = "removeButton"; removeButton.Size = new Size(17, 40); removeButton.Text = "❌"; removeButton.UseVisualStyleBackColor = false; removeButton.TabIndex = index; removeButton.Click += new EventHandler((sender, e) => { timeScheduleRemoved?.Invoke(this, (JObject)Items[removeButton.TabIndex - 10]); Items.RemoveAt(removeButton.TabIndex - 10); createAllTimeItems(); }); Button editButton = new Button(); editButton.BackColor = Color.FromArgb(98, 98, 98); editButton.FlatAppearance.BorderSize = 0; editButton.FlatStyle = FlatStyle.Flat; editButton.ForeColor = Color.White; editButton.Location = new Point(17, 0); editButton.Margin = new Padding(0); editButton.Name = "editButton"; editButton.Size = new Size(17, 40); editButton.Text = "⛭"; editButton.UseVisualStyleBackColor = false; editButton.TabIndex = index; editButton.Click += new EventHandler((sender, e) => { timeScheduleEdit?.Invoke(this, (JObject)Items[editButton.TabIndex - 10]); }); string[] week = { "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" }; int weekX = 245; for (int i = 0; i < week.Length; i++) { Label day = new Label(); day.Font = new Font("Segoe UI", 7F); if (_days[i]) { day.ForeColor = Color.FromArgb(6, 215, 156); } else { day.ForeColor = Color.White; } day.Size = new Size(20, 20); day.BackColor = Color.Transparent; day.Location = new Point(weekX, 13); day.Margin = new Padding(0); day.Padding = new Padding(0); day.Name = "day" + week[i]; day.Text = week[i]; day.TabIndex = index + i; itemPannel.Controls.Add(day); weekX += 18; } itemPannel.Controls.Add(editButton); itemPannel.Controls.Add(removeButton); itemPannel.Controls.Add(appName); itemPannel.Controls.Add(animationName); itemPannel.Controls.Add(time); itemPannel.Controls.Add(enableSwitch); itemPannel.Location = new Point(x, y); itemPannel.Name = "itemPannel"; itemPannel.BackColor = Color.FromArgb(27, 42, 71); itemPannel.Size = new Size(430, 40); itemPannel.TabIndex = index; this.Controls.Add(itemPannel); this.ResumeLayout(false); this.PerformLayout(); }
public VoltageSource() { status = new PictureBox(); knob = new Zeroit.Framework.Metro.ZeroitMetroKnob(); _switch = new Zeroit.Framework.Metro.ZeroitMetroSwitch(); picture.Image = Image.FromFile(@"C:\Users\Evgenij\CourseProject\ElectronVPL\pictures\voltage_source\voltage.png"); //метод загрузки шрифта GlobalData.LoadFont(12); labelValue.Hide(); labelValue.Font = GlobalData.DigitalFont; labelValue.Left = 179; labelValue.Top = 39; labelValue.BackColor = Color.Black; labelValue.Width = 50; labelValue.ForeColor = Color.DeepSkyBlue; labelValue.TextAlign = HorizontalAlignment.Right; knob.Top = 20; knob.Left = 90; knob.Width = 63; knob.Height = 63; knob.BlockedAngle = 90; knob.Maximum = 50; knob.Minimum = 1; knob.Value = 1; knob.BorderColor = Color.DimGray; knob.LineColor = Color.DimGray; knob.AccentColor = Color.DimGray; knob.FillColor = Color.Black; knob.Cursor = Cursors.Hand; knob.LineWidth = 9; knob.LineLength = 100; knob.LinePen.EndCap = System.Drawing.Drawing2D.LineCap.Round; knob.LinePen.StartCap = System.Drawing.Drawing2D.LineCap.NoAnchor; knob.LinePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid; knob.LinePen.DashCap = System.Drawing.Drawing2D.DashCap.Flat; knob.ValueChanged += Knob_ValueChanged; knob.MouseDown += Knob_MouseDown; knob.MouseUp += Knob_MouseUp; status.Width = 10; status.Height = 10; status.Left = 20; status.Top = 22; status.SizeMode = PictureBoxSizeMode.AutoSize; status.BackColor = Color.Transparent; status.Image = Image.FromFile(@"C:\Users\Evgenij\CourseProject\ElectronVPL\pictures\voltage_source\status_off.png"); _switch.Width = 38; _switch.Height = 20; _switch.Left = 36; _switch.Top = 17; _switch.Cursor = Cursors.Hand; _switch.DefaultColor = Color.DodgerBlue; _switch.CheckColor = Color.Silver; _switch.HoverColor = Color.DodgerBlue; _switch.CheckedChanged += _switch_CheckedChanged; contactMinus.Width = 34; contactMinus.Height = 12; contactMinus.Left = 174; contactMinus.Top = 90; contactPlus.Width = 34; contactPlus.Height = 12; contactPlus.Left = 208; contactPlus.Top = 90; this.labelValue.Visible = false; this.labelValue.Text = "1"; this.labelValue.Hide(); this.Value = 1; this.statusDevice = false; }
public void createAppItem(string _appName, string _animationName, int x, int y, int index, bool switchBool) { this.SuspendLayout(); Zeroit.Framework.Metro.ZeroitMetroSwitch enableSwitch = new Zeroit.Framework.Metro.ZeroitMetroSwitch(); enableSwitch.BackColor = Color.Transparent; enableSwitch.BackgroundImageLayout = ImageLayout.None; enableSwitch.BorderColor = Color.FromArgb(98, 98, 98); enableSwitch.CheckColor = Color.FromArgb(98, 98, 98); enableSwitch.DefaultColor = Color.FromArgb(6, 215, 156); enableSwitch.Font = new Font("Segoe UI", 9F); enableSwitch.HoverColor = Color.FromArgb(6, 215, 156); enableSwitch.Location = new Point(380, 10); enableSwitch.Name = "enableSwitch"; enableSwitch.Size = new Size(40, 20); enableSwitch.SwitchColor = Color.White; enableSwitch.Text = "enableSwitch"; enableSwitch.TabIndex = index; enableSwitch.Checked = switchBool; enableSwitch.CheckedChanged += (sender, e) => { int i = enableSwitch.TabIndex - 10; Items[i]["enabled"] = enableSwitch.Checked; OnOrderChanged(); }; Label animationName = new Label(); animationName.AutoSize = true; animationName.Font = new Font("Segoe UI", 9F); animationName.ForeColor = Color.White; animationName.Location = new Point(114, 23); animationName.Margin = new Padding(0); animationName.Name = "animationName"; animationName.Size = new Size(75, 15); animationName.TabIndex = 4; animationName.Text = _animationName; animationName.TabIndex = index; Label appName = new Label(); appName.AutoSize = true; appName.Font = new Font("Segoe UI", 9.75F, FontStyle.Bold); appName.ForeColor = Color.White; appName.Location = new Point(114, 4); appName.Margin = new Padding(0); appName.Name = "appName"; appName.Size = new Size(75, 17); appName.Text = _appName; appName.TabIndex = index; Button upButton = new Button(); upButton.BackColor = Color.FromArgb(6, 215, 156); upButton.FlatAppearance.BorderSize = 0; upButton.FlatStyle = FlatStyle.Flat; upButton.ForeColor = Color.White; upButton.Location = new Point(17, 0); upButton.Margin = new Padding(0); upButton.Name = "upButton"; upButton.Size = new Size(50, 20); upButton.Text = "▲"; upButton.UseVisualStyleBackColor = false; upButton.TabIndex = index; upButton.Click += new EventHandler((sender, e) => { int i = upButton.TabIndex - 10; if (i != 0) { var item = Items[i]; Items.RemoveAt(i); Items.Insert(i - 1, item); createAllAppItems(); OnOrderChanged(); } }); Button downButton = new Button(); downButton.BackColor = Color.FromArgb(46, 46, 54); downButton.FlatAppearance.BorderSize = 0; downButton.FlatStyle = FlatStyle.Flat; downButton.ForeColor = Color.White; downButton.Location = new Point(17, 20); downButton.Margin = new Padding(0); downButton.Name = "downButton"; downButton.Size = new Size(50, 20); downButton.Text = "▼"; downButton.UseVisualStyleBackColor = false; downButton.TabIndex = index; downButton.Click += new EventHandler((sender, e) => { int i = downButton.TabIndex - 10; if (i < Items.Count - 1) { var item = Items[i]; Items.RemoveAt(i); Items.Insert(i + 1, item); createAllAppItems(); OnOrderChanged(); } }); Button removeButton = new Button(); removeButton.BackColor = Color.FromArgb(244, 67, 54); removeButton.FlatAppearance.BorderSize = 0; removeButton.FlatStyle = FlatStyle.Flat; removeButton.ForeColor = Color.White; removeButton.Location = new Point(0, 0); removeButton.Margin = new Padding(0); removeButton.Name = "removeButton"; removeButton.Size = new Size(17, 40); removeButton.Text = "❌"; removeButton.UseVisualStyleBackColor = false; removeButton.TabIndex = index; removeButton.Click += new EventHandler((sender, e) => { Items.RemoveAt(removeButton.TabIndex - 10); createAllAppItems(); OnOrderChanged(); }); Button editButton = new Button(); editButton.BackColor = Color.FromArgb(98, 98, 98); editButton.FlatAppearance.BorderSize = 0; editButton.FlatStyle = FlatStyle.Flat; editButton.ForeColor = Color.White; editButton.Location = new Point(67, 0); editButton.Margin = new Padding(0); editButton.Name = "editButton"; editButton.Size = new Size(15, 40); editButton.Text = "⛭"; editButton.UseVisualStyleBackColor = false; editButton.TabIndex = index; editButton.Click += new EventHandler((sender, e) => { appScheduleEdit?.Invoke(this, (JObject)Items[editButton.TabIndex - 10]); }); Panel itemPannel = new Panel(); itemPannel.Controls.Add(editButton); itemPannel.Controls.Add(removeButton); itemPannel.Controls.Add(upButton); itemPannel.Controls.Add(downButton); itemPannel.Controls.Add(appName); itemPannel.Controls.Add(animationName); itemPannel.Controls.Add(enableSwitch); itemPannel.Location = new Point(x, y); itemPannel.Name = "itemPannel"; itemPannel.BackColor = Color.FromArgb(27, 42, 71); itemPannel.Size = new Size(430, 40); itemPannel.TabIndex = index; this.Controls.Add(itemPannel); this.ResumeLayout(false); this.PerformLayout(); }
public DoubleSwitch() { picture.Image = Image.FromFile(@"C:\Users\Evgenij\CourseProject\ElectronVPL\pictures\switches\d_switch.png"); contactLeftMinus = new PictureBox(); contactLeftPlus = new PictureBox(); contactRightMinus = new PictureBox(); contactRightPlus = new PictureBox(); contactBottomMinus = new PictureBox(); contactBottomPlus = new PictureBox(); _switch = new Zeroit.Framework.Metro.ZeroitMetroSwitch(); _switch.Width = 41; _switch.Height = 20; _switch.Left = 73; _switch.Top = 34; _switch.Cursor = Cursors.Hand; _switch.DefaultColor = Color.ForestGreen; _switch.CheckColor = Color.DodgerBlue; _switch.HoverColor = Color.DodgerBlue; _switch.CheckedChanged += _switch_CheckedChanged; contactLeftPlus.Width = 33; contactLeftPlus.Height = 12; contactLeftPlus.Left = 19; contactLeftPlus.Top = 0; contactLeftPlus.Cursor = Cursors.Hand; contactLeftPlus.BackColor = Color.Transparent; contactLeftPlus.Click += ContactLeftPlus_Click; contactLeftPlus.MouseHover += ContactLeftPlus_MouseHover; contactLeftPlus.MouseLeave += ContactLeftPlus_MouseLeave; contactLeftMinus.Width = 33; contactLeftMinus.Height = 12; contactLeftMinus.Left = 52; contactLeftMinus.Top = 0; contactLeftMinus.Cursor = Cursors.Hand; contactLeftMinus.BackColor = Color.Transparent; contactLeftMinus.Click += ContactLeftMinus_Click; contactLeftMinus.MouseHover += ContactLeftMinus_MouseHover; contactLeftMinus.MouseLeave += ContactLeftMinus_MouseLeave; //----------------------------- contactRightPlus.Width = 33; contactRightPlus.Height = 12; contactRightPlus.Left = 103; contactRightPlus.Top = 0; contactRightPlus.Cursor = Cursors.Hand; contactRightPlus.BackColor = Color.Transparent; contactRightPlus.Click += ContactRightPlus_Click; contactRightPlus.MouseHover += ContactRightPlus_MouseHover; contactRightPlus.MouseLeave += ContactRightPlus_MouseLeave; contactRightMinus.Width = 33; contactRightMinus.Height = 12; contactRightMinus.Left = 136; contactRightMinus.Top = 0; contactRightMinus.Cursor = Cursors.Hand; contactRightMinus.BackColor = Color.Transparent; contactRightMinus.Click += ContactRightMinus_Click; contactRightMinus.MouseHover += ContactRightMinus_MouseHover; contactRightMinus.MouseLeave += ContactRightMinus_MouseLeave; //----------------------------- contactBottomPlus.Width = 33; contactBottomPlus.Height = 12; contactBottomPlus.Left = 61; contactBottomPlus.Top = picture.Height - 12; contactBottomPlus.Cursor = Cursors.Hand; contactBottomPlus.BackColor = Color.Transparent; contactBottomPlus.Click += ContactBottomPlus_Click; contactBottomPlus.MouseHover += ContactBottomPlus_MouseHover; contactBottomPlus.MouseLeave += ContactBottomPlus_MouseLeave; contactBottomMinus.Width = 33; contactBottomMinus.Height = 12; contactBottomMinus.Left = 94; contactBottomMinus.Top = picture.Height - 12; contactBottomMinus.Cursor = Cursors.Hand; contactBottomMinus.BackColor = Color.Transparent; contactBottomMinus.Click += ContactBottomMinus_Click; contactBottomMinus.MouseHover += ContactBottomMinus_MouseHover; contactBottomMinus.MouseLeave += ContactBottomMinus_MouseLeave; position = Position.Left; }