Example #1
0
        protected virtual void OnPaintForeground(PaintEventArgs e)
        {
            Color selectedItemBGColor = MetroPaint.GetStyleColor(this.metroStyle);

            if (useCustomForeColor)
            {
                selectedItemBGColor = ForeColor;
            }
            Color foreColor = MetroPaint.ForeColor.Label.Normal(this.metroTheme);

            for (int i = 0; i < this.Items.Count; i++)
            {
                int       curY      = (i * ItemHeight) - (ItemHeight * scrollY);
                Rectangle itemRect  = new Rectangle(0, curY, Width, ItemHeight);
                Color     textColor = foreColor;

                if (this.SelectedIndex == i)
                {
                    using (Brush b = new SolidBrush(selectedItemBGColor))
                    {
                        e.Graphics.FillRectangle(b, itemRect);
                    }
                    textColor = Color.White;
                }
                else if (itembgColors.Count > i && itembgColors[i] != Color.Empty)
                {
                    using (Brush b = new SolidBrush(itembgColors[i]))
                    {
                        e.Graphics.FillRectangle(b, itemRect);
                    }
                    textColor = itembgColors[i].GetBrightness() < 0.5 ? Color.White : Color.Black;
                }

                if (drawSeperator && i != this.Items.Count - 1)
                {
                    using (Pen p = new Pen(seperatorColor)) {
                        e.Graphics.DrawLine(p, 0, curY + ItemHeight - 1, this.Width, curY + ItemHeight - 1);
                    }
                }

                ListIcon curIcon = null;
                if (icons.Count > 0)
                {
                    if (repeatIcons)
                    {
                        curIcon = icons[i % icons.Count];
                    }
                    else if (i < icons.Count)
                    {
                        curIcon = icons[i];
                    }
                }

                PaintListItemForeground(e, i, itemRect, curIcon, textColor);
            }

            OnCustomPaintForeground(new MetroPaintEventArgs(Color.Empty, selectedItemBGColor, e.Graphics));
        }
Example #2
0
        public SPListItem AddItem(String text, Uri uri, ListIcon icon)
        {
            SPListItem c = new SPListItem(this.Parent);

            c.Text = text;
            c.Uri  = uri;
            c.Icon = icon;
            this.Children.Add(c);
            return(c);
        }
Example #3
0
 void instance_Loaded(object sender, EventArgs e)
 {
     this.Text = this.AppInstance.GetName();
     if (this.AppInstance.GetIcon() != null)
     {
         this.Icon = this.AppInstance.GetIcon();
     }
     this.SubText = this.AppInstance.GetSubName();
     this.parent.Invalidate();
 }
Example #4
0
        protected Texture2D _getDlgIcon(ListIcon whichOne)
        {
            const int NUM_PER_ROW = 9;
            const int ICON_SIZE   = 31;

            Texture2D weirdSheet = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 27);

            Color[] dat = new Color[ICON_SIZE * ICON_SIZE];

            Rectangle src = new Rectangle(((int)whichOne % NUM_PER_ROW) * ICON_SIZE, 291 + ((int)whichOne / NUM_PER_ROW) * ICON_SIZE, ICON_SIZE, ICON_SIZE);

            weirdSheet.GetData(0, src, dat, 0, dat.Length);

            Texture2D ret = new Texture2D(EOGame.Instance.GraphicsDevice, ICON_SIZE, ICON_SIZE);

            ret.SetData(dat);
            return(ret);
        }
Example #5
0
        public virtual void PaintListItemForeground(PaintEventArgs e, int i, Rectangle itemRect, ListIcon icon, Color textColor)
        {
            if (icon != null)
            {
                Image img = SelectedIndex == i ? icon.ItemSelectedIcon : icon.Icon;
                if (img != null)
                {
                    e.Graphics.DrawImage(img, new Rectangle(16, (i * ItemHeight) + (ItemHeight / 2) - 8, 16, 16));
                }
            }

            Rectangle textRect = itemRect;

            if (icon == null)
            {
                textRect.X     = textRect.X + 10;
                textRect.Width = textRect.Width - 10;
            }
            else
            {
                textRect.X     = textRect.X + 40;
                textRect.Width = textRect.Width - 40;
            }

            if (this.ItemSubTexts.Count > i && subTexts[i] != null && ItemHeight > 40)
            {
                //Ugly hacks look nice
                Rectangle mainTextRect = textRect, subTextRect; //Top part of item is for main text
                mainTextRect.Height = mainTextRect.Height / 2;

                subTextRect = mainTextRect;                     //Bottom part is for subtext
                subTextRect.Offset(3, mainTextRect.Height);
                subTextRect.Width  = subTextRect.Width - 3;
                subTextRect.Height = subTextRect.Height - 5;    //Vertical offset

                mainTextRect.Height = mainTextRect.Height - 7;  //Vertical offset
                mainTextRect.Y      = mainTextRect.Y + 7;

                String mainStr = ClipText(e.Graphics, mainFont, Items[i].ToString(), mainTextRect.Width);
                TextRenderer.DrawText(
                    e.Graphics,
                    mainStr,
                    mainFont,
                    mainTextRect,
                    textColor,
                    TextFormatFlags.Left | TextFormatFlags.Bottom
                    );

                String subStr = ClipText(e.Graphics, subFont, subTexts[i], subTextRect.Width);
                TextRenderer.DrawText(
                    e.Graphics,
                    subStr,
                    subFont,
                    subTextRect,
                    textColor,
                    TextFormatFlags.Left | TextFormatFlags.VerticalCenter
                    );
            }
            else
            {
                String str = ClipText(e.Graphics, subFont, Items[i].ToString(), textRect.Width);
                TextRenderer.DrawText(
                    e.Graphics,
                    str,
                    subFont,
                    textRect,
                    textColor,
                    TextFormatFlags.Left | TextFormatFlags.VerticalCenter
                    );
            }
        }
Example #6
0
        private void ShowPersonTable(List <object> people)
        {
            Debug.WriteLine("ShowPersonTable");
            individualsTableLayoutPanel.Size = new Size()
            {
                Height = 100, Width = individualsTableLayoutPanel.Width
            };
            individualsTableLayoutPanel.AutoSize        = true;
            individualsTableLayoutPanel.CellBorderStyle = TableLayoutPanelCellBorderStyle.Single;
            individualsTableLayoutPanel.ColumnCount     = 0; individualsTableLayoutPanel.RowCount = 0;
            individualsTableLayoutPanel.ColumnCount     = 6;
            individualsTableLayoutPanel.RowCount        = 1;

            Debug.WriteLine(String.Format("Columns Styles Count: {0}", individualsTableLayoutPanel.ColumnStyles.Count));
            TableLayoutColumnStyleCollection styles = individualsTableLayoutPanel.ColumnStyles;

            for (int i = styles.Count; i > 0; i--)
            {
                styles.RemoveAt(i - 1);
            }
            Debug.WriteLine(String.Format("Columns Styles Count: {0}", individualsTableLayoutPanel.ColumnStyles.Count));


            individualsTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));      //Coluna 1 com largura variavel
            individualsTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));      //Coluna 2 com largura variavel
            individualsTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));      //Coluna 3 com largura variavel
            individualsTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 40F)); //Coluna 4 com largura fixa
            individualsTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 40F)); //Coluna 5 com largura fixa
            individualsTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 40F)); //Coluna 6 com largura fixa


            individualsTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 50F));
            individualsTableLayoutPanel.Controls.Add(new TitleLabel("N.º Documento", AnchorStyles.Left), 0, 0);
            individualsTableLayoutPanel.Controls.Add(new TitleLabel("Primeiro Nome", AnchorStyles.Left), 1, 0);
            individualsTableLayoutPanel.Controls.Add(new TitleLabel("Apelido", AnchorStyles.Left), 2, 0);
            individualsTableLayoutPanel.Controls.Add(new TitleLabel("Tipo"), 3, 0);
            individualsTableLayoutPanel.Controls.Add(new TitleLabel("Ver"), 4, 0);
            individualsTableLayoutPanel.Controls.Add(new TitleLabel("Apagar"), 5, 0);

            foreach (object item in people)
            {
                individualsTableLayoutPanel.RowCount = individualsTableLayoutPanel.RowCount + 1;
                individualsTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 10F));
                if (item is Person person)
                {
                    if (person.IdDocuments.Count > 0)
                    {
                        individualsTableLayoutPanel.Controls.Add(new MyLabel(person.GetOneDocument(), AnchorStyles.Left), 0, individualsTableLayoutPanel.RowCount - 1);
                    }
                    else
                    {
                        individualsTableLayoutPanel.Controls.Add(new MyLabel("Sem Documentos", AnchorStyles.Left), 0, individualsTableLayoutPanel.RowCount - 1);
                    }
                    individualsTableLayoutPanel.Controls.Add(new MyLabel(person.FirstName, AnchorStyles.Left), 1, individualsTableLayoutPanel.RowCount - 1);
                    individualsTableLayoutPanel.Controls.Add(new MyLabel(person.LastName, AnchorStyles.Left), 2, individualsTableLayoutPanel.RowCount - 1);
                    if (person is Student)
                    {
                        PictureBox pictureBox = new PictureBox();
                        pictureBox.SizeMode   = PictureBoxSizeMode.StretchImage;
                        pictureBox.ClientSize = new Size(30, 30);
                        pictureBox.Image      = (Image) new Bitmap(JustiCal.Properties.Resources.cadetIco);
                        individualsTableLayoutPanel.Controls.Add(pictureBox, 3, individualsTableLayoutPanel.RowCount - 1);
                    }
                    else if (person is Militar)
                    {
                        PictureBox pictureBox = new PictureBox();
                        pictureBox.SizeMode   = PictureBoxSizeMode.StretchImage;
                        pictureBox.ClientSize = new Size(30, 30);
                        pictureBox.Image      = (Image) new Bitmap(JustiCal.Properties.Resources.militaryIco1);
                        individualsTableLayoutPanel.Controls.Add(pictureBox, 3, individualsTableLayoutPanel.RowCount - 1);
                    }
                    else
                    {
                        individualsTableLayoutPanel.Controls.Add(new Label()
                        {
                            Text = "   "
                        }, 3, individualsTableLayoutPanel.RowCount - 1);
                    }
                    ListIcon listIconWatch = new ListIcon(JustiCal.Properties.Resources.watchIco);
                    listIconWatch.objectPassed = item;
                    listIconWatch.Click       += ListIconWatch_Click;
                    individualsTableLayoutPanel.Controls.Add(listIconWatch, 4, individualsTableLayoutPanel.RowCount - 1);


                    ListIcon listIconDelete = new ListIcon(JustiCal.Properties.Resources.deleteIco);
                    listIconDelete.objectPassed = item;
                    listIconDelete.Click       += ListIconDelete_Click;
                    individualsTableLayoutPanel.Controls.Add(listIconDelete, 5, individualsTableLayoutPanel.RowCount - 1);
                }
                if (item is Student)
                {
                }
            }
        }
Example #7
0
        public void LoadImageName()
        {
            // open folder, get all filenames
            //AppDomain.CurrentDomain.BaseDirectory

            string path = AppDomain.CurrentDomain.BaseDirectory + foldername;

            string[] filenames = Directory.GetFiles(path);


            // check filename to assign to variables
            foreach (var fullname in filenames)
            {
                string filename = Path.GetFileName(fullname);

                string[] tokens = StringProcess.SplitString(filename, new string[] { "_" });

                if (tokens[0].ToLower() == "Application".ToLower())
                {
                    ApplicationIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Option".ToLower())
                {
                    OptionIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Remove".ToLower())
                {
                    RemoveIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "RemoveAll".ToLower())
                {
                    RemoveAllIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Add".ToLower())
                {
                    AddIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Preview".ToLower())
                {
                    PreviewIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Start".ToLower())
                {
                    StartIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Refresh".ToLower())
                {
                    RefreshIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Help".ToLower())
                {
                    HelpIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Open".ToLower())
                {
                    OpenIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Save".ToLower())
                {
                    SaveIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Information".ToLower())
                {
                    InformationIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "File".ToLower())
                {
                    FileIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Folder".ToLower())
                {
                    FolderIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "Action".ToLower())
                {
                    ActionIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
                else if (tokens[0].ToLower() == "List".ToLower())
                {
                    ListIcon.Add
                    (
                        new MyString()
                    {
                        Value = path + filename
                    }
                    );
                }
            }
        }
Example #8
0
 public SPListItem AddItem(String text, Uri uri, ListIcon icon)
 {
     SPListItem c = new SPListItem(this.Parent);
     c.Text = text;
     c.Uri = uri;
     c.Icon = icon;
     this.Children.Add(c);
     return c;
 }
Example #9
0
  void instance_Loaded(object sender, EventArgs e)
  {
      this.Text = this.AppInstance.GetName();
      if (this.AppInstance.GetIcon() != null)
          this.Icon = this.AppInstance.GetIcon();
      this.SubText = this.AppInstance.GetSubName();
      this.parent.Invalidate();
 
  }
Example #10
0
		protected Texture2D _getDlgIcon(ListIcon whichOne)
		{
			const int NUM_PER_ROW = 9;
			const int ICON_SIZE = 31;

			Texture2D weirdSheet = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 27);
			Color[] dat = new Color[ICON_SIZE * ICON_SIZE];

			Rectangle src = new Rectangle(((int)whichOne % NUM_PER_ROW) * ICON_SIZE, 291 + ((int)whichOne / NUM_PER_ROW) * ICON_SIZE, ICON_SIZE, ICON_SIZE);
			weirdSheet.GetData(0, src, dat, 0, dat.Length);

			Texture2D ret = new Texture2D(EOGame.Instance.GraphicsDevice, ICON_SIZE, ICON_SIZE);
			ret.SetData(dat);
			return ret;
		}
Example #11
0
        public void LoadImageName()
        {
            // open folder, get all filenames
            string path = AppDomain.CurrentDomain.BaseDirectory + foldername;

            string[] filenames = Directory.GetFiles(path);


            // check filename to assign to variables
            foreach (var fullname in filenames)
            {
                string filename = Path.GetFileName(fullname);

                string[] tokens = filename.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries);

                if (tokens[0].ToLower() == "Application".ToLower())
                {
                    ApplicationIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Option".ToLower())
                {
                    OptionIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Remove".ToLower())
                {
                    RemoveIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "RemoveAll".ToLower())
                {
                    RemoveAllIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Add".ToLower())
                {
                    AddIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Preview".ToLower())
                {
                    PreviewIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Start".ToLower())
                {
                    StartIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Refresh".ToLower())
                {
                    RefreshIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Help".ToLower())
                {
                    HelpIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Open".ToLower())
                {
                    OpenIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Save".ToLower())
                {
                    SaveIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Information".ToLower())
                {
                    InformationIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "File".ToLower())
                {
                    FileIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Folder".ToLower())
                {
                    FolderIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "Action".ToLower())
                {
                    ActionIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "List".ToLower())
                {
                    ListIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "UpDirection".ToLower())
                {
                    UpDirectionIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "RightDirection".ToLower())
                {
                    RightDirectionIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "DownDirection".ToLower())
                {
                    DownDirectionIcon.Add
                    (
                        path + filename
                    );
                }
                else if (tokens[0].ToLower() == "LeftDirection".ToLower())
                {
                    LeftDirectionIcon.Add
                    (
                        path + filename
                    );
                }
                else
                {
                    Images.Add
                    (
                        path + filename
                    );
                }
            }
        }