コード例 #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
        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() ;
        }
コード例 #3
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;
        }
コード例 #4
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-mnenonics, 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);
        }
コード例 #5
0
 private void CreateButton()
 {
     button = new BitmapButton();
     button.BitmapEnabled  = ResourceHelper.LoadAssemblyResourceBitmap("Images.refresh.png");
     button.BitmapPushed   = ResourceHelper.LoadAssemblyResourceBitmap("Images.refreshPushed.png");
     button.BitmapSelected = ResourceHelper.LoadAssemblyResourceBitmap("Images.refreshSelected.png");
     button.Anchor         = AnchorStyles.Right;
     button.Height         = 16;
     button.Width          = BUTTON_WIDTH;
     button.Cursor         = Cursors.Hand;
     button.Left           = Width - button.Width - BUTTON_RIGHT_OFFSET;
     button.AccessibleName = Res.Get(StringId.CategoryRefreshList);
     button.ToolTip        = Res.Get(StringId.CategoryRefreshList);
     Controls.Add(button);
 }
コード例 #6
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);

        }
コード例 #7
0
 private void CreateButton()
 {
     button = new BitmapButton();
     button.BitmapEnabled = ResourceHelper.LoadAssemblyResourceBitmap("Images.refresh.png");
     button.BitmapPushed = ResourceHelper.LoadAssemblyResourceBitmap("Images.refreshPushed.png");
     button.BitmapSelected = ResourceHelper.LoadAssemblyResourceBitmap("Images.refreshSelected.png");
     button.Anchor = AnchorStyles.Right;
     button.Height = 16;
     button.Width = BUTTON_WIDTH;
     button.Cursor = Cursors.Hand;
     button.Left = Width - button.Width - BUTTON_RIGHT_OFFSET;
     button.AccessibleName = Res.Get(StringId.CategoryRefreshList);
     button.ToolTip = Res.Get(StringId.CategoryRefreshList);
     Controls.Add(button);
 }
コード例 #8
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 = true;
            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), 0);
            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);
            }
        }
コード例 #9
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);

        }
コード例 #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.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);

        }