public Entity(Form1 form, String type, int ms, int y) { this.type = type; this.form = form; this.id = 0; name = form.maxEntityCount++ + "_" + type; picture = new TransparentControl(name); this.type = this.type.ToUpper(); setUniqueData(); //picture.Image = global::Soul_Editor.Properties.Resources.RedBloodvessel; picture.Size = new Size((int)picture.Image.PhysicalDimension.Width / 2, (int)picture.Image.PhysicalDimension.Height / 2); calculatePosition(ms); pos.Y = y / 2; Move(pos.X, pos.Y); //picture.Location = new Point(pos.X, pos.Y); picture.Bounds = new Rectangle(picture.Location, picture.Size); form.panel2.Controls.Add(picture); picture.BringToFront(); picture.MouseDown += new MouseEventHandler(entity_MouseDown); picture.MouseUp += new MouseEventHandler(entity_MouseUp); if (isPath) { path.AddFirst(new Point(1280, pos.Y * 2)); path.AddFirst(new Point(0, pos.Y * 2)); updatePathText(); } //picture.MouseMove += new MouseEventHandler(entity_MouseMove); }
private Panel CreateFileDropSendPanel(int minX) { Panel DragDropBackgroundPanel = new Panel(); DragDropBackgroundPanel.Enabled = true; DragDropBackgroundPanel.Visible = true; DragDropBackgroundPanel.Size = FileAreaPanel.Size; DragDropBackgroundPanel.Location = new Point(0, 0); DragDropBackgroundPanel.BackColor = Color.Transparent; DragDropBackgroundPanel.Paint += DragDropPaint; Panel panel_Files = new Panel(); panel_Files.Size = DragDropBackgroundPanel.Size; panel_Files.Location = new Point(0, 0); panel_Files.BackgroundImage = Properties.Resources.drag_drop_BG_new2; panel_Files.BackgroundImageLayout = ImageLayout.Stretch; DragDropBackgroundPanel.Controls.Add(panel_Files); TransparentControl panel_MouseInteract = new TransparentControl(); panel_MouseInteract.Size = DragDropBackgroundPanel.Size; panel_MouseInteract.Location = new Point(0, 0); panel_MouseInteract.AllowDrop = true; panel_MouseInteract.DragEnter += DragDrop_Enter; panel_MouseInteract.DragLeave += DragDrop_Leave; panel_MouseInteract.DragDrop += DragDrop_Drop; DragDropBackgroundPanel.Controls.Add(panel_MouseInteract); panel_MouseInteract.BringToFront(); CustomGeneralButton btn_FromComputer = new CustomGeneralButton(); btn_FromComputer.Size = new Size((int)((decimal)panel_Files.Width / 1.3M), 50); btn_FromComputer.Location = new Point(panel_Files.Width / 2 - btn_FromComputer.Width / 2, 260); btn_FromComputer.ButtonText = "..or load file(s) from your Computer!"; btn_FromComputer.TextFont = new Font("Arial", 14, FontStyle.Bold, GraphicsUnit.Pixel); btn_FromComputer.ForeColor = Color.FromArgb(255, 112, 119, 144); DragDropBackgroundPanel.Controls.Add(btn_FromComputer); btn_FromComputer.Click += btn_ChooseFromDevice_Click; btn_FromComputer.BringToFront(); return(DragDropBackgroundPanel); }
private HighlightPanel CreateLeftButton(string text, Point location, int id) { HighlightPanel hPanel = new HighlightPanel(); Panel panel1 = new Panel(); panel1.BackColor = Color.Transparent; panel1.Width = panel_MainLeft.Width; panel1.Location = location; // Start at Y 160 panel1.Height = 40; hPanel.MainPanel = panel1; Panel panel_Highlight1 = new Panel(); panel_Highlight1.Width = 0; panel_Highlight1.Height = panel1.Height; panel_Highlight1.BackColor = Color.FromArgb(255, 3, 173, 196); hPanel.PopupPanel = panel_Highlight1; Label label1 = new Label(); label1.Font = new Font("Arial", 16, FontStyle.Bold, GraphicsUnit.Pixel); label1.Location = new Point(50, panel1.Height / 3); // 21 is the max size of the highlight panel, so little more than that label1.ForeColor = GUITools.COLOR_DarkMode_Text_Light; label1.Width = panel1.Width - label1.Location.X; label1.Text = text; hPanel.TextLabel = label1; panel1.Controls.Add(panel_Highlight1); panel1.Controls.Add(label1); TransparentControl panel_MouseInteraction = new TransparentControl(); panel_MouseInteraction.Size = panel1.Size; panel_MouseInteraction.Location = new Point(0, 0); panel_MouseInteraction.BackColor = Color.Transparent; panel_MouseInteraction.MouseEnter += (sender, args) => { panel_MouseInteraction.Cursor = Cursors.Hand; hPanel.IsHighlighted = true; }; panel_MouseInteraction.MouseLeave += (sender, args) => { panel_MouseInteraction.Cursor = Cursors.Arrow; hPanel.IsHighlighted = false; }; panel_MouseInteraction.MouseClick += (sender, args) => { LeftButtonClickEvent(id); }; panel1.Controls.Add(panel_MouseInteraction); panel_MouseInteraction.BringToFront(); return(hPanel); }
public DarkFileDisplay(int width, int height, Bitmap thumbnail, bool framed, string fileName, Control target) { MainSize = new Size(width, height); Thumbnail = thumbnail; Framed = framed; FileName = fileName; int thumbBottomY = height - (int)((decimal)height / 3.4M); panel_Background = new Panel(); panel_Background.Size = MainSize; panel_Background.Paint += PaintBackgroundPanel; //target.Controls.Add(panel_Background); if (framed) { panel_Background.BackgroundImage = Properties.Resources.file_cornice; panel_Background.BackgroundImageLayout = ImageLayout.Stretch; } TransparentControl panel_MouseEvents = new TransparentControl(); panel_MouseEvents.Size = panel_Background.Size; panel_MouseEvents.BackColor = Color.Transparent; panel_MouseEvents.MouseEnter += (sender, args) => { if (!IsSelected) { panel_Background.BackColor = MouseOverColor; } else { PaintBorder = true; panel_Background.Invalidate(); } }; panel_MouseEvents.MouseLeave += (sender, args) => { if (!IsSelected) { panel_Background.BackColor = Color.Transparent; } PaintBorder = false; panel_Background.Invalidate(); }; panel_MouseEvents.MouseClick += (sender, args) => { foreach (Action a in ClickActionsList) { a.Invoke(); } }; panel_Background.Controls.Add(panel_MouseEvents); // // Picturebox Thumbnail // pBox_Thumbnail = new PictureBox(); int p_width; int p_height; if (thumbnail.Width > thumbnail.Height) { p_width = (int)(((decimal)MainSize.Width / 100M) * 75); p_height = (int)(((decimal)MainSize.Height / 100M) * 40); } else if (thumbnail.Width < thumbnail.Height) { decimal newHeight = MainSize.Height - (MainSize.Height - thumbBottomY); //p_width = (int)(((decimal)MainSize.Width / 100M) * 40); //p_height = (int)(((decimal)MainSize.Height / 100M) * 60); p_width = (int)(((decimal)MainSize.Width / 100M) * 50); p_height = (int)((newHeight / 100M) * 85); } else { p_width = (int)(((decimal)MainSize.Width / 100M) * 60); p_height = (int)(((decimal)MainSize.Height / 100M) * 60); } pBox_Thumbnail.Size = new Size(p_width, p_height); pBox_Thumbnail.SizeMode = PictureBoxSizeMode.StretchImage; pBox_Thumbnail.Location = new Point((panel_Background.Width / 2) - p_width / 2, thumbBottomY - p_height); // Goal: The bottom of the image is always at the same Y coordinate. pBox_Thumbnail.Image = ImageEditing.DrawImageScaled(pBox_Thumbnail.Width, pBox_Thumbnail.Height, thumbnail); //pBox_Thumbnail.Image = ImageEditing.DrawImageScaled(pBox_Thumbnail.Width, pBox_Thumbnail.Height, thumbnail); // pBox_Thumbnail.Image = thumbnail; panel_Background.Controls.Add(pBox_Thumbnail); // // File name label // Label label_FileName = new Label(); label_FileName.Font = new Font("Arial", 11, FontStyle.Regular, GraphicsUnit.Pixel); label_FileName.ForeColor = GUITools.COLOR_DarkMode_Text_Bright; label_FileName.MaximumSize = new Size((int)(((decimal)MainSize.Width / 100M) * 80), MainSize.Height - thumbBottomY - 5); label_FileName.AutoSize = false; label_FileName.Text = GUITools.FitTextLenghtToLabelSize(fileName, label_FileName); label_FileName.BackColor = Color.Transparent; label_FileName.Location = new Point(MainSize.Width / 2 - label_FileName.Width / 2, thumbBottomY + 5); panel_Background.Controls.Add(label_FileName); progress_Download = new CustomProgressBar() { Size = new Size(width, 8), Location = new Point(0, 0), }; progress_Download.BackgroundBarColor = GUITools.COLOR_DarkMode_Light; progress_Download.ProgressBarColor = Color.Green; progress_Download.Percentage = 0; progress_Download.Visible = false; panel_Background.Controls.Add(progress_Download); panel_Check = new Panel(); panel_Check.Size = new Size(10, 10); panel_Check.Location = new Point(panel_Background.Width / 2 - panel_Check.Width / 2, 0); panel_Check.Visible = false; panel_Check.BackgroundImageLayout = ImageLayout.Stretch; panel_Background.Controls.Add(panel_Check); // Always as last thing panel_MouseEvents.BringToFront(); }