コード例 #1
0
ファイル: GUICheckbox.cs プロジェクト: jsgervais/DirectX2D
        public GUICheckbox(int x, int y, int w, int h, string text, Action onClickDelegate)
        {
            PositionX        = x;
            PositionY        = y;
            Width            = w;
            Height           = h;
            Text             = text;
            OnClickDelegate += onClickDelegate;
            OnClickDelegate += HandleClick;

            BackgroundColor      = Color.White;
            BorderColor          = Color.BlanchedAlmond;
            BackgroundColorHover = Color.AntiqueWhite;
            BorderColorHover     = Color.Bisque;
            TextColor            = Color.WhiteSmoke;

            TextFormat = new TextFormat(FactoryDWrite, "Calibri", 20)
            {
                TextAlignment = TextAlignment.Leading, ParagraphAlignment = ParagraphAlignment.Center
            };
            TextLayout = new TextLayout(FactoryDWrite, Text, TextFormat, Width - 25, Height);

            _state = ChecboxState.Unchecked;
        }
コード例 #2
0
ファイル: GUICheckbox.cs プロジェクト: jsgervais/DirectX2D
 private void HandleClick()
 {
     Console.WriteLine("Checkbox clicked");
     _state = _state == ChecboxState.Unchecked ? ChecboxState.Checked : ChecboxState.Unchecked;
 }