Exemplo n.º 1
0
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            if (e.Index == -1)
            {
                return;
            }

            InstallerResourceLanguage[] langs = InstallerResources.GetAvailableLanguages();
            InstallerResourceLanguage   lang  = langs[e.Index];

            e.DrawBackground();

            Graphics  g = e.Graphics;
            Rectangle r = e.Bounds;

            Int32 x = r.X + 2;
            Int32 y = r.Y + (r.Height / 2) - (lang.Flag.Height / 2);

            g.DrawImageUnscaled(lang.Flag, x, y);

            Size ts = TextRenderer.MeasureText(g, lang.LanguageName, SystemFonts.IconTitleFont);

            Int32 tx = r.X + lang.Flag.Width + 3;
            Int32 ty = r.Y + (r.Height / 2) - (ts.Height / 2);             // TODO: align by baseline, not by the rendered string size

// this code works, but it does make the list look funny
//			if( lang.RightToLeft ) {
//				tx = r.Width - ts.Width - 3;
//			}

            TextRenderer.DrawText(g, lang.LanguageName, SystemFonts.IconTitleFont, new Point(tx, ty), e.ForeColor);

            e.DrawFocusRectangle();
        }
Exemplo n.º 2
0
        protected override void OnCreateControl()
        {
            base.OnCreateControl();

            if (DesignMode)
            {
                return;
            }

            if (!_isPopulated)
            {
                Items.Clear();

                InstallerResourceLanguage[] languages = InstallerResources.GetAvailableLanguages();
                Items.AddRange(languages);
                SelectedItem = InstallerResources.CurrentLanguage;

                _isPopulated = true;
            }
        }