Ejemplo n.º 1
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="AButton">コントローラ化するタッチ対応ボタン</param>
        /// <param name="AOnApply">コントローラの値をポケミクに送るときの処理</param>
        public ToggleAndTouchButton(TouchSupportedButton AButton, Action <Controller> AOnApply)
            : base(AOnApply)
        {
            Button = AButton;

            Button.MouseDown += (sender, e) =>
            {
                FireButtonEvent(sender, e, true);
            };

            Button.MouseUp += (sender, e) =>
            {
                FireButtonEvent(sender, e, false);
            };

            Button.Click += (sender, e) =>
            {
                if (!TouchMode)
                {
                    XOn = !XOn;

                    Apply();
                }
            };
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 鍵盤用のボタンを生成する。
        /// </summary>
        protected void CreatePianoKeys()
        {
            for (int i = 0; i < Octaves * 5; i++)
            {
                var Key = new TouchSupportedButton();
                Key.BackColor  = Color.Black;
                Key.MouseDown += new MouseEventHandler(OnMouseDown);
                Key.MouseUp   += new MouseEventHandler(OnMouseUp);
                BlackKeys.Add(Key);
            }

            BasePanel.Controls.AddRange(BlackKeys.ToArray());

            for (int i = 0; i < Octaves * 7 + 1; i++)
            {
                var Key = new TouchSupportedButton();
                Key.BackColor  = Color.White;
                Key.MouseDown += new MouseEventHandler(OnMouseDown);
                Key.MouseUp   += new MouseEventHandler(OnMouseUp);
                WhiteKeys.Add(Key);
            }

            BasePanel.Controls.AddRange(WhiteKeys.ToArray());
        }