コード例 #1
0
        public HtmlEditorSidebarTitle()
        {
            // enable double buffered painting.
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            Height = 30;

            buttonChevron                = new BitmapButton(this.components);
            buttonChevron.ButtonStyle    = ButtonStyle.Bitmap;
            buttonChevron.ButtonText     = Res.Get(StringId.HideSidebar);
            buttonChevron.ToolTip        = Res.Get(StringId.HideSidebar);
            buttonChevron.Click         += new EventHandler(ClickHandler);
            buttonChevron.AccessibleName = Res.Get(StringId.HideSidebar);
            buttonChevron.TabStop        = true;
            buttonChevron.TabIndex       = 0;
            buttonChevron.RightToLeft    = (BidiHelper.IsRightToLeft ? RightToLeft.No : RightToLeft.Yes);
            buttonChevron.AllowMirroring = true;
            Controls.Add(buttonChevron);

            Click += new EventHandler(ClickHandler);

            //create the UI theme
            _uiTheme = new SidebarTitleUITheme(this);

            buttonChevron.Bounds =
                RectangleHelper.Center(_uiTheme.bmpChevronRight.Size, new Rectangle(0, 0, 20, ClientSize.Height), false);
        }
コード例 #2
0
ファイル: ComPanel.cs プロジェクト: ozsuakin/fivevolt
        private Panel CreateControlPanel()
        {
            Panel    panel = new Panel(this);
            BoxSizer sizer = new BoxSizer(Orientation.Horizontal);

            _port = new ComboBox(panel, "", WxDefaultPosition, WxDefaultSize, new string[0],
                                 WindowStyles.ComboBoxDropDown | WindowStyles.ComboBoxReadonly);
            UpdatePorts();
            sizer.Add(_port, 0, SizerFlag.Expand | SizerFlag.All, 5);

            Bitmap refreshBitmap = GetType().Assembly.GetManifestResourceWxBitmap("DummyLoadController.Images.refresh.png");

            _refreshPorts = new BitmapButton(panel, ID_RefreshPorts, refreshBitmap);
            EvtButton(ID_RefreshPorts, (s, e) => UpdatePorts());
            sizer.Add(_refreshPorts, 0, SizerFlag.Expand | SizerFlag.All, 0);

            string[] baudRates = new[] { "300", "600", "1200", "2400", "4800", "9600", "14,400", "19,200", "28,800", "38,400", "57,600", "76,800", "115,200", "230,400" };
            _baudRate = new ComboBox(panel, "", WxDefaultPosition, WxDefaultSize, baudRates, WindowStyles.ComboBoxDropDown | WindowStyles.ComboBoxReadonly);
            _baudRate.Select(5);
            sizer.Add(_baudRate, 0, SizerFlag.Expand | SizerFlag.All, 5);

            _connect = new Button(panel, ID_Connect, "Connect");
            EvtButton(ID_Connect, (s, e) => Connect());
            sizer.Add(_connect, 0, SizerFlag.Expand | SizerFlag.All, 5);

            _disconnect = new Button(panel, ID_Disconnect, "Disconnect");
            EvtButton(ID_Disconnect, (s, e) => _comService.Disconnect());
            sizer.Add(_disconnect, 0, SizerFlag.Expand | SizerFlag.All, 5);

            panel.SetSizer(sizer);
            sizer.SetSizeHints(panel);

            return(panel);
        }
コード例 #3
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.txtQuery     = new OpenLiveWriter.ApplicationFramework.SearchBoxControl.TextBoxWithEnter();
     this.picSearchBox = new OpenLiveWriter.Controls.BitmapButton();
     this.SuspendLayout();
     //
     // txtQuery
     //
     this.txtQuery.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                  | System.Windows.Forms.AnchorStyles.Right)));
     this.txtQuery.BorderStyle = System.Windows.Forms.BorderStyle.None;
     this.txtQuery.Location    = new System.Drawing.Point(5, 5);
     this.txtQuery.Name        = "txtQuery";
     this.txtQuery.Size        = new System.Drawing.Size(113, 14);
     this.txtQuery.TabIndex    = 0;
     this.txtQuery.Text        = "";
     //
     // picSearchBox
     //
     this.picSearchBox.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.picSearchBox.Location = new System.Drawing.Point(126, 1);
     this.picSearchBox.Name     = "picSearchBox";
     this.picSearchBox.Size     = new System.Drawing.Size(23, 20);
     this.picSearchBox.TabIndex = 0;
     this.picSearchBox.TabStop  = false;
     //
     // SearchBoxControl
     //
     this.BackColor = System.Drawing.SystemColors.Window;
     this.Controls.Add(this.picSearchBox);
     this.Controls.Add(this.txtQuery);
     this.Name = "SearchBoxControl";
     this.Size = new System.Drawing.Size(150, 22);
     this.ResumeLayout(false);
 }
コード例 #4
0
        private static void InitNavigationElements()
        {
            var closeImageTexture        = new Texture(ImageToByte(Properties.Resources.close_image));
            var closeImageFocusedTexture = new Texture(ImageToByte(Properties.Resources.close_image_focused));

            var closeButton = new BitmapButton()
            {
                Image    = closeImageTexture,
                Size     = new Vector2f(50, 50),
                Position = new Vector2f(window.Size.X - 50, 0)
            };

            closeButton.Clicked += (s, e) =>
            {
                window.Close();
            };
            closeButton.MouseEntered += (s, e) =>
            {
                closeButton.Image = closeImageFocusedTexture;
            };
            closeButton.MouseLeft += (s, e) =>
            {
                closeButton.Image = closeImageTexture;
            };

            gui.Add(closeButton);
        }
コード例 #5
0
        public ImageEditingPropertyTitlebar()
        {
            // enable double buffered painting.
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            // set height based on system metrics
            Height = SystemInformation.ToolWindowCaptionHeight;

            // initialize down button
            closeButton = new BitmapButton();
            closeButton.BitmapDisabled = closeButtonDisabled;
            closeButton.BitmapEnabled  = closeButtonEnabled;
            closeButton.BitmapPushed   = closeButtonPushed;
            closeButton.BitmapSelected = closeButtonSelected;
            closeButton.ButtonStyle    = ButtonStyle.Bitmap;
            closeButton.ToolTip        = "Hide Image Properties";
            closeButton.Width          = closeButtonEnabled.Width;
            closeButton.Height         = closeButtonEnabled.Height;
            closeButton.Top            = TOP_INSET - 1;
            closeButton.Left           = Width - closeButton.Width - TOP_INSET;
            closeButton.Anchor         = AnchorStyles.Top | AnchorStyles.Right;
            closeButton.Click         += new EventHandler(closeButton_Click);
            Controls.Add(closeButton);

            // manage appearance
            ApplicationStyleManager.ApplicationStyleChanged += new EventHandler(ApplicationManager_ApplicationStyleChanged);
            UpdateAppearance();
        }
コード例 #6
0
        private void InitializeComponent()
        {
            SuspendLayout();

            btnDetail = new BitmapButton {
                Text = "Connect", Left = 10, Top = 10, Width = 100, Height = 60, Font = Config.GeneralFontBig
            };
            btnDetail.Click += (sender, args) => TryToConnectTasClient();
            Controls.Add(btnDetail);

            lbState = new Label
            {
                AutoSize  = true,
                Location  = new Point(120, 30),
                Name      = "lbState",
                ForeColor = Config.TextColor,
                BackColor = Color.Transparent,
                Text      = "Connect to the Spring multiplayer lobby server."
            };

            Controls.Add(lbState);
            AutoSize     = true;
            AutoSizeMode = AutoSizeMode.GrowAndShrink;
            Size         = new Size(300, 80);

            ResumeLayout(false);
        }
コード例 #7
0
        public SidebarGutter()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            buttonChevron = new BitmapButton(this.components);
            ColorizedResources.Instance.ColorizationChanged += new EventHandler(ColorizationChanged);
            buttonChevron.BackColor      = ColorizedResources.Instance.SidebarHeaderBackgroundColor;
            buttonChevron.BitmapEnabled  = bitmapChevronLeft;
            buttonChevron.BitmapSelected = bitmapChevronLeftHover;
            buttonChevron.BitmapPushed   = bitmapChevronLeftHover;
            buttonChevron.Bounds         =
                RectangleHelper.Center(new Size(10, 9), new Rectangle(0, 0, ClientSize.Width, BLOCK_HEIGHT), false);
            buttonChevron.ButtonStyle    = ButtonStyle.Bitmap;
            buttonChevron.ButtonText     = Res.Get(StringId.ShowSidebar);
            buttonChevron.ToolTip        = Res.Get(StringId.ShowSidebar);
            buttonChevron.Click         += new EventHandler(buttonChevron_Click);
            buttonChevron.AccessibleName = Res.Get(StringId.ShowSidebar);
            buttonChevron.TabStop        = true;
            buttonChevron.TabIndex       = 0;
            buttonChevron.RightToLeft    = (BidiHelper.IsRightToLeft ? RightToLeft.No : RightToLeft.Yes);
            buttonChevron.AllowMirroring = true;
            Controls.Add(buttonChevron);
            AccessibleRole = AccessibleRole.PushButton;
        }
コード例 #8
0
        /* NOTE: When being shown in the context of the browser (or any non .NET
         * application) this form will not handle any dialog level keyboard
         * commands (tab, enter, escape, alt-mnemonics, etc.). This is because
         * it is a modeless form that does not have its own thread/message-loop.
         * Because the form was created by our .NET code the main IE frame that
         * has the message loop has no idea it needs to route keyboard events'
         * to us. There are several possible workarounds:
         *
         *    (1) Create and show this form on its own thread with its own
         *        message loop. In this case all calls from the form back
         *        to the main UI thread would need to be marshalled.
         *
         *    (2) Manually process keyboard events in the low-level
         *        ProcessKeyPreview override (see commented out method below)
         *
         *    (3) Change the implementation of the mini-form to be a modal
         *        dialog. The only problem here is we would need to capture
         *        mouse input so that clicks outside of the modal dialog onto
         *        the IE window result in the window being dismissed. We were
         *        not able to get this to work (couldn't capture the mouse)
         *        in experimenting with this implementation.
         *
         * Our judgement was to leave it as-is for now as it is unlikely that
         * keyboard input into a mini-form will be a big deal (the only way
         * to access the mini-form is with a mouse gesture on the toolbar so
         * the user is still in "mouse-mode" when the form pops up.
         *
         */

        public CommandContextMenuMiniForm(IWin32Window parentFrame, Command command)
        {
            // save a reference to the parent frame
            _parentFrame = parentFrame;

            // save a reference to the command and context menu control handler
            _command = command;
            _contextMenuControlHandler = command.CommandBarButtonContextMenuControlHandler;

            // set to top most form (allows us to appear on top of our
            // owner if the owner is also top-most)
            TopMost = true;

            // other window options/configuration
            ShowInTaskbar   = false;
            FormBorderStyle = FormBorderStyle.None;
            StartPosition   = FormStartPosition.Manual;

            // Paint performance optimizations
            User32.SetWindowLong(Handle, GWL.STYLE, User32.GetWindowLong(Handle, GWL.STYLE) & ~WS.CLIPCHILDREN);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            // create and initialize the context menu control
            Control commandContextMenuControl = _contextMenuControlHandler.CreateControl();

            commandContextMenuControl.TabIndex  = 0;
            commandContextMenuControl.BackColor = BACKGROUND_COLOR;
            commandContextMenuControl.Font      = ApplicationManager.ApplicationStyle.NormalApplicationFont;
            commandContextMenuControl.Left      = HORIZONTAL_INSET;
            commandContextMenuControl.Top       = HEADER_INSET + HEADER_HEIGHT + HEADER_INSET + HEADER_INSET;
            Controls.Add(commandContextMenuControl);

            // create action button (don't add it yet)
            _actionButton                = new BitmapButton();
            _actionButton.TabIndex       = 1;
            _actionButton.Click         += new EventHandler(_actionButton_Click);
            _actionButton.BackColor      = BACKGROUND_COLOR;
            _actionButton.Font           = ApplicationManager.ApplicationStyle.NormalApplicationFont;
            _actionButton.BitmapDisabled = _command.CommandBarButtonBitmapDisabled;
            _actionButton.BitmapEnabled  = _command.CommandBarButtonBitmapEnabled;
            _actionButton.BitmapPushed   = _command.CommandBarButtonBitmapPushed;
            _actionButton.BitmapSelected = _command.CommandBarButtonBitmapSelected;
            _actionButton.ButtonText     = _contextMenuControlHandler.ButtonText;
            _actionButton.ToolTip        = _contextMenuControlHandler.ButtonText;
            _actionButton.AutoSizeWidth  = true;
            _actionButton.AutoSizeHeight = true;
            _actionButton.Size           = new Size(0, 0); // dummy call to force auto-size

            // size the form based on the size of the context menu control and button
            Width  = HORIZONTAL_INSET + commandContextMenuControl.Width + HORIZONTAL_INSET;
            Height = commandContextMenuControl.Bottom + (BUTTON_VERTICAL_PAD * 3) + miniFormBevelBitmap.Height + _actionButton.Height;

            // position the action button and add it to the form
            _actionButton.Top  = Height - BUTTON_VERTICAL_PAD - _actionButton.Height;
            _actionButton.Left = HORIZONTAL_INSET - 4;
            Controls.Add(_actionButton);
        }
コード例 #9
0
 /// <summary>
 /// Control_GotFocus event handler.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">An EventArgs that contains the event data.</param>
 private void Control_GotFocus(object sender, EventArgs e)
 {
     //	Drive focus to the correct BitmapButton.
     if (selectedIndex != -1)
     {
         BitmapButton bitmapButton = (BitmapButton)bitmapButtonList[selectedIndex];
         bitmapButton.Focus();
     }
 }
コード例 #10
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.btnMinimize = new BitmapButton();
     this.btnMaximize = new BitmapButton();
     this.btnClose    = new BitmapButton();
     this.SuspendLayout();
     //
     // btnMinimize
     //
     this.btnMinimize.BackColor      = Color.Transparent;
     this.btnMinimize.Location       = new System.Drawing.Point(0, 0);
     this.btnMinimize.Size           = new Size(25, 17);
     this.btnMinimize.Text           = "Minimize";
     this.btnMinimize.ButtonStyle    = ButtonStyle.Bitmap;
     this.btnMinimize.Name           = "btnMinimize";
     this.btnMinimize.BitmapSelected = ResourceHelper.LoadAssemblyResourceBitmap("Images.HIG.MinimizeHover.png");
     this.btnMinimize.BitmapPushed   = ResourceHelper.LoadAssemblyResourceBitmap("Images.HIG.MinimizePushed.png");
     this.btnMinimize.TabIndex       = 2;
     this.btnMinimize.Click         += new EventHandler(btnMinimize_Click);
     //
     // btnMaximize
     //
     this.btnMaximize.BackColor      = Color.Transparent;
     this.btnMaximize.Location       = new System.Drawing.Point(25, 0);
     this.btnMaximize.Size           = new Size(26, 17);
     this.btnMaximize.Text           = "Maximize";
     this.btnMaximize.ButtonStyle    = ButtonStyle.Bitmap;
     this.btnMaximize.Name           = "btnMaximize";
     this.btnMaximize.BitmapSelected = ResourceHelper.LoadAssemblyResourceBitmap("Images.HIG.MaximizeHover.png");
     this.btnMaximize.BitmapPushed   = ResourceHelper.LoadAssemblyResourceBitmap("Images.HIG.MaximizePushed.png");
     this.btnMaximize.TabIndex       = 3;
     this.btnMaximize.Click         += new EventHandler(btnMaximize_Click);
     //
     // btnClose
     //
     this.btnClose.BackColor      = Color.Transparent;
     this.btnClose.Location       = new System.Drawing.Point(51, 0);
     this.btnClose.Size           = new Size(42, 17);
     this.btnClose.Text           = "Close";
     this.btnClose.ButtonStyle    = ButtonStyle.Bitmap;
     this.btnClose.Name           = "btnClose";
     this.btnClose.BitmapSelected = ResourceHelper.LoadAssemblyResourceBitmap("Images.HIG.CloseHover.png");
     this.btnClose.BitmapPushed   = ResourceHelper.LoadAssemblyResourceBitmap("Images.HIG.ClosePushed.png");
     this.btnClose.TabIndex       = 4;
     this.btnClose.Click         += new EventHandler(btnClose_Click);
     //
     // MinMaxClose
     //
     this.BackColor = Color.Transparent;
     this.Controls.Add(this.btnClose);
     this.Controls.Add(this.btnMaximize);
     this.Controls.Add(this.btnMinimize);
     this.Name = "MinMaxClose";
     this.Size = new System.Drawing.Size(93, 17);
     this.ResumeLayout(false);
 }
コード例 #11
0
        public BattleListTab() {
            SuspendLayout();
            Size = new Size(731, 463);

            panel1 = new Panel { BackColor = Color.Transparent, Dock = DockStyle.Top, Location = new Point(0, 0), Size = new Size(731, 50) };
            searchLabel = new Label { AutoSize = true, Location = new Point(203, 17), Size = new Size(59, 18), Text = "Search:", ForeColor = Config.TextColor, Font = Config.GeneralFont};
            searchBox = new ZklTextBox { BackColor = Color.FromArgb(0, 30, 40), Location = new Point(268, 14), Size = new Size(178, 24), TabIndex = 1 };


            var btnMm = new BitmapButton()
            {
                Text = "Start MatchMaker",
                Width = 150,
                Height = 50,
                Image = Buttons.mp.GetResizedWithCache(32, 32),
                TextImageRelation = TextImageRelation.ImageBeforeText
            };
            btnMm.Click += (s, e) =>
            {
                var mm = new StartMatchMakerDialog();
                mm.StartPosition = FormStartPosition.CenterScreen;
                mm.Show(Program.MainWindow);
            };
            
            panel1.Controls.Add(btnMm);

            panel1.Controls.Add(searchLabel);
            panel1.Controls.Add(searchBox);

            battlePanel = new Panel
            {
                Location = new Point(0, 50),
                Size = new Size(731, 432),
                Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right
            };

            // battle list
            battleListControl = new BattleListControl { Dock = DockStyle.Fill };
            battlePanel.Controls.Add(battleListControl);

            Controls.Add(panel1);
            Controls.Add(battlePanel);

            Program.ToolTip.SetText(searchBox, "Search game, map or player");
            Program.ToolTip.SetText(searchBox.TextBox, "Search game, map or player");
            Program.ToolTip.SetText(searchLabel, "Search game, map or player");

            searchBox.TextChanged += searchBox_TextChanged;

            ResumeLayout();
        }
コード例 #12
0
ファイル: WndConsole.cs プロジェクト: zdimension/phytestcs
        public WndConsole() : base(L["Console"], 400, useLayout: true)
        {
            var cb = new ChatBox()
            {
                SizeLayout = new Layout2d("parent.iw", "parent.ih")
            };

            cb.SizeLayout = new Layout2d("parent.iw - 2 * x", "400");
            cb.Position   = new Vector2f(4, 2);
            Add(cb, "cb");
            var w = new Group();

            Field = new EditBox();
            Field.Renderer.Font = Ui.FontMono;
            cb.Renderer.Font    = Ui.FontMono;
            var btn = new BitmapButton()
            {
                Image = new Texture("icons/small/accept.png")
            };

            w.Add(Field, "txt");
            w.Add(btn, "btn");
            btn.Size           = new Vector2f(22, 22);
            w.SizeLayout       = new Layout2d("parent.iw", "btn.h");
            Field.SizeLayout   = new Layout2d("btn.left - 5", "btn.h");
            btn.PositionLayout = new Layout2d("parent.iw - w - 10", "0");
            w.PositionLayout   = new Layout2d("5", "cb.bottom + 5");
            Add(w, "cont");

            var commandHistory = new List <string>();
            var historyPos     = 0;

            var numAutocompleteLines = 0;

            ScriptState <object?> state = null !;

            void ProcessCommand()
            {
                Task.Run(async() =>
                {
                    RemoveAutocompleteLines();

                    var code   = Field.Text;
                    Field.Text = "";

                    cb.AddLine("> " + code);
                    var ncode = code;
                    if (ncode.EndsWith('#'))
                    {
                        ncode = $"Doc(()=>({ncode[..^1]}))";
                    }
コード例 #13
0
        /// <summary>
        /// bitmapButton_Click event handler.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An EventArgs that contains the event data.</param>
        private void bitmapButton_Click(object sender, EventArgs e)
        {
            //	Get the sending BitmapButton.
            BitmapButton bitmapButton = sender as BitmapButton;

            Debug.Assert(bitmapButton != null, "What??");
            if (bitmapButton == null)
            {
                return;
            }

            //	Set the SelectedIndex.
            SelectedIndex = (int)bitmapButton.Tag;
        }
コード例 #14
0
        /// <summary>
        /// Sets a SideBarControl entry.
        /// </summary>
        /// <param name="index">Index of the entry to set; zero based.</param>
        /// <param name="bitmap">Bitmap of the entry to set.</param>
        /// <param name="text">Text of the entry to set.</param>
        public void SetEntry(int index, Bitmap bitmap, string text, string name)
        {
            //	Instantiate and initialize the BitmapButton.
            BitmapButton bitmapButton = new BitmapButton();

            bitmapButton.Tag            = index;
            bitmapButton.Click         += new EventHandler(bitmapButton_Click);
            bitmapButton.AutoSizeHeight = false;
            bitmapButton.AutoSizeWidth  = false;
            bitmapButton.ButtonStyle    = ButtonStyle.Flat;
            bitmapButton.TextAlignment  = TextAlignment.Right;
            bitmapButton.ButtonText     = text;
            bitmapButton.BitmapEnabled  = bitmap;
            bitmapButton.BitmapSelected = bitmap;
            bitmapButton.ClickSetsFocus = true;
            bitmapButton.Size           = new Size(Control.Width - (PAD * 2), 52);
            bitmapButton.TabStop        = false;
            bitmapButton.AccessibleName = text;
            bitmapButton.Name           = name;
            Control.Controls.Add(bitmapButton);

            //	Replace and existing BitmapButton.
            if (index < bitmapButtonList.Count)
            {
                //	Remove the existing BitmapButton.
                if (bitmapButtonList[index] != null)
                {
                    BitmapButton oldBitmapButton = (BitmapButton)bitmapButtonList[index];
                    oldBitmapButton.Click -= new EventHandler(bitmapButton_Click);
                }

                //	Set the new BitmapButton.
                bitmapButtonList[index] = bitmapButton;
            }
            //	Add a new BitmapButton.
            else
            {
                //	Ensure that there are entries up to the index position (make them null).  This
                //	allows the user of this control to add his entries out of order or with gaps.
                for (int i = bitmapButtonList.Count; i < index; i++)
                {
                    bitmapButtonList.Add(null);
                }

                //	Add the BitmapButton.
                bitmapButtonList.Add(bitmapButton);
            }
        }
コード例 #15
0
        public PrivateMessageControl(string name)
        {
            InitializeComponent();
            ChatBox.Font                 = Program.Conf.ChatFont;
            Name                         = name;
            UserName                     = name;
            ChatBox.MouseUp             += autoscrollRichTextBox1_MouseUp;
            ChatBox.FocusInputRequested += (s, e) => GoToSendBox();
            ChatBox.ChatBackgroundColor  = TextColor.background; //same as Program.Conf.BgColor but TextWindow.cs need this.
            ChatBox.IRCForeColor         = 14;                   //mirc grey. Unknown use

            HistoryManager.InsertLastLines(UserName, ChatBox);

            VisibleChanged += PrivateMessageControl_VisibleChanged;
            Program.TasClient.BattleUserJoined += TasClient_BattleUserJoined;
            Program.TasClient.UserAdded        += TasClient_UserAdded;
            Program.TasClient.UserRemoved      += TasClient_UserRemoved;

            var extras = new BitmapButton();

            extras.Text   = "Extras";
            extras.Click += (s, e) => { ContextMenus.GetPrivateMessageContextMenu(this).Show(extras, new Point(0, 0)); };
            ChatBox.Controls.Add(extras);

            sendBox.CompleteWord += (word) => //autocomplete of username
            {
                var      w           = word.ToLower();
                string[] nameInArray = new string[1] {
                    name
                };
                System.Collections.Generic.IEnumerable <string> firstResult = nameInArray
                                                                              .Where(x => x.ToLower().StartsWith(w))
                                                                              .Union(nameInArray.Where(x => x.ToLower().Contains(w)));;
                if (true)
                {
                    ChatControl zkChatArea = Program.MainWindow.navigationControl.ChatTab.GetChannelControl("zk");
                    if (zkChatArea != null)
                    {
                        System.Collections.Generic.IEnumerable <string> extraResult = zkChatArea.playerBox.GetUserNames()
                                                                                      .Where(x => x.ToLower().StartsWith(w))
                                                                                      .Union(zkChatArea.playerBox.GetUserNames().Where(x => x.ToLower().Contains(w)));
                        firstResult = firstResult.Concat(extraResult); //Reference: http://stackoverflow.com/questions/590991/merging-two-ienumerablets
                    }
                }
                return(firstResult);
            };
        }
コード例 #16
0
    public PrivateMessageControl(string name)
    {
        InitializeComponent();
        ChatBox.Font = Config.ChatFont;
        Name = name;
        UserName = name;
        ChatBox.MouseUp += autoscrollRichTextBox1_MouseUp;
        ChatBox.FocusInputRequested += (s, e) => GoToSendBox();
        ChatBox.ChatBackgroundColor = TextColor.background; //same as Program.Conf.BgColor but TextWindow.cs need this.
        ChatBox.IRCForeColor = 14; //mirc grey. Unknown use

        HistoryManager.InsertLastLines(UserName, ChatBox);
        
        VisibleChanged += PrivateMessageControl_VisibleChanged;
        Program.TasClient.BattleUserJoined += TasClient_BattleUserJoined;
        Program.TasClient.UserAdded += TasClient_UserAdded;
        Program.TasClient.UserRemoved += TasClient_UserRemoved;

        var extras = new BitmapButton();
        extras.Text = "Extras";
        extras.Click += (s, e) => { ContextMenus.GetPrivateMessageContextMenu(this).Show(extras, new Point(0, 0)); };
        ChatBox.Controls.Add(extras);

        sendBox.CompleteWord += (word) => //autocomplete of username
        {
            var w = word.ToLower();
            string[] nameInArray = new string[1]{name};
            System.Collections.Generic.IEnumerable<string> firstResult = nameInArray
                        .Where(x => x.ToLower().StartsWith(w))
                        .Union(nameInArray.Where(x => x.ToLower().Contains(w)));; 
            if (true)
            {
                ChatControl zkChatArea = Program.MainWindow.navigationControl.ChatTab.GetChannelControl("zk");
                if (zkChatArea != null)
                {
                    System.Collections.Generic.IEnumerable<string> extraResult = zkChatArea.playerBox.GetUserNames()
                        .Where(x => x.ToLower().StartsWith(w))
                        .Union(zkChatArea.playerBox.GetUserNames().Where(x => x.ToLower().Contains(w)));
                    firstResult = firstResult.Concat(extraResult); //Reference: http://stackoverflow.com/questions/590991/merging-two-ienumerablets
                }
            }
            return firstResult;
        };
    }
コード例 #17
0
ファイル: ShopItem.cs プロジェクト: jayrulez/TOMClassic
 public ShopItem(BasePanel prt, int x, int y, int width, int height)
 {
     parent                           = prt;
     this.x                           = x;
     this.y                           = y;
     this.width                       = width;
     this.height                      = height;
     this.bitmapButtonBuy             = new BitmapButton();
     bitmapButtonBuy.Location         = new Point(x + 102, y + 30);
     bitmapButtonBuy.Size             = new Size(35, 20);
     this.bitmapButtonBuy.Click      += new System.EventHandler(this.pictureBoxBuy_Click);
     this.bitmapButtonBuy.ImageNormal = PicLoader.Read("ButtonBitmap", "ButtonBack2.PNG");
     bitmapButtonBuy.Font             = new Font("宋体", 8 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel);
     bitmapButtonBuy.ForeColor        = Color.White;
     bitmapButtonBuy.IconImage        = TaleofMonsters.Core.HSIcons.GetIconsByEName("oth9");
     bitmapButtonBuy.IconSize         = new Size(16, 16);
     bitmapButtonBuy.IconXY           = new Point(10, 4);
     parent.Controls.Add(bitmapButtonBuy);
 }
コード例 #18
0
        public void Init(int idx)
        {
            vRegion = new VirtualRegion(parent);
            vRegion.AddRegion(new PictureAnimRegion(1, X + 11, Y + 19, 56, 56, PictureRegionCellType.Item, 0));
            vRegion.RegionEntered += new VirtualRegion.VRegionEnteredEventHandler(virtualRegion_RegionEntered);
            vRegion.RegionLeft    += new VirtualRegion.VRegionLeftEventHandler(virtualRegion_RegionLeft);

            this.bitmapButtonBuy             = new BitmapButton();
            bitmapButtonBuy.Location         = new Point(X + 125, Y + 70);
            bitmapButtonBuy.Size             = new Size(35, 20);
            this.bitmapButtonBuy.Click      += new System.EventHandler(this.pictureBoxBuy_Click);
            this.bitmapButtonBuy.ImageNormal = PicLoader.Read("Button.Panel", "ButtonBack2.png");
            bitmapButtonBuy.Font             = new Font("宋体", 8 * 1.33f, FontStyle.Regular, GraphicsUnit.Pixel);
            bitmapButtonBuy.ForeColor        = Color.White;
            bitmapButtonBuy.IconImage        = HSIcons.GetIconsByEName("oth9");
            bitmapButtonBuy.IconSize         = new Size(16, 16);
            bitmapButtonBuy.IconXY           = new Point(10, 4);
            parent.Controls.Add(bitmapButtonBuy);
        }
コード例 #19
0
ファイル: WndProperties.cs プロジェクト: zdimension/phytestcs
        public WndProperties(BaseObject obj, Vector2f pos)
            : base(obj, 150, pos)
        {
            IsMain = true;

            Vector2f PosEnfant()
            {
                return(Position + new Vector2f(Size.X, 0));
            }

            var btnEff = new BitmapButton {
                Text = L["Clear"], Image = new Texture("icons/small/delete.png")
            };

            btnEff.Clicked += delegate { obj.Delete(); };
            Add(btnEff);

            // liquify
            // spongify
            // clone
            // mirror

            var windows = new[]
コード例 #20
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components    = new System.ComponentModel.Container();
     this.buttonRefresh = new OpenLiveWriter.Controls.BitmapButton(this.components);
     this.SuspendLayout();
     //
     // buttonRefresh
     //
     this.buttonRefresh.AutoSizeWidth = true;
     this.buttonRefresh.ButtonText    = "Refresh List";
     this.buttonRefresh.Location      = new System.Drawing.Point(0, 0);
     this.buttonRefresh.Name          = "buttonRefresh";
     this.buttonRefresh.Size          = new System.Drawing.Size(94, 29);
     this.buttonRefresh.TabIndex      = 0;
     this.buttonRefresh.ToolTip       = "Refreshes the list of categories.";
     //
     // CategoryRefreshControl
     //
     this.BackColor = System.Drawing.SystemColors.ControlLightLight;
     this.Controls.Add(this.buttonRefresh);
     this.Name = "CategoryRefreshControl";
     this.Size = new System.Drawing.Size(94, 29);
     this.ResumeLayout(false);
 }
コード例 #21
0
        public BattleListTab()
        {
            SuspendLayout();
            Size = new Size(731, 463);

            panel1 = new Panel {
                BackColor = Color.Transparent, Dock = DockStyle.Top, Location = new Point(0, 0), Size = new Size(731, 50)
            };
            searchLabel = new Label {
                AutoSize = true, Location = new Point(203, 17), Size = new Size(59, 18), Text = "Search:", ForeColor = Config.TextColor, Font = Config.GeneralFont
            };
            searchBox = new ZklTextBox {
                BackColor = Color.FromArgb(0, 30, 40), Location = new Point(268, 14), Size = new Size(178, 24), TabIndex = 1
            };


            var btnMm = new BitmapButton()
            {
                Text              = "Start MatchMaker",
                Width             = 150,
                Height            = 50,
                Image             = Buttons.mp.GetResizedWithCache(32, 32),
                TextImageRelation = TextImageRelation.ImageBeforeText
            };

            btnMm.Click += (s, e) =>
            {
                var mm = new StartMatchMakerDialog();
                mm.StartPosition = FormStartPosition.CenterScreen;
                mm.Show(Program.MainWindow);
            };

            panel1.Controls.Add(btnMm);

            panel1.Controls.Add(searchLabel);
            panel1.Controls.Add(searchBox);

            battlePanel = new Panel
            {
                Location = new Point(0, 50),
                Size     = new Size(731, 432),
                Anchor   = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right
            };

            // battle list
            battleListControl = new BattleListControl {
                Dock = DockStyle.Fill
            };
            battlePanel.Controls.Add(battleListControl);

            Controls.Add(panel1);
            Controls.Add(battlePanel);

            Program.ToolTip.SetText(searchBox, "Search game, map or player");
            Program.ToolTip.SetText(searchBox.TextBox, "Search game, map or player");
            Program.ToolTip.SetText(searchLabel, "Search game, map or player");

            searchBox.TextChanged += searchBox_TextChanged;

            ResumeLayout();
        }
コード例 #22
0
        public ChatControl(string name)
        {
            InitializeComponent();

            var isDesignMode = Process.GetCurrentProcess().ProcessName == "devenv"; // workaround for this.DesignMode not working in constructor

            if (isDesignMode)
            {
                return;
            }

            var extras = new BitmapButton();

            extras.Text   = "Extras";
            extras.Click += (s, e) => { ContextMenus.GetChannelContextMenu(this).Show(extras, new Point(0, 0)); };
            ChatBox.Controls.Add(extras);

            playerBox.DrawMode     = DrawMode.OwnerDrawVariable;
            playerBox.MeasureItem += (s, e) => { }; // needed for ListBox.OnMeasureItem
            playerBox.BackColor    = Program.Conf.BgColor;
            playerBox.ForeColor    = Program.Conf.TextColor;

            playerSearchBox.BackColor = Program.Conf.BgColor;
            playerSearchBox.ForeColor = Program.Conf.TextColor;

            ChatBox.Font = Program.Conf.ChatFont; //make sure this is done before HistoryManager adds text, or text becomes black.

            Name        = name;
            ChannelName = name;
            if (!DesignMode)
            {
                HistoryManager.InsertLastLines(ChannelName, ChatBox);
            }

            playerBox.Sorted = true;
            var lookingGlass = new PictureBox {
                Width = 20, Height = 20, Image = ZklResources.search, SizeMode = PictureBoxSizeMode.CenterImage
            };

            searchBarContainer.Controls.Add(lookingGlass);
            Program.ToolTip.SetText(lookingGlass, "Enter name or country shortcut to find");

            Program.ToolTip.SetText(playerSearchBox, "Enter name or country shortcut to find");

            VisibleChanged += ChatControl_VisibleChanged;

            ChatBox.MouseUp             += chatBox_MouseUp;
            ChatBox.MouseDown           += chatBox_MouseDown;
            ChatBox.MouseMove           += chatBox_MouseMove;
            ChatBox.FocusInputRequested += (s, e) => GoToSendBox();
            ChatBox.ChatBackgroundColor  = TextColor.background; //same as Program.Conf.BgColor but TextWindow.cs need this.
            ChatBox.IRCForeColor         = 14;                   //mirc grey. Unknown use

            Program.TasClient.ChannelUserAdded   += client_ChannelUserAdded;
            Program.TasClient.ChannelUserRemoved += client_ChannelUserRemoved;
            Program.TasClient.UserStatusChanged  += TasClient_UserStatusChanged;
            Program.TasClient.ChannelUsersAdded  += TasClient_ChannelUsersAdded;
            Program.TasClient.Said                += client_Said;
            Program.TasClient.UserRemoved         += TasClient_UserRemoved;
            Program.TasClient.ChannelTopicChanged += TasClient_ChannelTopicChanged;
            Program.TasClient.HourChime           += client_HourChime;

            Channel channel;

            Program.TasClient.JoinedChannels.TryGetValue(ChannelName, out channel);

            //Topic Box that displays over the channel
            topicBox.IRCForeColor             = 14; //mirc grey. Unknown use
            topicBox.ChatBackgroundColor      = TextColor.topicBackground;
            topicBox.HorizontalScroll.Enabled = true;
            topicBox.BorderStyle            = BorderStyle.FixedSingle;
            topicBox.VerticalScroll.Visible = false;
            topicBox.VerticalScroll.Enabled = false;
            topicBox.AutoSize       = true;
            topicBox.AutoSizeMode   = AutoSizeMode.GrowAndShrink;
            topicBox.HideScroll     = true;
            topicBox.ShowUnreadLine = false;
            topicBox.ShowHistory    = false;

            //hide mappanel for normal chat operation. Overriden in BattleChatControl.cs
            playerListMapSplitContainer.Panel2Collapsed = true;

            sendBox.CompleteWord += (word) => //autocomplete of username
            {
                var w = word.ToLower();
                IEnumerable <string> firstResult = playerBox.GetUserNames()
                                                   .Where(x => x.ToLower().StartsWith(w))
                                                   .Union(playerBox.GetUserNames().Where(x => x.ToLower().Contains(w)));
                if (true)
                {
                    ChatControl zkChatArea = Program.MainWindow.navigationControl.ChatTab.GetChannelControl("zk");
                    if (zkChatArea != null)
                    {
                        IEnumerable <string> extraResult = zkChatArea.playerBox.GetUserNames()
                                                           .Where(x => x.ToLower().StartsWith(w))
                                                           .Union(zkChatArea.playerBox.GetUserNames().Where(x => x.ToLower().Contains(w)));
                        firstResult = firstResult.Concat(extraResult);     //Reference: http://stackoverflow.com/questions/590991/merging-two-ienumerablets
                    }
                }
                return(firstResult);
            };

            if (channel != null)
            {
                foreach (var userName in Program.TasClient.JoinedChannels[ChannelName].ChannelUsers)
                {
                    AddUser(userName);
                }
            }
        }
コード例 #23
0
		void InitializeComponent()
		{
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConnectBar));
            this.lbState = new System.Windows.Forms.Label();
            this.pictureBox1 = new System.Windows.Forms.PictureBox();
            this.btnLogout = new ZeroKLobby.BitmapButton();
            this.btnProfile = new ZeroKLobby.BitmapButton();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
            this.SuspendLayout();
            // 
            // lbState
            // 
            this.lbState.AutoSize = true;
            this.lbState.Location = new System.Drawing.Point(70, 11);
            this.lbState.Name = "lbState";
            this.lbState.Size = new System.Drawing.Size(30, 13);
            this.lbState.TabIndex = 0;
            this.lbState.Text = "state";
            // 
            // pictureBox1
            // 
            this.pictureBox1.Location = new System.Drawing.Point(0, 0);
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new System.Drawing.Size(64, 64);
            this.pictureBox1.TabIndex = 1;
            this.pictureBox1.TabStop = false;
            // 
            // btnLogout
            // 
            this.btnLogout.BackColor = System.Drawing.Color.Transparent;
            this.btnLogout.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnLogout.BackgroundImage")));
            this.btnLogout.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
            this.btnLogout.ButtonStyle = ZeroKLobby.FrameBorderRenderer.StyleType.DarkHive;
            this.btnLogout.Cursor = System.Windows.Forms.Cursors.Hand;
            this.btnLogout.FlatAppearance.BorderSize = 0;
            this.btnLogout.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent;
            this.btnLogout.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent;
            this.btnLogout.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btnLogout.ForeColor = System.Drawing.Color.White;
            this.btnLogout.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.btnLogout.Location = new System.Drawing.Point(154, 38);
            this.btnLogout.Name = "btnLogout";
            this.btnLogout.Size = new System.Drawing.Size(75, 23);
            this.btnLogout.SoundType = ZeroKLobby.Controls.SoundPalette.SoundType.Click;
            this.btnLogout.TabIndex = 3;
            this.btnLogout.Text = "Logout";
            this.btnLogout.UseVisualStyleBackColor = false;
            this.btnLogout.Click += new System.EventHandler(this.btnLogout_Click);
            // 
            // btnProfile
            // 
            this.btnProfile.BackColor = System.Drawing.Color.Transparent;
            this.btnProfile.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnProfile.BackgroundImage")));
            this.btnProfile.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
            this.btnProfile.ButtonStyle = ZeroKLobby.FrameBorderRenderer.StyleType.DarkHive;
            this.btnProfile.Cursor = System.Windows.Forms.Cursors.Hand;
            this.btnProfile.FlatAppearance.BorderSize = 0;
            this.btnProfile.FlatAppearance.MouseDownBackColor = System.Drawing.Color.Transparent;
            this.btnProfile.FlatAppearance.MouseOverBackColor = System.Drawing.Color.Transparent;
            this.btnProfile.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.btnProfile.ForeColor = System.Drawing.Color.White;
            this.btnProfile.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.btnProfile.Location = new System.Drawing.Point(73, 38);
            this.btnProfile.Name = "btnProfile";
            this.btnProfile.Size = new System.Drawing.Size(75, 23);
            this.btnProfile.SoundType = ZeroKLobby.Controls.SoundPalette.SoundType.Click;
            this.btnProfile.TabIndex = 2;
            this.btnProfile.Text = "Profile";
            this.btnProfile.UseVisualStyleBackColor = false;
            this.btnProfile.Click += new System.EventHandler(this.btnProfile_Click);
            // 
            // ConnectBar
            // 
            this.BackColor = System.Drawing.Color.Transparent;
            this.Controls.Add(this.btnLogout);
            this.Controls.Add(this.btnProfile);
            this.Controls.Add(this.pictureBox1);
            this.Controls.Add(this.lbState);
            this.MinimumSize = new System.Drawing.Size(300, 60);
            this.Name = "ConnectBar";
            this.Size = new System.Drawing.Size(300, 64);
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

		}
コード例 #24
0
        private void InitializeComponent() {
            SuspendLayout();

            btnDetail = new BitmapButton { Text = "Connect", Left = 10, Top = 10, Width = 100, Height = 60, Font = Config.GeneralFontBig };
            btnDetail.Click += (sender, args) => TryToConnectTasClient();
            Controls.Add(btnDetail);

            lbState = new Label
            {
                AutoSize = true,
                Location = new Point(120, 30),
                Name = "lbState",
                ForeColor = Config.TextColor,
                BackColor = Color.Transparent,
                Text = "Connect to the Spring multiplayer lobby server."
            };

            Controls.Add(lbState);
            AutoSize = true;
            AutoSizeMode = AutoSizeMode.GrowAndShrink;
            Size = new Size(300, 80);

            ResumeLayout(false);
        }
コード例 #25
0
        private void InitializeComponent()
        {
            playerListMapSplitContainer = new SplitContainer();
            playerBoxSearchBarContainer = new Panel();
            playerBox = new PlayerListControl();
            searchBarContainer = new TableLayoutPanel();
            playerSearchBox = new ZklTextBox();
            sendBox = new SendBox();
            topicPanel = new Panel();
            hideButton = new BitmapButton();
            topicBox = new ChatBox();
            ChatBox = new ChatBox();
            splitContainer1 = new ZkSplitContainer();
            ((ISupportInitialize)playerListMapSplitContainer).BeginInit();
            playerListMapSplitContainer.Panel1.SuspendLayout();
            playerListMapSplitContainer.SuspendLayout();
            playerBoxSearchBarContainer.SuspendLayout();
            searchBarContainer.SuspendLayout();
            topicPanel.SuspendLayout();
            ((ISupportInitialize)splitContainer1).BeginInit();
            splitContainer1.Panel1.SuspendLayout();
            splitContainer1.Panel2.SuspendLayout();
            splitContainer1.SuspendLayout();
            SuspendLayout();
            // 
            // playerListMapSplitContainer
            // 
            playerListMapSplitContainer.BackColor = Color.DimGray;
            playerListMapSplitContainer.Dock = DockStyle.Fill;
            playerListMapSplitContainer.Location = new Point(0, 0);
            playerListMapSplitContainer.Margin = new Padding(2);
            playerListMapSplitContainer.Name = "playerListMapSplitContainer";
            playerListMapSplitContainer.Orientation = Orientation.Horizontal;
            // 
            // playerListMapSplitContainer.Panel1
            // 
            playerListMapSplitContainer.Panel1.Controls.Add(playerBoxSearchBarContainer);
            // 
            // playerListMapSplitContainer.Panel2
            // 
            playerListMapSplitContainer.Panel2.AutoScroll = true;
            playerListMapSplitContainer.Size = new Size(326, 793);
            playerListMapSplitContainer.SplitterDistance = 565;
            playerListMapSplitContainer.SplitterWidth = 3;
            playerListMapSplitContainer.TabIndex = 0;
            playerListMapSplitContainer.SplitterMoved += new SplitterEventHandler(playerListMapSplitContainer_SplitterMoved);
            // 
            // playerBoxSearchBarContainer
            // 
            playerBoxSearchBarContainer.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            playerBoxSearchBarContainer.Controls.Add(playerBox);
            playerBoxSearchBarContainer.Controls.Add(searchBarContainer);
            playerBoxSearchBarContainer.Dock = DockStyle.Fill;
            playerBoxSearchBarContainer.Location = new Point(0, 0);
            playerBoxSearchBarContainer.Name = "playerBoxSearchBarContainer";
            playerBoxSearchBarContainer.Size = new Size(326, 565);
            playerBoxSearchBarContainer.TabIndex = 2;
            // 
            // playerBox
            // 
            playerBox.BackColor = Color.DimGray;
            playerBox.Dock = DockStyle.Fill;
            playerBox.ForeColor = Color.White;
            playerBox.HoverItem = null;
            playerBox.IsBattle = false;
            playerBox.IsSorted = false;
            playerBox.Location = new Point(0, 24);
            playerBox.Name = "playerBox";
            playerBox.SelectedItem = null;
            playerBox.Size = new Size(326, 541);
            playerBox.TabIndex = 1;
            // 
            // searchBarContainer
            // 
            searchBarContainer.ColumnCount = 2;
            searchBarContainer.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize, 20F));
            searchBarContainer.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 20F));
            searchBarContainer.Controls.Add(playerSearchBox, 1, 0);
            searchBarContainer.Dock = DockStyle.Top;
            searchBarContainer.Location = new Point(0, 0);
            searchBarContainer.Name = "searchBarContainer";
            searchBarContainer.RowCount = 1;
            searchBarContainer.RowStyles.Add(new RowStyle(SizeType.Absolute, 25F));
            searchBarContainer.Size = new Size(326, 30);
            searchBarContainer.AutoSize = false;
            searchBarContainer.TabIndex = 0;
            // 
            // playerSearchBox
            // 
            playerSearchBox.Anchor = AnchorStyles.Left | AnchorStyles.Top;
            playerSearchBox.Location = new Point(23, 22);
            playerSearchBox.Name = "playerSearchBox";
            playerSearchBox.Size = new Size(300, 20);
            playerSearchBox.Margin = new Padding(0);
            playerSearchBox.TabIndex = 0;
            playerSearchBox.Font = Config.GeneralFontSmall;
            playerSearchBox.TextChanged += new EventHandler(playerSearchBox_TextChanged);
            // 
            // sendBox
            // 
            sendBox.Dock = DockStyle.Bottom;
            sendBox.Font = Config.GeneralFont;
            sendBox.ForeColor = Color.White;
            sendBox.Location = new Point(0, 765);
            sendBox.Multiline = true;
            sendBox.Name = "sendBox";
            sendBox.Size = new Size(800, 28);
            sendBox.TabIndex = 0;
            sendBox.WordWrap = false;
            // 
            // topicPanel
            // 
            topicPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            topicPanel.Controls.Add(hideButton);
            topicPanel.Controls.Add(topicBox);
            topicPanel.Dock = DockStyle.Top;
            topicPanel.Location = new Point(0, 0);
            topicPanel.Margin = new Padding(0);
            topicPanel.Name = "topicPanel";
            topicPanel.Size = new Size(800, 0);
            topicPanel.TabIndex = 3;
            // 
            // hideButton
            // 
            hideButton.Anchor = (AnchorStyles)(AnchorStyles.Bottom | AnchorStyles.Right);
            hideButton.BackColor = Color.Transparent;
            hideButton.ButtonStyle = FrameBorderRenderer.StyleType.DarkHive;
            hideButton.Cursor = Cursors.Hand;
            hideButton.FlatStyle = FlatStyle.Flat;
            hideButton.ForeColor = Color.White;
            hideButton.Location = new Point(711, -29);
            hideButton.Name = "hideButton";
            hideButton.Size = new Size(75, 23);
            hideButton.SoundType = SoundPalette.SoundType.Click;
            hideButton.TabIndex = 3;
            hideButton.Text = "Hide";
            hideButton.UseVisualStyleBackColor = true;
            hideButton.Click += new EventHandler(hideButton_Click);
            // 
            // topicBox
            // 
            topicBox.BackColor = Color.FromArgb((int)(byte)0, (int)(byte)30, (int)(byte)40);
            topicBox.ChatBackgroundColor = 0;
            topicBox.DefaultTooltip = null;
            topicBox.Dock = DockStyle.Fill;
            topicBox.Font = Config.GeneralFontBig;
            topicBox.HideScroll = false;
            topicBox.IRCForeColor = 0;
            topicBox.LineHighlight = null;
            topicBox.Location = new Point(0, 0);
            topicBox.Name = "topicBox";
            topicBox.NoColorMode = false;
            topicBox.ShowHistory = true;
            topicBox.ShowJoinLeave = false;
            topicBox.ShowUnreadLine = true;
            topicBox.SingleLine = false;
            topicBox.Size = new Size(800, 0);
            topicBox.TabIndex = 2;
            topicBox.TextFilter = null;
            // 
            // ChatBox
            // 
            ChatBox.BackColor = Color.DimGray;
            ChatBox.ChatBackgroundColor = 0;
            ChatBox.DefaultTooltip = null;
            ChatBox.Dock = DockStyle.Fill;
            ChatBox.Font = Config.GeneralFont;
            ChatBox.ForeColor = Color.White;
            ChatBox.HideScroll = false;
            ChatBox.IRCForeColor = 0;
            ChatBox.LineHighlight = null;
            ChatBox.Location = new Point(0, 0);
            ChatBox.Name = "ChatBox";
            ChatBox.NoColorMode = false;
            ChatBox.ShowHistory = true;
            ChatBox.ShowJoinLeave = false;
            ChatBox.ShowUnreadLine = true;
            ChatBox.SingleLine = false;
            ChatBox.Size = new Size(800, 765);
            ChatBox.TabIndex = 1;
            ChatBox.TextFilter = null;
            // 
            // splitContainer1
            // 
            splitContainer1.BackColor = Color.Transparent;
            splitContainer1.Dock = DockStyle.Fill;
            splitContainer1.Location = new Point(0, 0);
            splitContainer1.Margin = new Padding(0);
            splitContainer1.Name = "splitContainer1";
            // 
            // splitContainer1.Panel1
            // 
            splitContainer1.Panel1.Controls.Add(ChatBox);
            splitContainer1.Panel1.Controls.Add(topicPanel);
            splitContainer1.Panel1.Controls.Add(sendBox);
            // 
            // splitContainer1.Panel2
            // 
            splitContainer1.Panel2.Controls.Add(playerListMapSplitContainer);
            splitContainer1.Size = new Size(1130, 793);
            splitContainer1.SplitterDistance = 800;
            splitContainer1.TabIndex = 0;
            splitContainer1.SplitterMoved += splitContainer1_SplitterMoved;


            playerBox.BackColor = Config.BgColor;
            playerBox.ForeColor = Config.TextColor;
            playerBox_zklclick.AttachTo(playerBox);
            playerBox_zklclick.MouseClick += PlayerBox_MouseClick;

            playerSearchBox.BackColor = Config.BgColor;
            playerSearchBox.ForeColor = Config.TextColor;


            var searchLabel = new Label() { Text = "Search: ", AutoSize = true, Font = Config.GeneralFontSmall, Margin = new Padding(3) };
            searchBarContainer.Controls.Add(searchLabel, 0, 0);


            // 
            // ChatControl
            // 
            Controls.Add(splitContainer1);
            Margin = new Padding(0);
            Name = "ChatControl";
            Size = new Size(1130, 793);
            playerListMapSplitContainer.Panel1.ResumeLayout(false);
            ((ISupportInitialize)playerListMapSplitContainer).EndInit();
            playerListMapSplitContainer.ResumeLayout(false);
            playerBoxSearchBarContainer.ResumeLayout(false);
            searchBarContainer.ResumeLayout(false);
            topicPanel.ResumeLayout(false);
            splitContainer1.Panel1.ResumeLayout(false);
            splitContainer1.Panel1.PerformLayout();
            splitContainer1.Panel2.ResumeLayout(false);
            ((ISupportInitialize)splitContainer1).EndInit();
            splitContainer1.ResumeLayout(false);
            ResumeLayout(false);
        }
コード例 #26
0
ファイル: ComPanel.cs プロジェクト: joeferner/fivevolt
        private Panel CreateControlPanel()
        {
            Panel panel = new Panel(this);
            BoxSizer sizer = new BoxSizer(Orientation.Horizontal);

            _port = new ComboBox(panel, "", WxDefaultPosition, WxDefaultSize, new string[0],
                WindowStyles.ComboBoxDropDown | WindowStyles.ComboBoxReadonly);
            UpdatePorts();
            sizer.Add(_port, 0, SizerFlag.Expand | SizerFlag.All, 5);

            Bitmap refreshBitmap = GetType().Assembly.GetManifestResourceWxBitmap("DummyLoadController.Images.refresh.png");
            _refreshPorts = new BitmapButton(panel, ID_RefreshPorts, refreshBitmap);
            EvtButton(ID_RefreshPorts, (s, e) => UpdatePorts());
            sizer.Add(_refreshPorts, 0, SizerFlag.Expand | SizerFlag.All, 0);

            string[] baudRates = new[] { "300", "600", "1200", "2400", "4800", "9600", "14,400", "19,200", "28,800", "38,400", "57,600", "76,800", "115,200", "230,400" };
            _baudRate = new ComboBox(panel, "", WxDefaultPosition, WxDefaultSize, baudRates, WindowStyles.ComboBoxDropDown | WindowStyles.ComboBoxReadonly);
            _baudRate.Select(5);
            sizer.Add(_baudRate, 0, SizerFlag.Expand | SizerFlag.All, 5);

            _connect = new Button(panel, ID_Connect, "Connect");
            EvtButton(ID_Connect, (s, e) => Connect());
            sizer.Add(_connect, 0, SizerFlag.Expand | SizerFlag.All, 5);

            _disconnect = new Button(panel, ID_Disconnect, "Disconnect");
            EvtButton(ID_Disconnect, (s, e) => _comService.Disconnect());
            sizer.Add(_disconnect, 0, SizerFlag.Expand | SizerFlag.All, 5);

            panel.SetSizer(sizer);
            sizer.SetSizeHints(panel);

            return panel;
        }
コード例 #27
0
        public LoginForm() {
            Font = Config.GeneralFontBig;
            SuspendLayout();

            btnSubmit = new BitmapButton
            {
                ButtonStyle = FrameBorderRenderer.StyleType.DarkHive,
                DialogResult = DialogResult.OK,
                Location = new Point(70, 255),
                Size = new Size(104, 44),
                SoundType = SoundPalette.SoundType.Click,
                Text = "OK"
            };
            btnSubmit.Click += btnSubmit_Click;

            tbLogin = new ZklTextBox { Location = new Point(237, 123), Size = new Size(146, 24), TabIndex = 1 };
            tbLogin.TextBox.TextChanged += (sender, args) => { tbLogin_TextBox_TextChanged(sender, args); };

            tbPassword = new ZklTextBox
            {
                Location = new Point(237, 164),
                Size = new Size(146, 24),
                TabIndex = 2,
                TextBox = { UseSystemPasswordChar = true }
            };

            lbInfo = new Label
            {
                BackColor = Color.Transparent,
                ForeColor = Color.Red,
                Location = new Point(29, 20),
                Size = new Size(414, 51),
                Text = "Error",
                TextAlign = ContentAlignment.MiddleCenter
            };

            btnCancel = new BitmapButton
            {
                ButtonStyle = FrameBorderRenderer.StyleType.DarkHive,
                DialogResult = DialogResult.Cancel,
                Location = new Point(286, 255),
                Size = new Size(97, 44),
                SoundType = SoundPalette.SoundType.Click,
                Text = "Cancel"
            };
            btnCancel.Click += btnCancel_Click;

            var label1 = new Label
            {
                AutoSize = true,
                BackColor = Color.Transparent,
                Location = new Point(112, 126),
                Size = new Size(89, 18),
                Text = "Login name:"
            };

            var label2 = new Label
            {
                AutoSize = true,
                BackColor = Color.Transparent,
                Location = new Point(121, 167),
                Size = new Size(79, 18),
                Text = "Password:"******"Zero-K Login/Register";
            Load += LoginForm_Load;
            ResumeLayout(false);
            PerformLayout();

            tbLogin.Text = Program.Conf.LobbyPlayerName;
            if (string.IsNullOrEmpty(tbLogin.Text))
            {
                tbLogin.Text = Program.SteamHandler.SteamName;
                Program.SteamHandler.SteamHelper.SteamOnline += SteamApiOnSteamOnline;
            }
            tbPassword.Text = Program.Conf.LobbyPlayerPassword;

            tbLogin.TextBox.PreviewKeyDown += onKeyPress;
            tbPassword.TextBox.PreviewKeyDown += onKeyPress;
        }
コード例 #28
0
        private void InitializeComponent()
        {
            playerListMapSplitContainer = new SplitContainer();
            playerBoxSearchBarContainer = new Panel();
            playerBox          = new PlayerListControl();
            searchBarContainer = new TableLayoutPanel();
            playerSearchBox    = new ZklTextBox();
            sendBox            = new SendBox();
            topicPanel         = new Panel();
            hideButton         = new BitmapButton();
            topicBox           = new ChatBox();
            ChatBox            = new ChatBox();
            splitContainer1    = new ZkSplitContainer();
            ((ISupportInitialize)playerListMapSplitContainer).BeginInit();
            playerListMapSplitContainer.Panel1.SuspendLayout();
            playerListMapSplitContainer.SuspendLayout();
            playerBoxSearchBarContainer.SuspendLayout();
            searchBarContainer.SuspendLayout();
            topicPanel.SuspendLayout();
            ((ISupportInitialize)splitContainer1).BeginInit();
            splitContainer1.Panel1.SuspendLayout();
            splitContainer1.Panel2.SuspendLayout();
            splitContainer1.SuspendLayout();
            SuspendLayout();
            //
            // playerListMapSplitContainer
            //
            playerListMapSplitContainer.BackColor   = Color.DimGray;
            playerListMapSplitContainer.Dock        = DockStyle.Fill;
            playerListMapSplitContainer.Location    = new Point(0, 0);
            playerListMapSplitContainer.Margin      = new Padding(2);
            playerListMapSplitContainer.Name        = "playerListMapSplitContainer";
            playerListMapSplitContainer.Orientation = Orientation.Horizontal;
            //
            // playerListMapSplitContainer.Panel1
            //
            playerListMapSplitContainer.Panel1.Controls.Add(playerBoxSearchBarContainer);
            //
            // playerListMapSplitContainer.Panel2
            //
            playerListMapSplitContainer.Panel2.AutoScroll = true;
            playerListMapSplitContainer.Size             = new Size(326, 793);
            playerListMapSplitContainer.SplitterDistance = 565;
            playerListMapSplitContainer.SplitterWidth    = 3;
            playerListMapSplitContainer.TabIndex         = 0;
            playerListMapSplitContainer.SplitterMoved   += new SplitterEventHandler(playerListMapSplitContainer_SplitterMoved);
            //
            // playerBoxSearchBarContainer
            //
            playerBoxSearchBarContainer.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            playerBoxSearchBarContainer.Controls.Add(playerBox);
            playerBoxSearchBarContainer.Controls.Add(searchBarContainer);
            playerBoxSearchBarContainer.Dock     = DockStyle.Fill;
            playerBoxSearchBarContainer.Location = new Point(0, 0);
            playerBoxSearchBarContainer.Name     = "playerBoxSearchBarContainer";
            playerBoxSearchBarContainer.Size     = new Size(326, 565);
            playerBoxSearchBarContainer.TabIndex = 2;
            //
            // playerBox
            //
            playerBox.BackColor    = Color.DimGray;
            playerBox.Dock         = DockStyle.Fill;
            playerBox.ForeColor    = Color.White;
            playerBox.HoverItem    = null;
            playerBox.IsBattle     = false;
            playerBox.IsSorted     = false;
            playerBox.Location     = new Point(0, 24);
            playerBox.Name         = "playerBox";
            playerBox.SelectedItem = null;
            playerBox.Size         = new Size(326, 541);
            playerBox.TabIndex     = 1;
            //
            // searchBarContainer
            //
            searchBarContainer.ColumnCount = 2;
            searchBarContainer.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize, 20F));
            searchBarContainer.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 20F));
            searchBarContainer.Controls.Add(playerSearchBox, 1, 0);
            searchBarContainer.Dock     = DockStyle.Top;
            searchBarContainer.Location = new Point(0, 0);
            searchBarContainer.Name     = "searchBarContainer";
            searchBarContainer.RowCount = 1;
            searchBarContainer.RowStyles.Add(new RowStyle(SizeType.Absolute, 25F));
            searchBarContainer.Size     = new Size(326, 30);
            searchBarContainer.AutoSize = false;
            searchBarContainer.TabIndex = 0;
            //
            // playerSearchBox
            //
            playerSearchBox.Anchor       = AnchorStyles.Left | AnchorStyles.Top;
            playerSearchBox.Location     = new Point(23, 22);
            playerSearchBox.Name         = "playerSearchBox";
            playerSearchBox.Size         = new Size(300, 20);
            playerSearchBox.Margin       = new Padding(0);
            playerSearchBox.TabIndex     = 0;
            playerSearchBox.Font         = Config.GeneralFontSmall;
            playerSearchBox.TextChanged += new EventHandler(playerSearchBox_TextChanged);
            //
            // sendBox
            //
            sendBox.Dock      = DockStyle.Bottom;
            sendBox.Font      = Config.GeneralFont;
            sendBox.ForeColor = Color.White;
            sendBox.Location  = new Point(0, 765);
            sendBox.Multiline = true;
            sendBox.Name      = "sendBox";
            sendBox.Size      = new Size(800, 28);
            sendBox.TabIndex  = 0;
            sendBox.WordWrap  = false;
            //
            // topicPanel
            //
            topicPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            topicPanel.Controls.Add(hideButton);
            topicPanel.Controls.Add(topicBox);
            topicPanel.Dock     = DockStyle.Top;
            topicPanel.Location = new Point(0, 0);
            topicPanel.Margin   = new Padding(0);
            topicPanel.Name     = "topicPanel";
            topicPanel.Size     = new Size(800, 0);
            topicPanel.TabIndex = 3;
            //
            // hideButton
            //
            hideButton.Anchor                  = (AnchorStyles)(AnchorStyles.Bottom | AnchorStyles.Right);
            hideButton.BackColor               = Color.Transparent;
            hideButton.ButtonStyle             = FrameBorderRenderer.StyleType.DarkHive;
            hideButton.Cursor                  = Cursors.Hand;
            hideButton.FlatStyle               = FlatStyle.Flat;
            hideButton.ForeColor               = Color.White;
            hideButton.Location                = new Point(711, -29);
            hideButton.Name                    = "hideButton";
            hideButton.Size                    = new Size(75, 23);
            hideButton.SoundType               = SoundPalette.SoundType.Click;
            hideButton.TabIndex                = 3;
            hideButton.Text                    = "Hide";
            hideButton.UseVisualStyleBackColor = true;
            hideButton.Click                  += new EventHandler(hideButton_Click);
            //
            // topicBox
            //
            topicBox.BackColor           = Color.FromArgb((int)(byte)0, (int)(byte)30, (int)(byte)40);
            topicBox.ChatBackgroundColor = 0;
            topicBox.DefaultTooltip      = null;
            topicBox.Dock           = DockStyle.Fill;
            topicBox.Font           = Config.GeneralFontBig;
            topicBox.HideScroll     = false;
            topicBox.IRCForeColor   = 0;
            topicBox.LineHighlight  = null;
            topicBox.Location       = new Point(0, 0);
            topicBox.Name           = "topicBox";
            topicBox.NoColorMode    = false;
            topicBox.ShowHistory    = true;
            topicBox.ShowJoinLeave  = false;
            topicBox.ShowUnreadLine = true;
            topicBox.SingleLine     = false;
            topicBox.Size           = new Size(800, 0);
            topicBox.TabIndex       = 2;
            topicBox.TextFilter     = null;
            //
            // ChatBox
            //
            ChatBox.BackColor           = Color.DimGray;
            ChatBox.ChatBackgroundColor = 0;
            ChatBox.DefaultTooltip      = null;
            ChatBox.Dock           = DockStyle.Fill;
            ChatBox.Font           = Config.GeneralFont;
            ChatBox.ForeColor      = Color.White;
            ChatBox.HideScroll     = false;
            ChatBox.IRCForeColor   = 0;
            ChatBox.LineHighlight  = null;
            ChatBox.Location       = new Point(0, 0);
            ChatBox.Name           = "ChatBox";
            ChatBox.NoColorMode    = false;
            ChatBox.ShowHistory    = true;
            ChatBox.ShowJoinLeave  = false;
            ChatBox.ShowUnreadLine = true;
            ChatBox.SingleLine     = false;
            ChatBox.Size           = new Size(800, 765);
            ChatBox.TabIndex       = 1;
            ChatBox.TextFilter     = null;
            //
            // splitContainer1
            //
            splitContainer1.BackColor = Color.Transparent;
            splitContainer1.Dock      = DockStyle.Fill;
            splitContainer1.Location  = new Point(0, 0);
            splitContainer1.Margin    = new Padding(0);
            splitContainer1.Name      = "splitContainer1";
            //
            // splitContainer1.Panel1
            //
            splitContainer1.Panel1.Controls.Add(ChatBox);
            splitContainer1.Panel1.Controls.Add(topicPanel);
            splitContainer1.Panel1.Controls.Add(sendBox);
            //
            // splitContainer1.Panel2
            //
            splitContainer1.Panel2.Controls.Add(playerListMapSplitContainer);
            splitContainer1.Size             = new Size(1130, 793);
            splitContainer1.SplitterDistance = 800;
            splitContainer1.TabIndex         = 0;
            splitContainer1.SplitterMoved   += splitContainer1_SplitterMoved;


            playerBox.BackColor = Config.BgColor;
            playerBox.ForeColor = Config.TextColor;
            playerBox_zklclick.AttachTo(playerBox);
            playerBox_zklclick.MouseClick += PlayerBox_MouseClick;

            playerSearchBox.BackColor = Config.BgColor;
            playerSearchBox.ForeColor = Config.TextColor;


            var searchLabel = new Label()
            {
                Text = "Search: ", AutoSize = true, Font = Config.GeneralFontSmall, Margin = new Padding(3)
            };

            searchBarContainer.Controls.Add(searchLabel, 0, 0);


            //
            // ChatControl
            //
            Controls.Add(splitContainer1);
            Margin = new Padding(0);
            Name   = "ChatControl";
            Size   = new Size(1130, 793);
            playerListMapSplitContainer.Panel1.ResumeLayout(false);
            ((ISupportInitialize)playerListMapSplitContainer).EndInit();
            playerListMapSplitContainer.ResumeLayout(false);
            playerBoxSearchBarContainer.ResumeLayout(false);
            searchBarContainer.ResumeLayout(false);
            topicPanel.ResumeLayout(false);
            splitContainer1.Panel1.ResumeLayout(false);
            splitContainer1.Panel1.PerformLayout();
            splitContainer1.Panel2.ResumeLayout(false);
            ((ISupportInitialize)splitContainer1).EndInit();
            splitContainer1.ResumeLayout(false);
            ResumeLayout(false);
        }
コード例 #29
0
        public LoginForm()
        {
            Font = Config.GeneralFontBig;
            SuspendLayout();

            btnSubmit = new BitmapButton
            {
                ButtonStyle  = FrameBorderRenderer.StyleType.DarkHive,
                DialogResult = DialogResult.OK,
                Location     = new Point(70, 255),
                Size         = new Size(104, 44),
                SoundType    = SoundPalette.SoundType.Click,
                Text         = "OK"
            };
            btnSubmit.Click += btnSubmit_Click;

            tbLogin = new ZklTextBox {
                Location = new Point(237, 123), Size = new Size(146, 24), TabIndex = 1
            };
            tbLogin.TextBox.TextChanged += (sender, args) => { tbLogin_TextBox_TextChanged(sender, args); };

            tbPassword = new ZklTextBox
            {
                Location = new Point(237, 164),
                Size     = new Size(146, 24),
                TabIndex = 2,
                TextBox  = { UseSystemPasswordChar = true }
            };

            lbInfo = new Label
            {
                BackColor = Color.Transparent,
                ForeColor = Color.Red,
                Location  = new Point(29, 20),
                Size      = new Size(414, 51),
                Text      = "Error",
                TextAlign = ContentAlignment.MiddleCenter
            };

            btnCancel = new BitmapButton
            {
                ButtonStyle  = FrameBorderRenderer.StyleType.DarkHive,
                DialogResult = DialogResult.Cancel,
                Location     = new Point(286, 255),
                Size         = new Size(97, 44),
                SoundType    = SoundPalette.SoundType.Click,
                Text         = "Cancel"
            };
            btnCancel.Click += btnCancel_Click;

            var label1 = new Label
            {
                AutoSize  = true,
                BackColor = Color.Transparent,
                Location  = new Point(112, 126),
                Size      = new Size(89, 18),
                Text      = "Login name:"
            };

            var label2 = new Label
            {
                AutoSize  = true,
                BackColor = Color.Transparent,
                Location  = new Point(121, 167),
                Size      = new Size(79, 18),
                Text      = "Password:"******"Zero-K Login/Register";
            Load         += LoginForm_Load;
            ResumeLayout(false);
            PerformLayout();

            tbLogin.Text = Program.Conf.LobbyPlayerName;
            if (string.IsNullOrEmpty(tbLogin.Text))
            {
                tbLogin.Text = Program.SteamHandler.SteamName;
                Program.SteamHandler.SteamHelper.SteamOnline += SteamApiOnSteamOnline;
            }
            tbPassword.Text = Program.Conf.LobbyPlayerPassword;

            tbLogin.TextBox.PreviewKeyDown    += onKeyPress;
            tbPassword.TextBox.PreviewKeyDown += onKeyPress;
        }
コード例 #30
0
        public ChatControl(string name) {
            InitializeComponent();

            if (this.IsInDesignMode()) return;

            var extras = new BitmapButton();
            extras.Text = "Extras";
            extras.Click += (s, e) => { 
                var contextMenu = ContextMenus.GetChannelContextMenu(this);
                contextMenu = LineDehighlighter(contextMenu, null);
                contextMenu.Show(extras, new Point(0, 0));
            };


            ChatBox.Controls.Add(extras);
            playerBox.BackColor = Config.BgColor;
            playerBox.ForeColor = Config.TextColor;
            playerBox_zklclick.AttachTo(playerBox);
            playerBox_zklclick.MouseClick += PlayerBox_MouseClick;

            playerSearchBox.BackColor = Config.BgColor;
            playerSearchBox.ForeColor = Config.TextColor;

            ChatBox.Font = Config.ChatFont; //make sure this is done before HistoryManager adds text, or text becomes black.

            Name = name;
            ChannelName = name;
            if (!DesignMode) HistoryManager.InsertLastLines(ChannelName, ChatBox);

            playerBox.IsSorted = true;
            var lookingGlass = new PictureBox { Width = 20, Height = 20, Image = ZklResources.search, SizeMode = PictureBoxSizeMode.CenterImage };
            searchBarContainer.Controls.Add(lookingGlass);
            Program.ToolTip.SetText(lookingGlass, "Enter name or country shortcut to find");

            Program.ToolTip.SetText(playerSearchBox, "Enter name or country shortcut to find");

            VisibleChanged += ChatControl_VisibleChanged;

            ChatBox.MouseUp += chatBox_MouseUp;
            ChatBox.MouseDown += chatBox_MouseDown;
            ChatBox.MouseMove += chatBox_MouseMove;
            ChatBox.FocusInputRequested += (s, e) => GoToSendBox();
            ChatBox.ChatBackgroundColor = TextColor.background; //same as Program.Conf.BgColor but TextWindow.cs need this.
            ChatBox.IRCForeColor = 14; //mirc grey. Unknown use

            Program.TasClient.ChannelUserAdded += client_ChannelUserAdded;
            Program.TasClient.ChannelUserRemoved += client_ChannelUserRemoved;
            Program.TasClient.UserStatusChanged += TasClient_UserStatusChanged;
//            Program.TasClient.ChannelUsersAdded += TasClient_ChannelUsersAdded;
            Program.TasClient.Said += client_Said;
            Program.TasClient.UserRemoved += TasClient_UserRemoved;
            Program.TasClient.ChannelTopicChanged += TasClient_ChannelTopicChanged;
            
            
            
            
            Program.SteamHandler.Voice.UserStartsTalking += VoiceOnUserChanged;
            Program.SteamHandler.Voice.UserStopsTalking += VoiceOnUserChanged;
            Program.SteamHandler.Voice.UserVoiceEnabled += VoiceOnUserChanged;

            Channel channel;
            Program.TasClient.JoinedChannels.TryGetValue(ChannelName, out channel);


            minuteTimer = new Timer(60000) { AutoReset = true };
            minuteTimer.Elapsed += (s, e) => {
                if (DateTime.Now.Minute == 0 && this.IsHandleCreated && !this.IsDisposed) this.Invoke(new Action(() => AddLine(new ChimeLine())));
            };
            minuteTimer.Start();


            //Topic Box that displays over the channel
            topicBox.IRCForeColor = 14; //mirc grey. Unknown use
            topicBox.ChatBackgroundColor = TextColor.topicBackground;
            topicBox.HorizontalScroll.Enabled = true;
            topicBox.BorderStyle = BorderStyle.FixedSingle;
            topicBox.VerticalScroll.Visible = false;
            topicBox.VerticalScroll.Enabled = false;
            topicBox.AutoSize = true;
            topicBox.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            topicBox.HideScroll = true;
            topicBox.ShowUnreadLine = false;
            topicBox.ShowHistory = false;

            //hide mappanel for normal chat operation. Overriden in BattleChatControl.cs 
            playerListMapSplitContainer.Panel2Collapsed = true;

            sendBox.CompleteWord += (word) => //autocomplete of username
                {
                    var w = word.ToLower();
                    IEnumerable <string> firstResult = playerBox.GetUserNames()
                        .Where(x => x.ToLower().StartsWith(w))
                        .Union(playerBox.GetUserNames().Where(x => x.ToLower().Contains(w)));
                    if (true)
                    {
                        ChatControl zkChatArea = Program.MainWindow.navigationControl.ChatTab.GetChannelControl("zk");
                        if (zkChatArea != null)
                        {
                            IEnumerable<string> extraResult = zkChatArea.playerBox.GetUserNames()
                                .Where(x => x.ToLower().StartsWith(w))
                                .Union(zkChatArea.playerBox.GetUserNames().Where(x => x.ToLower().Contains(w)));
                            firstResult = firstResult.Concat(extraResult); //Reference: http://stackoverflow.com/questions/590991/merging-two-ienumerablets
                        }
                    }
                    return firstResult;
                        
                };

            if (channel != null) foreach (var userName in Program.TasClient.JoinedChannels[ChannelName].Users.Keys) AddUser(userName);
        }
コード例 #31
0
ファイル: WndAppearance.cs プロジェクト: zdimension/phytestcs
        public WndAppearance(BaseObject obj, Vector2f pos)
            : base(obj, WndWidth, pos)
        {
            var wrapper = new ColorWrapper(() => obj.Color);

            var renderImg = new Image(WndWidth, SqSize + 2 * Margin, BackColor);

            var selector = new Canvas();

            selector.SizeLayout = new Layout2d(renderImg.Size.X, renderImg.Size.Y);
            selector.Clear(BackColor);

            Add(selector);

            Color  oldColor   = default;
            IntPtr oldPointer = default;

            var userChanging = false;

            var previewRect    = new VertexArray(PrimitiveType.Quads, 4);
            var previewOutline = new VertexArray(PrimitiveType.LineStrip, 5);

            Vector2f[] previewCorners =
            {
                new Vector2f(Margin + PreviewOffset,                Margin),
                new Vector2f(Margin + PreviewOffset + PreviewWidth, Margin),
                new Vector2f(Margin + PreviewOffset + PreviewWidth, Margin + SqSize),
                new Vector2f(Margin + PreviewOffset,                Margin + SqSize),
            };

            var hueSelector = new RectangleShape(new Vector2f(HueWidth, 4))
            {
                OutlineColor = SelectorOutline, OutlineThickness = 2f, FillColor = Color.Transparent,
                Origin       = new Vector2f(HueWidth / 2, 2)
            };

            var colorSelector = new RectangleShape(new Vector2f(8, 8))
            {
                OutlineColor = SelectorOutline, OutlineThickness = 2f, FillColor = Color.Transparent,
                Origin       = new Vector2f(4, 4)
            };

            wrapper.ValueChanged += delegate { UpdateSelector(); };

            void DrawSelector()
            {
                var tex = selector.RenderTexture();

                if (tex == null)
                {
                    return;
                }

                oldPointer = tex.CPointer;

                oldColor = wrapper.Value;

                const float fac = 1f / SqSize;

                selector.Clear(BackColor);

                for (uint y = 0; y < renderImg.Size.Y; y++)
                {
                    for (uint x = 0; x < renderImg.Size.X; x++)
                    {
                        renderImg.SetPixel(x, y, BackColor);
                    }
                }

                renderImg.Copy(HueImg, Margin, Margin);

                var hue = wrapper.H;

                for (uint y = 0; y < SqSize; y++)
                {
                    var v = y * fac;

                    for (uint x = 0; x < SqSize; x++)
                    {
                        var s = x * fac;

                        renderImg.SetPixel(Margin + Offset + x, Margin + y, new Hsva(hue, s, 1 - v, 1));
                    }
                }

                tex.Texture.Update(renderImg);

                hueSelector.Position = new Vector2f(
                    Margin + HueWidth / 2,
                    Margin + (float)((360 - wrapper.H) / HueFac));
                tex.Draw(hueSelector);

                colorSelector.Position = new Vector2f(
                    (float)(Margin + Offset + wrapper.S * SqSize),
                    (float)(Margin + wrapper.V * SqSize));
                tex.Draw(colorSelector);

                var col = wrapper.Value;

                previewRect[0] = new Vertex(previewCorners[0], col);
                previewRect[1] = new Vertex(previewCorners[1], col);
                previewRect[2] = new Vertex(previewCorners[2], col);
                previewRect[3] = new Vertex(previewCorners[3], col);
                tex.Draw(previewRect);

                col.A             = 255;
                previewOutline[0] = new Vertex(previewCorners[0], col);
                previewOutline[1] = new Vertex(previewCorners[1], col);
                previewOutline[2] = new Vertex(previewCorners[2], col);
                previewOutline[3] = new Vertex(previewCorners[3], col);
                previewOutline[4] = new Vertex(previewCorners[0], col);
                tex.Draw(previewOutline);
            }

            void UpdateSelector()
            {
                if (userChanging)
                {
                    return;
                }

                if (Mouse.IsButtonPressed(Mouse.Button.Left))
                {
                    userChanging = true;

                    var mpos = Mouse.GetPosition(Render.Window).F() - AbsolutePosition -
                               new Vector2f(0, Renderer.TitleBarHeight);
                    if (selector.MouseOnWidget(mpos))
                    {
                        var(x, y) = (mpos - selector.Position).I();
                        x        -= Margin;
                        y        -= Margin;
                        if (x >= 0 && x <= TotalSize && y >= 0 && y < 140)
                        {
                            if (x <= HueWidth)
                            {
                                wrapper.H = y * HueFac;
                            }
                            else if (x >= Offset)
                            {
                                wrapper.Value = new Color(renderImg.GetPixel(Margin + (uint)x, Margin + (uint)y))
                                {
                                    A = wrapper.A
                                }
                            }
                            ;
                        }
                    }

                    userChanging = false;
                }

                if (wrapper.Value != oldColor || selector.RenderTexture()?.CPointer != oldPointer)
                {
                    DrawSelector();
                }
            }

            Ui.Drawn += UpdateSelector;

            Closed += delegate { Ui.Drawn -= UpdateSelector; };

            Add(new NumberField <double>(0, 360, () => wrapper.H, unit: "°", inline: true, round: 0));
            Add(new NumberField <double>(0, 100, () => wrapper.S, unit: "%",
                                         factor: 100, inline: true, round: 0));
            Add(new NumberField <double>(0, 100, () => wrapper.V, unit: "%",
                                         factor: 100, inline: true, round: 0));

            Add(new NumberField <double>(0, 100, () => wrapper.Ad, unit: "%",
                                         factor: 100, inline: true, round: 0));

            Add(new NumberField <byte>(0, 255, () => wrapper.R, deci: false, inline: true));
            Add(new NumberField <byte>(0, 255, () => wrapper.G, deci: false, inline: true));
            Add(new NumberField <byte>(0, 255, () => wrapper.B, deci: false, inline: true));

            var btnRandom = new BitmapButton(L["Random color"])
            {
                Image = new Texture("icons/small/random.png")
            };

            btnRandom.Clicked += delegate
            {
                wrapper.Value = new Color(Palette.Default.ColorRange.RandomColor())
                {
                    A = wrapper.A
                };
            };

            Add(btnRandom);

            if (obj is PhysicalObject phy)
            {
                Add(new NumberField <float>(30, 2000, () => phy.ColorFilterWidth, log: true)
                {
                    RightValue = float.PositiveInfinity
                });

                var absorbanceImg = new Image(WndWidth, AbsorbHeight + 2 * Margin, BackColor);

                var absorbance = new Canvas();
                absorbance.SizeLayout = new Layout2d(absorbanceImg.Size.X, absorbanceImg.Size.Y);
                absorbance.Clear(BackColor);

                var txtA = new Text("A", Ui.FontMono, AbsorbTextSize)
                {
                    FillColor = Color.White, Scale = new Vector2f(1, -1)
                }.CenterOriginText();
                var txtH = new Text("H", Ui.FontMono, AbsorbTextSize)
                {
                    FillColor = Color.White, Scale = new Vector2f(1, -1)
                }.CenterOriginText();

                Add(absorbance);

                IntPtr oldPointerAbs = default;

                var oldCol   = new Hsva(-1, -1, -1, -1);
                var oldWidth = -1f;

                void DrawAbsorbance()
                {
                    var tex = absorbance.RenderTexture();

                    if (tex == null)
                    {
                        return;
                    }

                    oldCol        = wrapper.ValueHsv;
                    oldWidth      = phy.ColorFilterWidth;
                    oldPointerAbs = tex.CPointer;

                    absorbance.Clear(BackColor);

                    absorbanceImg.Copy(HueImgHoriz, Margin + AbsorbTextSize, Margin + AbsorbTextSize);

                    var hsva   = phy.ColorHsva;
                    var objHue = hsva.H;
                    var objSat = hsva.S;
                    var alphaD = 1 - hsva.A;

                    for (uint x = 0; x < HueWidthHoriz; x++)
                    {
                        var transmittance = (int)((1 - alphaD * Transmittance(x * HueFacHoriz, objHue, phy.ColorFilterWidth, objSat)) *
                                                  HueHeightHoriz) + 1;
                        for (uint y = 0; y < transmittance; y++)
                        {
                            absorbanceImg.SetPixel(Margin + AbsorbTextSize + x, Margin + AbsorbTextSize + y, BackColor);
                        }
                    }

                    tex.Texture.Update(absorbanceImg);

                    var hx = (float)(Margin + AbsorbTextSize + objHue / HueFacHoriz);
                    var ay = (float)(Margin - 1 + alphaD * HueHeightHoriz);

                    tex.Draw(new[]
                    {
                        new Vertex(new Vector2f(hx, Margin), Color.White),
                        new Vertex(new Vector2f(hx, Margin + HueHeightHoriz + 2), Color.White),

                        new Vertex(new Vector2f(Margin, ay), Color.White),
                        new Vertex(new Vector2f(WndWidth - Margin, ay), Color.White),
                    }, PrimitiveType.Lines);

                    txtA.Position = new Vector2f(Margin + AbsorbTextSize / 2, ay + AbsorbTextSize);
                    tex.Draw(txtA);
                    txtH.Position = new Vector2f(hx, AbsorbHeight - Margin + AbsorbTextSize / 2);
                    tex.Draw(txtH);
                }

                void UpdateAbsorbance()
                {
                    if (wrapper.ValueHsv != oldCol || phy.ColorFilterWidth != oldWidth ||
                        absorbance.RenderTexture()?.CPointer != oldPointerAbs)
                    {
                        DrawAbsorbance();
                    }
                }

                Ui.Drawn += UpdateAbsorbance;

                Closed += delegate { Ui.Drawn -= UpdateAbsorbance; };

                Add(new CheckField(() => phy.Appearance.Borders, onChanged: () => { phy.UpdateOutline(); }));
                Add(new CheckField(() => phy.Appearance.OpaqueBorders, onChanged: () => { phy.UpdateOutline(); }));

                if (phy is Circle circle)
                {
                    Add(new CheckField(() => circle.Appearance.DrawCircleCakes));
                    Add(new CheckField(() => circle.Appearance.Protractor));
                }

                if (phy is Box box)
                {
                    Add(new CheckField(() => box.Appearance.Ruler));
                }
            }

            Show();
        }
    }