public ClassImage(string Name, ResourceColor ClassColor) { //ImagePanel ImagePanel = new Panel(); ImagePanel.Size = new System.Drawing.Size(128, 128); FullName = Name; ImagePanel.Click += ImageClicked; //TextBox TextBox = new Label(); TextBox.BackColor = Color.Transparent; //TextBox.BackColor = Color.Purple; TextBox.Location = new Point(6, 7); TextBox.Size = new System.Drawing.Size(107, 90); TextBox.Text = Name.Substring(0, Name.Length - 3); TextBox.TextAlign = ContentAlignment.MiddleCenter; ImagePanel.Controls.Add(TextBox); TextBox.Click += ImageClicked; //Path ResourcesPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources"); ResourcesPath = Path.Combine(ResourcesPath, "Images"); ResourcesPath = Path.Combine(ResourcesPath, "Book_Images"); string BookColor = ColorList[(int)ClassColor]; string PathToPicture = Path.Combine(ResourcesPath, BookColor); ImagePanel.BackgroundImage = System.Drawing.Image.FromFile(PathToPicture); TextBox.BackColor = Color.Transparent; ImagePanel.BackColor = Color.Transparent; }
public static List <ResourceCard> CreateSeveralResourceCards(int count, ResourceColor color) { List <ResourceCard> bunchOfCards = new List <ResourceCard>(); for (int i = 0; i < count; i++) { bunchOfCards.Add(new ResourceCard(color)); } return(bunchOfCards); }
public PagePanel(string Name, string Date, string Type, bool IsLink, ResourceColor ResourceColor) { BasePanel = new TableLayoutPanel(); this.BasePanel.ColumnCount = 4; this.BasePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 74.07407F)); this.BasePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25.92593F)); this.BasePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 37F)); this.BasePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 36F)); this.BasePanel.RowCount = 5; this.BasePanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 34.32836F)); this.BasePanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 65.67164F)); this.BasePanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 21F)); this.BasePanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 18F)); this.BasePanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 10F)); this.BasePanel.Size = new System.Drawing.Size(128, 128); this.Name = Name; string ResourcesPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources"); ResourcesPath = Path.Combine(ResourcesPath, "Images"); ResourcesPath = Path.Combine(ResourcesPath, "Square_Images"); string SquarePath = Path.Combine(ResourcesPath, ColorList[(int)ResourceColor]); BasePanel.BackgroundImage = System.Drawing.Image.FromFile(SquarePath); BasePanel.BackColor = Color.Transparent; BasePanel.DoubleClick += Double_Click; BasePanel.Click += Right_Click; if (IsLink) { AddLinkSymbol(); } //Add Delete Symbol PictureBox DeletePanel = new PictureBox(); string ExitPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources"); ExitPath = Path.Combine(ExitPath, "Images"); ExitPath = Path.Combine(ExitPath, "Delete_Symbol.png"); DeletePanel.ImageLocation = ExitPath; DeletePanel.InitialImage = System.Drawing.Image.FromFile(ExitPath); BasePanel.Controls.Add(DeletePanel, 3, 0); DeletePanel.Click += DeletePanel_Click; //Add Name Label Label NameLabel = new Label(); NameLabel.Text = Name; NameLabel.BackColor = Color.Transparent; NameLabel.Size = new Size(128, 50); BasePanel.Controls.Add(NameLabel, 0, 1); BasePanel.SetColumnSpan(NameLabel, 5); NameLabel.TextAlign = ContentAlignment.MiddleCenter; NameLabel.DoubleClick += Double_Click; NameLabel.Click += Right_Click; //Add Date label Label DateLabel = new Label(); DateLabel.Text = Date; DateLabel.BackColor = Color.Transparent; DateLabel.Size = new Size(128, 20); DateLabel.Font = new Font("Palatino Linotype", 8, FontStyle.Bold); BasePanel.Controls.Add(DateLabel, 0, 2); BasePanel.SetColumnSpan(DateLabel, 4); DateLabel.TextAlign = ContentAlignment.TopCenter; DateLabel.DoubleClick += Double_Click; DateLabel.Click += Right_Click; //Add Type label Label TypeLabel = new Label(); TypeLabel.Text = Type; TypeLabel.BackColor = Color.Transparent; TypeLabel.Size = new Size(128, 20); TypeLabel.Font = new Font("Palatino Linotype", 8, FontStyle.Bold); BasePanel.Controls.Add(TypeLabel, 0, 3); BasePanel.SetColumnSpan(TypeLabel, 4); TypeLabel.TextAlign = ContentAlignment.TopCenter; TypeLabel.DoubleClick += Double_Click; TypeLabel.Click += Right_Click; }
// Constructor public ResourceCard(ResourceColor initColor) { color = initColor; }