public ImageComboBoxItem(string text, Font font, Color foreColor, int imageIndex, EImageComboBoxTextAlign textAlign, object tag) {
			Text = text;
			Font = font;
			ForeColor = foreColor;
			ImageIndex = imageIndex;
			TextAlign = textAlign;
			Tag = tag;
		}
Exemple #2
0
 public ImageComboBoxItem(string text, Font font, Color foreColor, int imageIndex, EImageComboBoxTextAlign textAlign, object tag)
 {
     Text       = text;
     Font       = font;
     ForeColor  = foreColor;
     ImageIndex = imageIndex;
     TextAlign  = textAlign;
     Tag        = tag;
 }
Exemple #3
0
        public frmLanguage(ELanguage selectedLang)
        {
            InitializeComponent();

            // Fill image combobox
            int i = 0, selectedIndex = -1;
            EImageComboBoxTextAlign textAlign = EImageComboBoxTextAlign.Right;
            Font  font      = cmbLanguage.Font;
            Color fontColor = cmbLanguage.ForeColor;

            foreach (string langName in Enum.GetNames(typeof(ELanguage)))
            {
                if (langName != "None")
                {
                    cmbLanguage.Items.Add(new ImageComboBoxItem(langName, font, fontColor, i, textAlign));

                    if (langName == selectedLang.ToString())
                    {
                        selectedIndex = i;
                    }
                    i++;
                }
            }

            if (selectedIndex != -1)
            {
                cmbLanguage.SelectedIndex = selectedIndex;

                // Hardcoded, sorry..
                switch (selectedLang.ToString().ToLower())
                {
                case "german":
                    imgLanguage.Image = Properties.Resources.flag_germany;
                    Icon = Properties.Resources.flag_germany_icon;
                    break;

                case "english":
                    imgLanguage.Image = Properties.Resources.flag_great_britain;
                    Icon = Properties.Resources.flag_great_britain_icon;
                    break;
                }
            }
        }
        public frmTradeListFilter()
        {
            InitializeComponent();

            TradeFilter = null;

            // Resource image list
            cmbItemOffer.ImageList    = TradeListView.ResourceImages;
            cmbItemDemanded.ImageList = TradeListView.ResourceImages;

            // Fill image combobox
            int i = -1;
            EImageComboBoxTextAlign textAlign = EImageComboBoxTextAlign.Right;
            Font  font      = cmbItemOffer.Font;
            Color fontColor = cmbItemOffer.ForeColor;

            foreach (string resource in Enum.GetNames(typeof(EResource)))
            {
                if ((i = cmbItemOffer.ImageList.Images.IndexOfKey(resource)) != -1)
                {
                    string name = Program.Language.GetString(resource);
                    cmbItemOffer.Items.Add(new ImageComboBoxItem(name, font, fontColor, i, textAlign));
                    cmbItemDemanded.Items.Add(new ImageComboBoxItem(name, font, fontColor, i, textAlign));
                    // Add to cache (to find localized resource)
                    if (mResourceCache.ContainsKey(name) == false)
                    {
                        mResourceCache.Add(name, (EResource)Enum.Parse(typeof(EResource), resource));
                    }
                }
            }
            // First item: None
            cmbItemOffer.Items.Insert(0, "None");
            cmbItemOffer.SelectedIndex = 0;
            cmbItemDemanded.Items.Insert(0, "None");
            cmbItemDemanded.SelectedIndex = 0;

            // Defaul value for operator: > (Higher)
            cmbItemOfferOperator.SelectedIndex    = 0;
            cmbItemDemandedOperator.SelectedIndex = 0;
            cmbRatioOperator.SelectedIndex        = 0;
        }
		public ImageComboBoxItem(string text, Font font, Color foreColor, int imageIndex, EImageComboBoxTextAlign textAlign)
			: this(text, font, foreColor, imageIndex, textAlign, null) {
		}
Exemple #6
0
 public ImageComboBoxItem(string text, Font font, Color foreColor, int imageIndex, EImageComboBoxTextAlign textAlign)
     : this(text, font, foreColor, imageIndex, textAlign, null)
 {
 }