Esempio n. 1
0
        public GameControl(UserGameInfo userGame)
        {
            UserGameInfo = userGame;

            picture          = new PictureBox();
            picture.SizeMode = PictureBoxSizeMode.StretchImage;

            title = new Label();
            if (userGame == null)
            {
                title.Text = "No games";
            }
            else
            {
                title.Text = GameManager.Instance.NameManager.GetGameName(userGame.GameID);
            }
            TitleText = title.Text;

            BackColor = Color.FromArgb(30, 30, 30);
            Size      = new Size(200, 52);

            Controls.Add(picture);
            Controls.Add(title);

            DPIManager.Register(this);
        }
Esempio n. 2
0
        public GameControl(GenericGameInfo game, UserGameInfo userGame)
        {
            GameInfo     = game;
            UserGameInfo = userGame;

            picture          = new PictureBox();
            picture.SizeMode = PictureBoxSizeMode.StretchImage;

            title = new Label();
            if (game == null)
            {
                title.Text = "No games";
            }
            else
            {
                title.Text = GameInfo.GameName;
            }

            BackColor = Color.FromArgb(30, 30, 30);
            Size      = new Size(200, 52);

            Controls.Add(picture);
            Controls.Add(title);

            DPIManager.Register(this);
        }
Esempio n. 3
0
        public HandlerControl(GameHandlerMetadata metadata)
        {
            Metadata = metadata;

            picture          = new PictureBox();
            picture.SizeMode = PictureBoxSizeMode.StretchImage;

            title = new Label();
            if (metadata == null)
            {
                title.Text = "No handlers";
            }
            else
            {
                title.Text = metadata.ToString();
            }
            TitleText = title.Text;

            BackColor = Color.FromArgb(30, 30, 30);
            Size      = new Size(200, 52);

            Controls.Add(picture);
            Controls.Add(title);

            DPIManager.Register(this);
        }
Esempio n. 4
0
        public GameControl(GenericGameInfo game, UserGameInfo userGame)
        {
            GameInfo     = game;
            UserGameInfo = userGame;

            picture          = new PictureBox();
            picture.SizeMode = PictureBoxSizeMode.StretchImage;

            playerIcon          = new PictureBox();
            playerIcon.SizeMode = PictureBoxSizeMode.StretchImage;
            playerIcon.Image    = Gaming.Properties.Resources.players;

            numPlayersTt = new ToolTip();
            numPlayersTt.SetToolTip(playerIcon, "Number of players");

            title        = new Label();
            title.Font   = new Font("Segoe UI", 11, FontStyle.Bold);
            players      = new Label();
            players.Font = new Font("Segoe UI", 9);
            if (game == null)
            {
                title.Text   = "No games";
                players.Text = string.Empty;
                title.Font   = new Font("Segoe UI", 11, FontStyle.Regular);
            }
            else
            {
                title.Text = GameInfo.GameName;
                if (GameInfo.MaxPlayers > 2)
                {
                    players.Text = "2-" + GameInfo.MaxPlayers;
                }
                else
                {
                    players.Text = GameInfo.MaxPlayers.ToString();
                }
                //players.Text = "Players: " + GameInfo.MaxPlayers;
            }
            TitleText  = title.Text;
            PlayerText = players.Text;

            BackColor = Color.FromArgb(30, 30, 30);
            Size      = new Size(200, 52);

            Controls.Add(picture);
            Controls.Add(title);
            Controls.Add(players);
            Controls.Add(playerIcon);

            DPIManager.Register(this);
        }
Esempio n. 5
0
        public GameControl()
        {
            picture          = new PictureBox();
            picture.SizeMode = PictureBoxSizeMode.StretchImage;

            title = new Label();

            BackColor = ColorUnselected;
            Size      = new Size(200, 52);

            Controls.Add(picture);
            Controls.Add(title);

            DPIManager.Register(this);
        }
Esempio n. 6
0
        public CheckedTextControl()
        {
            checkbox = new SizeableCheckbox();

            title    = new Label();
            checkbox = new SizeableCheckbox();

            BackColor = ColorUnselected;
            Size      = new Size(200, 52);

            Controls.Add(checkbox);
            Controls.Add(title);

            DPIManager.Register(this);
        }
Esempio n. 7
0
        public GameNameControl()
        {
            picture          = new PictureBox();
            picture.SizeMode = PictureBoxSizeMode.StretchImage;

            title          = new Label();
            title.Text     = "Nothing selected";
            title.AutoSize = true;

            BackColor = Color.FromArgb(30, 30, 30);

            Controls.Add(picture);
            Controls.Add(title);

            DPIManager.Register(this);
        }
Esempio n. 8
0
        public BaseForm()
        {
            // Default DPI = 96 = 100%
            // 1 pt = 1/72 inch
            // 12pt = 1/6 inch
            // 12 * 300% = 36
            // 12 * 125% = 15
            // 12 * 150% = 18
            AutoScaleMode = AutoScaleMode.None;
            BackColor     = Color.FromArgb(50, 50, 50);
            ForeColor     = Color.White;
            Margin        = new Padding(4, 4, 4, 4);
            Name          = "BaseForm";
            Text          = "BaseForm";

            // create it here, else the desgienr will show the default windows font
            Font = new Font("Segoe UI", 12, GraphicsUnit.Point);

            DPIManager.Register(this);
        }
Esempio n. 9
0
        public BaseForm()
        {
            // Default DPI = 96 = 100%
            // 1 pt = 1/72 inch
            // 12pt = 1/6 inch
            // 12 * 300% = 36
            // 12 * 125% = 15
            // 12 * 150% = 18
            AutoScaleMode = AutoScaleMode.None;
            BackColor     = Color.FromArgb(54, 57, 63);
            ForeColor     = Color.FromArgb(240, 240, 240);
            Margin        = new Padding(4, 4, 4, 4);
            Name          = "BaseForm";
            Text          = "BaseForm";

            // Background is transparent for resizing system
            // Inheriting classes should override the OnResize function
            // and have all its control
            Color alpha = Color.Turquoise;

            this.TransparencyKey = alpha;
            this.BackColor       = alpha;

            this.DoubleBuffered = true;
            this.SetStyle(ControlStyles.ResizeRedraw, true); // this is to avoid visual artifacts

            // create it here, else the designer will show the default windows font
            Font = new Font("Segoe UI", 12, GraphicsUnit.Point);

#if SHADOWS
            int size = 5;
            hShadowImage = new Bitmap(size, 1, PixelFormat.Format32bppArgb);
            vShadowImage = new Bitmap(1, size, PixelFormat.Format32bppArgb);

            LockBitmap hLock = new LockBitmap(hShadowImage);
            LockBitmap vLock = new LockBitmap(vShadowImage);
            hLock.LockBits();
            vLock.LockBits();
            int step = 255 / (size + 1);
            for (int i = 1; i < size + 1; i++)
            {
                byte  gray = (byte)Math.Min(255, i * step);
                Color s    = Color.FromArgb(255, alpha.R / 2, alpha.G, alpha.B);
                hLock.SetPixel(i - 1, 0, s);
                vLock.SetPixel(0, i - 1, s);
            }
            hLock.UnlockBits();
            vLock.UnlockBits();
#endif

            if (!DesignMode)
            {
                DPIManager.Register(this);
            }

            filter = new MouseMessageFilter();
            filter.StartFiltering();

            filter.MouseMove += BaseForm_MouseMove;
            filter.MouseDown += BaseForm_MouseDown;
            filter.MouseUp   += BaseForm_MouseUp;
        }