コード例 #1
0
ファイル: Card.cs プロジェクト: JayConnerGhost/IronCards
        private void UpdateUi()
        {
            var nameLabel = (Label)this.Controls.Find("nameLabel", true).First();

            nameLabel.Text = CardName;
            _globalToolTip.SetToolTip(nameLabel, CardName);
            var pointsLabel = (Label)this.Controls.Find("pointsLabel", true).First();

            pointsLabel.Text = CardPoints.ToString();

            this.BackColor = CardTypesUtilities.GetColor(CardType);
        }
コード例 #2
0
ファイル: Card.cs プロジェクト: JayConnerGhost/IronCards
        private void BuildCard(CardTypes cardType)
        {
            BuildMenu();
            var cardBodyLayout = new FlowLayoutPanel
            {
                FlowDirection = FlowDirection.TopDown, Dock = DockStyle.Fill, ContextMenuStrip = contextMenu,
            };

            cardBodyLayout.MouseDown += CardBodyLayout_MouseDown;

            this.BorderStyle = BorderStyle.FixedSingle;


            SetBackColor(this, cardType);


            this.Margin = new Padding(10, 20, 10, 10);
            this.Width  = 240;
            this.Height = 120;
            //Id
            var IdLabel = new Label()
            {
                Text  = CardId.ToString(),
                Width = 25,

                BorderStyle = BorderStyle.None
            };

            cardBodyLayout.Controls.Add(IdLabel);
            //Name row
            var nameLabel = new Label
            {
                Text = CardName, Width = 200, BorderStyle = BorderStyle.None,
                Name = "nameLabel",
            };

            _globalToolTip.SetToolTip(nameLabel, CardName);
            cardBodyLayout.Controls.Add(nameLabel);

            var propertiesLayout = new FlowLayoutPanel()
            {
                FlowDirection = FlowDirection.LeftToRight, Size = new Size(200, 30)
            };
            var pointsLabel = new Label()
            {
                Text = "Points: ", Width = 40
            };

            propertiesLayout.Controls.Add(pointsLabel);
            var pointsValue = new Label()
            {
                Text = CardPoints.ToString(), Width = 25, Name = "pointsLabel"
            };

            propertiesLayout.Controls.Add(pointsValue);


            var controlsLayout = new FlowLayoutPanel
            {
                Size = new Size(235, 30), FlowDirection = FlowDirection.RightToLeft
            };
            var editButton = new Button()
            {
                Text = "Edit"
            };

            editButton.Click += EditButton_Click;
            var viewButton = new Button()
            {
                Text = "View"
            };

            viewButton.Click += ViewButton_Click;
            controlsLayout.Controls.Add(editButton);
            controlsLayout.Controls.Add(viewButton);
            cardBodyLayout.Controls.Add(propertiesLayout);
            cardBodyLayout.Controls.Add(controlsLayout);
            this.Controls.Add(cardBodyLayout);
        }