예제 #1
0
        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
 private void HandleClick()
 {
     Console.WriteLine("Checkbox clicked");
     _state = _state == ChecboxState.Unchecked ? ChecboxState.Checked : ChecboxState.Unchecked;
 }