Ejemplo n.º 1
0
 protected void ButtonClear_Click(object sender, EventArgs e)
 {
     foreach (string textBoxId in sTextBoxes.Keys)
     {
         (ContainerPanel.FindControl(textBoxId) as TextBox).Text = string.Empty;
     }
 }
Ejemplo n.º 2
0
 public Container(ControlBase parent) : base(parent)
 {
     m_Panel      = new ContainerPanel(null);
     m_Panel.Dock = Dock.Fill;
     PrivateChildren.Add(m_Panel);
     this.BoundsOutlineColor = Color.Cyan;
 }
Ejemplo n.º 3
0
        public BrowserWrapperControl(GetHiddenDriver getHiddenDriver, string processName)
        {
            var window = IntPtr.Zero;

            void SetWindow(IntPtr value)
            {
                window = value;
            }

            IntPtr GetWindow()
            {
                return(window);
            }

            if (!ContainerPanel.IsHandleCreated)
            {
                ContainerPanel.CreateControl();
            }
            var invoke = getHiddenDriver?.Invoke(out DriverService, ContainerPanel.Handle,
                                                 SetWindow);

            WebDriver = invoke?.Item2;
            //var windows = WebDriver?.WindowHandles.Select(e => long.Parse(e)).ToArray();
            Thread = invoke?.Item1;
            var processById = BrowserUtility.GetBrowserProcess(GetWindow, processName);

            Process            = processById;
            KillProcessOnClose = false;
            Loaded            += Window_Loaded;
        }
Ejemplo n.º 4
0
 public bool isPanelVisible()
 {
     if (ContainerPanel != null)
     {
         if (ContainerPanel.GetType() == typeof(SplitterPanel))
         {
             SplitContainer parent = (SplitContainer)ContainerPanel.Parent;
             if (parent.Panel1 == ContainerPanel)
             {
                 if (ArrowOrientation == Orientation.Horizontal)
                 {
                     return(parent.SplitterDistance != this.Width);
                 }
                 else
                 {
                     return(parent.SplitterDistance != this.Height);
                 }
             }
             else
             {
                 if (ArrowOrientation == Orientation.Horizontal)
                 {
                     return(parent.SplitterDistance != (parent.Width - this.Width));
                 }
                 else
                 {
                     return(parent.SplitterDistance != (parent.Height - this.Height));
                 }
             }
         }
         else
         {
             if (ArrowOrientation == Orientation.Horizontal)
             {
                 return(ContainerPanel.Width != this.Width);
             }
             else
             {
                 return(ContainerPanel.Height != this.Height);
             }
         }
     }
     else if (TogglePanel.GetType() == typeof(SplitterPanel))
     {
         SplitContainer parent = (SplitContainer)TogglePanel.Parent;
         if (parent.Panel1 == TogglePanel)
         {
             return(!parent.Panel1Collapsed);
         }
         else
         {
             return(!parent.Panel2Collapsed);
         }
     }
     else
     {
         return(TogglePanel.Visible);
     }
 }
Ejemplo n.º 5
0
        public void OpenPostRoundMenu()
        {
            SetClass("fade-in", true);
            ContainerPanel.SetClass("pop-in", true);

            ContentLabel.UpdateTranslation(new TranslationData("WIN.DESCRIPTION"));

            HeaderLabel.UpdateTranslation(new TranslationData(Utils.GetTranslationKey(_stats.WinningTeam, "WIN")));
            HeaderLabel.Style.FontColor = _stats.WinningColor;
        }
Ejemplo n.º 6
0
        protected override void Initialize()
        {
            base.Initialize();

            IsMouseVisible = true;

            input = new Input();

            //initialize GUI
            gui = new GUIContainer(new Rectangle(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT));

            //structure editor
            structureEditPanel = new StructureEditPanel(new Rectangle(0, FILE_BAR_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT - FILE_BAR_HEIGHT - EDIT_BAR_HEIGHT), this);
            gui.Add(structureEditPanel);

            //top bar (new, load, save)
            Panel fileBar = new Panel(new Rectangle(0, 0, SCREEN_WIDTH, FILE_BAR_HEIGHT));

            gui.Add(fileBar);

            Button newButton = new Button(new Rectangle(0, 0, FILE_BUTTON_WIDTH, FILE_BAR_HEIGHT), "New", New, fileBar);

            gui.Add(newButton);

            Button openButton = new Button(new Rectangle(FILE_BUTTON_WIDTH, 0, FILE_BUTTON_WIDTH, FILE_BAR_HEIGHT), "Open", Open, fileBar);

            gui.Add(openButton);

            Button saveButton = new Button(new Rectangle(2 * FILE_BUTTON_WIDTH, 0, FILE_BUTTON_WIDTH, FILE_BAR_HEIGHT), "Save", Save, fileBar);

            gui.Add(saveButton);

            //bottom bar (block palette, anchors, properties)
            ScrollPanel palette = new ScrollPanel(new Rectangle(0, SCREEN_HEIGHT - EDIT_BAR_HEIGHT, PALETTE_WIDTH, EDIT_BAR_HEIGHT), "Blocks");

            gui.Add(palette);
            AddBlocks(palette);

            ScrollPanel anchors = new ScrollPanel(new Rectangle(PALETTE_WIDTH, SCREEN_HEIGHT - EDIT_BAR_HEIGHT, ANCHOR_WIDTH, EDIT_BAR_HEIGHT), "Anchors");

            gui.Add(anchors);
            //TODO: add stuff to anchors

            ContainerPanel propertiesPanel = new ContainerPanel(new Rectangle(PALETTE_WIDTH + ANCHOR_WIDTH, SCREEN_HEIGHT - EDIT_BAR_HEIGHT, PROPERTIES_WIDTH, EDIT_BAR_HEIGHT), "Properties");

            gui.Add(propertiesPanel);
            //TODO: add stuff to properties
            nameTextBox = new TextBox(new Rectangle(PALETTE_WIDTH + ANCHOR_WIDTH, SCREEN_HEIGHT - EDIT_BAR_HEIGHT, PROPERTIES_WIDTH, TEXT_BOX_HEIGHT), propertiesPanel);
            //freqTextBox
            //minPerChunkTextBox
            //maxPerChunkTextBox

            //TODO: draw current layer button (foreground/background)
        }
Ejemplo n.º 7
0
 protected void MassValidator_ServerValidate(object source, ServerValidateEventArgs args)
 {
     foreach (string textBoxId in sTextBoxes.Keys)
     {
         if ((ContainerPanel.FindControl(textBoxId) as TextBox).Text.Length != 0)
         {
             args.IsValid = true;
             return;
         }
     }
     args.IsValid = false;
 }
Ejemplo n.º 8
0
    protected void Unified_TextChanged(object sender, EventArgs e)
    {
        TextBox textBoxSender = sender as TextBox;
        TextBox configurableTextBox;


        foreach (string textBoxId in sTextBoxes.Keys)
        {
            configurableTextBox = ContainerPanel.FindControl(textBoxId) as TextBox;
            if (configurableTextBox != textBoxSender)
            {
                configurableTextBox.Text = String.Format("{0:0.##############}", (double.Parse(textBoxSender.Text, CultureInfo.InvariantCulture) * sTextBoxes[textBoxSender.ID][configurableTextBox.ID]));
            }
        }
    }
Ejemplo n.º 9
0
 public void setContainerPanelOriginalSize()
 {
     if (ContainerPanel.GetType() == typeof(SplitterPanel))
     {
         SplitContainer parent = (SplitContainer)ContainerPanel.Parent;
         if (parent.Panel1 == ContainerPanel)
         {
             ContainerPanelOriginalSize = new Size(parent.SplitterDistance, parent.SplitterDistance);
         }
         else
         {
             ContainerPanelOriginalSize = new Size(parent.Width - parent.SplitterDistance, parent.Height - parent.SplitterDistance);
         }
     }
     else
     {
         ContainerPanelOriginalSize = ContainerPanel.Size;
     }
 }
        protected override void Render(HtmlTextWriter writer)
        {
            writer.WriteLine("<div class='multiselect-dropdown{0}'>".FormatWith(CssClass.WithPrefix(" ")));

            ContainerPanel.RenderBeginTag(writer);

            ToolBox.RenderControl(writer);

            writer.WriteLine("<div class='items-list' >");
            base.Render(writer);
            writer.WriteLine("</div>");

            SelectedItemsPanel.RenderControl(writer);
            ContainerPanel.RenderEndTag(writer);

            SearchBox.RenderControl(writer);
            ViewBox.RenderControl(writer);

            writer.WriteLine("</div>");
        }
Ejemplo n.º 11
0
 private void ContainerPanel_Scroll(object sender, ScrollEventArgs e)
 {
     ContainerPanel.Refresh();
     ContainerPanel.Invalidate();
 }
Ejemplo n.º 12
0
        //################################################################################
        #region Private Members

        #region Timer Panel Initialization

        private void InitializeComponent()
        {
            ContainerPanel.SuspendLayout();
            SuspendLayout();

            #region Container Panel

            ContainerPanel.Margin        = new Padding(0);
            ContainerPanel.Padding       = new Padding(0);
            ContainerPanel.Location      = new Point(0, 0);
            ContainerPanel.FlowDirection = FlowDirection.LeftToRight;

            #endregion

            #region Timer TextBox

            FunctionText.Name        = $"TimerText";
            FunctionText.Text        = Formatter.FormatMode($"{TimerMode.Stopped}");
            FunctionText.AutoSize    = true;
            FunctionText.BorderStyle = BorderStyle.None;
            FunctionText.Padding     = new Padding(Style.PanelPadding);
            FunctionText.Margin      = new Padding(0, 0, Style.PanelSpacing, 0);
            FunctionText.Font        = new Font(new FontFamily(Style.FontName), Style.PanelFontSize, FontStyle.Bold);
            Painter <Black> .Paint(FunctionText, PaintMode.Normal);

            FunctionText.DoubleClick += FunctionText_DoubleClick;

            var hourTextGuideLabel = new Label
            {
                AutoSize = true,
                Text     = new string(' ', 12),
                Margin   = new Padding(0),
                Padding  = new Padding(Style.PanelPadding),
                Font     = new Font(new FontFamily(Style.FontName), Style.PanelFontSize, FontStyle.Bold)
            };

            TimerText.Text        = c_InitialTime;
            TimerText.ReadOnly    = true;
            TimerText.AutoSize    = false;
            TimerText.TabStop     = false;
            TimerText.Margin      = new Padding(0);
            TimerText.BorderStyle = BorderStyle.None;
            TimerText.Size        = hourTextGuideLabel.PreferredSize;
            TimerText.TextAlign   = HorizontalAlignment.Center;
            TimerText.Font        = new Font(new FontFamily(Style.FontName), Style.PanelFontSize + 2, FontStyle.Bold);
            Painter <Blue> .Paint(TimerText, PaintMode.Normal);

            TimerText.DoubleClick += TimerText_DoubleClick;
            TimerText.KeyPress    += TimerText_KeyPress;
            TimerText.LostFocus   += TimerText_LostFocus;

            TimerContainer.Width         = FunctionText.PreferredWidth + Style.PanelSpacing + TimerText.Width;
            TimerContainer.Height        = FunctionText.PreferredHeight;
            TimerContainer.Padding       = new Padding(0);
            TimerContainer.Margin        = new Padding(0, 0, Style.PanelSpacing, 0);
            TimerContainer.BorderStyle   = BorderStyle.None;
            TimerContainer.FlowDirection = FlowDirection.LeftToRight;
            TimerContainer.Controls.Add(FunctionText);
            TimerContainer.Controls.Add(TimerText);

            #endregion

            #region Function Button

            void PauseAction(Control button)
            {
                button.Click += FunctionButton_Click;
            }

            void ManualStopAction(object sender, EventArgs args)
            {
                Log.Info("Stop has been triggered manually. WorkTimer will stop.");
                StopTimer();
            }

            FunctionButton = new ImageButton(PauseAction, Resources.Stop)
            {
                Margin      = new Padding(0),
                ContextMenu = new ContextMenu {
                    MenuItems = { new MenuItem("Stop", (s, a) => ManualStopAction(s, a)) }
                }
            };
            FunctionButton.SetToolTip("Pause/Resume timer");
            FunctionButton.SetBackgroundColor(Color.FromArgb(152, 0, 47));

            #endregion

            #region Timer Panel

            Name          = "TimerPanel";
            AutoSize      = true;
            Margin        = new Padding(0, 0, 0, Style.PanelSpacing);
            BackColor     = Color.FromArgb(100, 100, 100);
            BorderStyle   = BorderStyle.FixedSingle;
            AutoScaleMode = AutoScaleMode.Font;

            #endregion

            ContainerPanel.Controls.Add(TimerContainer);
            ContainerPanel.Controls.Add(FunctionButton);
            Controls.Add(ContainerPanel);

            ContainerPanel.ResumeLayout(false);
            ContainerPanel.PerformLayout();
            ResumeLayout(false);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 処理タイプをセットする
        /// </summary>
        private void SetProcessType()
        {
            try
            {
                if (ContainerPanel.Controls.Count > 0 && ContainerPanel.Controls[0] is ProcessBaseControl)
                {
                    ProcessBaseControl ctrl = (ProcessBaseControl)ContainerPanel.Controls[0];

                    if (ctrl.ValidRadio.Checked)
                    {
                        ProcessModel.ValidType = ValidType.効;
                    }
                    else
                    {
                        ProcessModel.ValidType = ValidType.無効;
                    }
                    ProcessModel.BeforeWaitMilliTime = (int)ctrl.BeforeWaitTimeUpDown.Value;
                    ProcessModel.AfterWaitMilliTime  = (int)ctrl.AfterWaitTimeUpDown.Value;
                    ProcessModel.NextProcess         = (ProcessModel)ctrl.CompButton.Tag;
                    ProcessModel.ErrorProcess        = (ProcessModel)ctrl.ErrorButton.Tag;
                }
                ContainerPanel.ClearControls();
                switch (_processType)
                {
                case ProcessType.検出:
                {
                    DetectRadio.Checked = true;

                    AddProcessControl(new DetectControl());
                }
                break;

                case ProcessType.キーボード入力:
                {
                    KeyboardInputRadio.Checked = true;
                    AddProcessControl(new KeyboardInputControl());
                }
                break;

                case ProcessType.マウス入力:
                {
                    MouseInputRadio.Checked = true;
                    AddProcessControl(new MouseControl());
                }
                break;

                case ProcessType.待機:
                {
                    WaitRadio.Checked = true;
                    AddProcessControl(new WaitControl());
                }
                break;

                case ProcessType.メール送信:
                {
                    MailSendRadio.Checked = true;
                    AddProcessControl(new MailSendControl());
                }
                break;

                case ProcessType.アプリ実行:
                {
                    AppStartRadio.Checked = true;
                    AddProcessControl(new AppControl());
                }
                break;

                case ProcessType.数:
                {
                    VariableRadio.Checked = true;
                    AddProcessControl(new VariableControl());
                }
                break;

                case ProcessType.ファイルフォルダー処理:
                {
                    FileFolderRadio.Checked = true;
                    AddProcessControl(new FileFolderControl());
                }
                break;

                case ProcessType.ダイアログ:
                {
                    DialogRadio.Checked = true;
                    AddProcessControl(new DialogControl());
                }
                break;

                case ProcessType.Excel:
                {
                    ExcelRadio.Checked = true;
                    AddProcessControl(new ExcelControl());
                }
                break;
                }
                OnProcessTypeChange?.Invoke(_processType);
            }
            catch (Exception ex)
            {
                throw Program.ThrowException(ex);
            }
        }
Ejemplo n.º 14
0
 public void ClosePostRoundMenu()
 {
     SetClass("fade-in", false);
     ContainerPanel.SetClass("pop-in", false);
 }
Ejemplo n.º 15
0
        //################################################################################
        #region Private Members

        private void InitializeComponent()
        {
            ContainerPanel.SuspendLayout();
            SuspendLayout();

            #region Container Panel

            ContainerPanel.Margin        = new Padding(0);
            ContainerPanel.Padding       = new Padding(0);
            ContainerPanel.Location      = new Point(0, 0);
            ContainerPanel.FlowDirection = FlowDirection.LeftToRight;

            #endregion

            #region Logo Button

            void HideAction(Control button)
            {
                button.DoubleClick += (sender, arg) =>
                {
                    ParentControl.Visible = false;
                };
            }

            LogoButton = new ImageButton(HideAction, Resources.Logo)
            {
                Margin = new Padding(0, 0, Style.PanelSpacing, 0)
            };
            LogoButton.SetToolTip("Handy Box App v2.4");
            LogoButton.SetBackgroundColor(Color.FromArgb(226, 87, 76));

            #endregion

            #region Title Label

            TitleLabel.Name = $"TitleLabel";
            TitleLabel.Text = $@"Handy Box App v2.4  ";
            //TitleLabel.Width = 190 - LogoButton.Width;
            TitleLabel.AutoSize  = true;
            TitleLabel.Margin    = new Padding(0, 0, Style.PanelSpacing, 0);
            TitleLabel.Padding   = new Padding(Style.PanelPadding);
            TitleLabel.TextAlign = ContentAlignment.MiddleLeft;
            TitleLabel.Font      = new Font(new FontFamily(Style.FontName), Style.PanelFontSize, FontStyle.Bold);
            Painter <Black> .Paint(TitleLabel, PaintMode.Dark);

            TitleLabel.MouseDown += DragAndDrop;

            #endregion

            #region Close Button

            void CloseAction(Control button)
            {
                button.Click += (sender, args) =>
                {
                    ((MainForm)ParentControl).Close();
                    CustomApplicationContext.Exit();
                };
            }

            CloseButton = new ImageButton(CloseAction, Resources.Close)
            {
                Margin = new Padding(0)
            };
            CloseButton.SetToolTip("Close");
            CloseButton.SetBackgroundColor(Color.FromArgb(201, 54, 54));

            #endregion

            #region Title Panel

            Name          = "TitlePanel";
            AutoSize      = true;
            Margin        = new Padding(0, 0, 0, Style.PanelSpacing);
            BackColor     = Color.FromArgb(100, 100, 100);
            BorderStyle   = BorderStyle.FixedSingle;
            AutoScaleMode = AutoScaleMode.Font;

            #endregion

            ContainerPanel.Controls.Add(LogoButton);
            ContainerPanel.Controls.Add(TitleLabel);
            ContainerPanel.Controls.Add(CloseButton);
            Controls.Add(ContainerPanel);

            ContainerPanel.ResumeLayout(false);
            ContainerPanel.PerformLayout();
            ResumeLayout(false);
        }
Ejemplo n.º 16
0
        public static void ParseChildren(CustomInputControl parent, List <Classes.CustomInput.CustomInputControl> controls, ControlCollection controlContainer)
        {
            Bitmap image_down = Properties.Resources.Custom_Button_Down;
            Bitmap image_up   = Properties.Resources.Custom_Button_Up;

            foreach (Classes.CustomInput.CustomInputControl controlDesc in controls)
            {
                HidButton imageButton = null;
                Control   control     = imageButton;

                switch (controlDesc.InputType)
                {
                case Classes.CustomInputType.Container:
                {
                    control = new ContainerPanel(parent, controlDesc);
                }
                break;

                case Classes.CustomInputType.KeyCombination:
                case Classes.CustomInputType.VirtualKey:
                case Classes.CustomInputType.ScanCode:
                {
                    control = imageButton = new KeyboardHidButton(parent, controlDesc);

                    if (!string.IsNullOrEmpty(controlDesc.Image))
                    {
                        imageButton.Image = GetBitmap(controlDesc.Image);
                    }
                    else
                    {
                        imageButton.Image = BuildCustomBitmap(image_up, controlDesc.InputDisplay, parent.Font, Color.Black);
                    }
                    if (!string.IsNullOrEmpty(controlDesc.DownImage))
                    {
                        imageButton.DownImage = GetBitmap(controlDesc.DownImage);
                    }
                    else
                    {
                        imageButton.DownImage = BuildCustomBitmap(image_down, controlDesc.InputDisplay, parent.Font, Color.White);
                    }
                    imageButton.SelectedImage         = imageButton.DownImage;
                    imageButton.TransparentBackground = controlDesc.TransparentBackground;
                    imageButton.BackColor             = parent.BackColor;
                    imageButton.CanHold = false;
                }
                break;

                case Classes.CustomInputType.ShiftKey:
                case Classes.CustomInputType.AltKey:
                case Classes.CustomInputType.WinKey:
                {
                }
                break;

                case Classes.CustomInputType.LeftMouseButton:
                {
                    imageButton = new MouseButtonHidButton(parent, controlDesc);
                }
                break;

                case Classes.CustomInputType.RightMouseButton:
                {
                    imageButton = new MouseButtonHidButton(parent, controlDesc);
                }
                break;

                case Classes.CustomInputType.MouseDPad:
                {
                    // add a control here to map dpad to mouse
                }
                break;

                case Classes.CustomInputType.Accelerometer:
                {
                    // add a control here to map accelerometer to mouse
                }
                break;

                case Classes.CustomInputType.TouchPad:
                case Classes.CustomInputType.TouchPadWithScroll:
                {
                    control = new TouchControl();
                    ((TouchControl)control).HidWriter = parent.HidWriter;
                }
                break;

                default:
                {
                    // why are we here?
                }
                break;
                }
                control.Width  = controlDesc.Width;
                control.Height = controlDesc.Height;
                control.Left   = controlDesc.Left;
                control.Top    = controlDesc.Top;
                control.Tag    = controlDesc;

                if (!(control is ContainerPanel))
                {
                    control.Anchor = controlDesc.Anchor;
                    control.Dock   = controlDesc.Dock;
                }

                controlContainer.Add(control);
            }
        }
Ejemplo n.º 17
0
        //################################################################################
        #region Private Members

        private void InitializeComponent()
        {
            ContainerPanel.SuspendLayout();
            SuspendLayout();

            #region Container Panel

            ContainerPanel.Margin        = new Padding(0);
            ContainerPanel.Padding       = new Padding(0);
            ContainerPanel.Location      = new Point(0, 0);
            ContainerPanel.FlowDirection = FlowDirection.LeftToRight;

            #endregion

            #region Name Label

            NameLabel.Name = "NameLabel";
            NameLabel.Text = Formatter.FormatString(StockService.GetStockInfo.Name, Pad.Right, 9);
            //NameLabel.Width = 90;
            NameLabel.AutoSize  = true;
            NameLabel.Margin    = new Padding(0, 0, Style.PanelSpacing, 0);
            NameLabel.Padding   = new Padding(Style.PanelPadding);
            NameLabel.TextAlign = ContentAlignment.MiddleLeft;
            NameLabel.Font      = new Font(new FontFamily(Style.FontName), Style.PanelFontSize, FontStyle.Bold);
            Painter <Black> .Paint(NameLabel, PaintMode.Normal);

            #endregion

            #region Value Label

            ValueLabel.Name = "ValueLabel";
            ValueLabel.Text = Formatter.FormatString("#,#### TL", Pad.Left, 12);
            //ValueLabel.Width = 100;
            ValueLabel.AutoSize  = true;
            ValueLabel.Margin    = new Padding(0, 0, Style.PanelSpacing, 0);
            ValueLabel.Padding   = new Padding(Style.PanelPadding);
            ValueLabel.TextAlign = ContentAlignment.MiddleRight;
            ValueLabel.Font      = new Font(new FontFamily(Style.FontName), Style.PanelFontSize, FontStyle.Bold);
            Painter <Green> .Paint(ValueLabel, PaintMode.Light);

            #endregion

            #region Function Button

            void SlideAction(Control button)
            {
                button.Click += (sender, args) =>
                {
                };
            }

            FunctionButton = new ImageButton(SlideAction, Resources.Options)
            {
                Margin = new Padding(0)
            };
            FunctionButton.SetToolTip("Open panel");
            FunctionButton.SetBackgroundColor(Color.FromArgb(38, 124, 181));

            #endregion

            #region Stock Panel

            Name          = $"StockPanel_{StockService.GetStockInfo.Tag}";
            AutoSize      = true;
            Margin        = new Padding(0, 0, 0, Style.PanelSpacing);
            BackColor     = Color.FromArgb(100, 100, 100);
            BorderStyle   = BorderStyle.FixedSingle;
            AutoScaleMode = AutoScaleMode.Font;

            #endregion

            ContainerPanel.Controls.Add(NameLabel);
            ContainerPanel.Controls.Add(ValueLabel);
            ContainerPanel.Controls.Add(FunctionButton);
            Controls.Add(ContainerPanel);

            ContainerPanel.ResumeLayout(false);
            ContainerPanel.PerformLayout();
            ResumeLayout(false);
        }
Ejemplo n.º 18
0
        public void toggle()
        {
            if (ContainerPanel != null)
            {
                if (ContainerPanelOriginalSize.Width == 0 || ContainerPanelOriginalSize.Height == 0)
                {
                    setContainerPanelOriginalSize();
                }

                if (ContainerPanel.GetType() == typeof(SplitterPanel))
                {
                    SplitContainer parent = (SplitContainer)ContainerPanel.Parent;
                    if (parent.Panel1 == ContainerPanel)
                    {
                        if (ArrowOrientation == Orientation.Horizontal)
                        {
                            if (isPanelOpen)
                            {
                                parent.SplitterDistance = this.Width;
                            }
                            else
                            {
                                parent.SplitterDistance = ContainerPanelOriginalSize.Width;
                            }
                        }
                        else
                        {
                            if (isPanelOpen)
                            {
                                parent.SplitterDistance = this.Height;
                            }
                            else
                            {
                                parent.SplitterDistance = ContainerPanelOriginalSize.Height;
                            }
                        }
                    }
                    else
                    {
                        if (ArrowOrientation == Orientation.Horizontal)
                        {
                            if (isPanelOpen)
                            {
                                parent.SplitterDistance = parent.Width - this.Width;
                            }
                            else
                            {
                                int splitterDistance = parent.Width - ContainerPanelOriginalSize.Width;
                                if (splitterDistance < 0)
                                {
                                    splitterDistance = MinimumSplitterDistance;
                                }
                                parent.SplitterDistance = splitterDistance;
                            }
                        }
                        else
                        {
                            if (isPanelOpen)
                            {
                                parent.SplitterDistance = parent.Height - this.Height;
                            }
                            else
                            {
                                int splitterDistance = parent.Height - ContainerPanelOriginalSize.Height;
                                if (splitterDistance < 0)
                                {
                                    splitterDistance = MinimumSplitterDistance;
                                }
                                parent.SplitterDistance = splitterDistance;
                            }
                        }
                    }
                }
                else
                {
                    if (ArrowOrientation == Orientation.Horizontal)
                    {
                        if (isPanelOpen)
                        {
                            ContainerPanel.Width = this.Width;
                        }
                        else
                        {
                            ContainerPanel.Width = ContainerPanelOriginalSize.Width;
                        }
                    }
                    else
                    {
                        if (isPanelOpen)
                        {
                            ContainerPanel.Height = this.Height;
                        }
                        else
                        {
                            ContainerPanel.Height = ContainerPanelOriginalSize.Height;
                        }
                    }
                }
            }
            else if (TogglePanel.GetType() == typeof(SplitterPanel))
            {
                SplitContainer parent = (SplitContainer)TogglePanel.Parent;
                if (parent.Panel1 == TogglePanel)
                {
                    parent.Panel1Collapsed = !parent.Panel1Collapsed;
                    setNewLocationBasedOnOrientation(parent.Panel1);
                }
                else
                {
                    parent.Panel2Collapsed = !parent.Panel2Collapsed;
                    setNewLocationBasedOnOrientation(parent.Panel2);
                }
            }
            else
            {
                TogglePanel.Visible = !TogglePanel.Visible;
                setNewLocationBasedOnOrientation(TogglePanel);
            }

            isPanelOpen = !isPanelOpen;

            //set arrow image
            if (pictureBox.BackgroundImage == _ArrowLeft)
            {
                setDirection(ArrowDirection.Right);
            }
            else if (pictureBox.BackgroundImage == _ArrowRight)
            {
                setDirection(ArrowDirection.Left);
            }
            else if (pictureBox.BackgroundImage == _ArrowUp)
            {
                setDirection(ArrowDirection.Down);
            }
            else
            {
                setDirection(ArrowDirection.Up);
            }
        }
Ejemplo n.º 19
0
        public static void ParseChildren(CustomInputControl parent, List<Classes.CustomInput.CustomInputControl> controls, ControlCollection controlContainer)
        {
            Bitmap image_down = Properties.Resources.Custom_Button_Down;
            Bitmap image_up = Properties.Resources.Custom_Button_Up;

            foreach (Classes.CustomInput.CustomInputControl controlDesc in controls)
            {
                HidButton imageButton = null;
                Control control = imageButton;

                switch (controlDesc.InputType)
                {
                    case Classes.CustomInputType.Container:
                        {
                            control = new ContainerPanel(parent, controlDesc);
                        }
                        break;
                    case Classes.CustomInputType.KeyCombination:
                    case Classes.CustomInputType.VirtualKey:
                    case Classes.CustomInputType.ScanCode:
                        {
                            control = imageButton = new KeyboardHidButton(parent, controlDesc);

                            if (!string.IsNullOrEmpty(controlDesc.Image))
                            {
                                imageButton.Image = GetBitmap(controlDesc.Image);
                            }
                            else
                            {
                                imageButton.Image = BuildCustomBitmap(image_up, controlDesc.InputDisplay, parent.Font, Color.Black);
                            }
                            if (!string.IsNullOrEmpty(controlDesc.DownImage))
                            {
                                imageButton.DownImage = GetBitmap(controlDesc.DownImage);
                            }
                            else
                            {
                                imageButton.DownImage = BuildCustomBitmap(image_down, controlDesc.InputDisplay, parent.Font, Color.White);
                            }
                            imageButton.SelectedImage = imageButton.DownImage;
                            imageButton.TransparentBackground = controlDesc.TransparentBackground;
                            imageButton.BackColor = parent.BackColor;
                            imageButton.CanHold = false;
                        }
                        break;
                    case Classes.CustomInputType.ShiftKey:
                    case Classes.CustomInputType.AltKey:
                    case Classes.CustomInputType.WinKey:
                        {
                        }
                        break;
                    case Classes.CustomInputType.LeftMouseButton:
                        {
                            imageButton = new MouseButtonHidButton(parent, controlDesc);
                        }
                        break;
                    case Classes.CustomInputType.RightMouseButton:
                        {
                            imageButton = new MouseButtonHidButton(parent, controlDesc);
                        }
                        break;
                    case Classes.CustomInputType.MouseDPad:
                        {
                            // add a control here to map dpad to mouse
                        }
                        break;
                    case Classes.CustomInputType.Accelerometer:
                        {
                            // add a control here to map accelerometer to mouse
                        }
                        break;
                    case Classes.CustomInputType.TouchPad:
                    case Classes.CustomInputType.TouchPadWithScroll:
                        {
                            control = new TouchControl();
                            ((TouchControl)control).HidWriter = parent.HidWriter;
                        }
                        break;
                    default:
                        {
                            // why are we here?
                        }
                        break;
                }
                control.Width = controlDesc.Width;
                control.Height = controlDesc.Height;
                control.Left = controlDesc.Left;
                control.Top = controlDesc.Top;
                control.Tag = controlDesc;

                if (!(control is ContainerPanel))
                {
                    control.Anchor = controlDesc.Anchor;
                    control.Dock = controlDesc.Dock;
                }

                controlContainer.Add(control);
            }
        }