当前位置: 首页>>代码示例>>C#>>正文


C# VisualStyleRenderer.SetParameters方法代码示例

本文整理汇总了C#中System.Windows.Forms.VisualStyles.VisualStyleRenderer.SetParameters方法的典型用法代码示例。如果您正苦于以下问题:C# VisualStyleRenderer.SetParameters方法的具体用法?C# VisualStyleRenderer.SetParameters怎么用?C# VisualStyleRenderer.SetParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.VisualStyles.VisualStyleRenderer的用法示例。


在下文中一共展示了VisualStyleRenderer.SetParameters方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WndProc

 protected override void WndProc(ref Message m)
 {
     //if native updown is destroyed we need release our hook
     if (m.Msg == NativeMethods.WM_DESTROY || m.Msg == NativeMethods.WM_NCDESTROY)
         this.ReleaseHandle();
     else if (m.Msg == NativeMethods.WM_WINDOWPOSCHANGING)
     {
         //When a scroller position is changed we should remember that new position.
         NativeMethods.WINDOWPOS wp = (NativeMethods.WINDOWPOS)m.GetLParam(typeof(NativeMethods.WINDOWPOS));
         this.x = wp.x;
     }
     else if (m.Msg == NativeMethods.WM_MOUSEMOVE && parentControl.lastHotIndex > 0 &&
         parentControl.lastHotIndex != parentControl.SelectedIndex)
     {
         //redrawing a former hot tab as normal one
         using (Graphics context = Graphics.FromHwnd(parentControl.Handle))
         {
             VisualStyleRenderer rend = new VisualStyleRenderer(VisualStyleElement.Tab.TabItem.Normal);
             parentControl.DrawTabItem(context, parentControl.lastHotIndex, parentControl.GetTabRect(parentControl.lastHotIndex), rend);
             if (parentControl.lastHotIndex - parentControl.SelectedIndex == 1)
             {
                 Rectangle selRect = parentControl.GetTabRect(parentControl.SelectedIndex);
                 selRect.Inflate(2, 2);
                 rend.SetParameters(rend.Class, rend.Part, (int)TabItemState.Selected);
                 parentControl.DrawTabItem(context, parentControl.SelectedIndex, selRect, rend);
             }
         }
     }
     else if (m.Msg == NativeMethods.WM_LBUTTONDOWN)
     {
         Rectangle invalidRect = parentControl.GetTabRect(parentControl.SelectedIndex);
         invalidRect.X = 0; invalidRect.Width = 2;
         invalidRect.Inflate(0, 2);
         parentControl.Invalidate(invalidRect);
     }
     base.WndProc(ref m);
 }
开发者ID:chutinhha,项目名称:private-hrm,代码行数:37,代码来源:TabControlEx.NativeUpDown.cs

示例2: DrawCustomTabControl

        /// <summary>
        /// Draws our tab control.
        /// </summary>
        /// <param name="g">The <see cref="System.Drawing.Graphics"/> object used to draw tab control.</param>
        /// <param name="clipRect">The <see cref="System.Drawing.Rectangle"/> that specifies clipping rectangle
        /// of the control.</param>
        private void DrawCustomTabControl(Graphics g, Rectangle clipRect)
        {
            /* In this method we draw only those parts of the control which intersects with the
             * clipping rectangle. It's some kind of optimization.*/
            if (!this.Visible) return;

            //selected tab index and rectangle
            int iSel = this.SelectedIndex;
            Rectangle selRect = iSel != -1 ? this.GetTabRect(iSel) : Rectangle.Empty;

            Rectangle rcPage = this.ClientRectangle;
            //correcting page rectangle
            switch (this.Alignment)
            {
                case TabAlignment.Top:
                    {
                        int trunc = selRect.Height * this.RowCount + 2;
                        rcPage.Y += trunc; rcPage.Height -= trunc;
                    } break;
                case TabAlignment.Bottom: rcPage.Height -= (selRect.Height + XPTabControl.sAdjHeight) * this.RowCount; break;
            }

            //draw page itself
            if (rcPage.IntersectsWith(clipRect)) TabRenderer.DrawTabPage(g, rcPage);

            int tabCount = this.TabCount;
            if (tabCount == 0) return;

            //drawing unselected tabs
            this.lastHotIndex = HitTest();//hot tab
            VisualStyleRenderer tabRend = new VisualStyleRenderer(VisualStyleElement.Tab.TabItem.Normal);
            for (int iTab = 0; iTab < tabCount; iTab++)
                if (iTab != iSel)
                {
                    Rectangle tabRect = this.GetTabRect(iTab);
                    if (tabRect.Right >= 3 && tabRect.IntersectsWith(clipRect))
                    {
                        TabItemState state = iTab == this.lastHotIndex ? TabItemState.Hot : TabItemState.Normal;
                        tabRend.SetParameters(tabRend.Class, tabRend.Part, (int)state);
                        DrawTabItem(g, iTab, tabRect, tabRend);
                    }
                }

            /* Drawing selected tab. We'll also increase selected tab's rectangle. It should be a little
             * bigger than other tabs.*/
            selRect.Inflate(2, 2);
            if (iSel != -1 && selRect.IntersectsWith(clipRect))
            {
                tabRend.SetParameters(tabRend.Class, tabRend.Part, (int)TabItemState.Selected);
                DrawTabItem(g, iSel, selRect, tabRend);
            }
        }
开发者ID:svn2github,项目名称:eztx,代码行数:58,代码来源:XPTabControl.cs

示例3: TriStateTreeView

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="TriStateTreeView"/> class.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public TriStateTreeView()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			if (Application.RenderWithVisualStyles)
			{
				using (Bitmap bmp = new Bitmap(m_TriStateImages.ImageSize.Width,
					m_TriStateImages.ImageSize.Height))
				{
					Rectangle rc = new Rectangle(0, 0, bmp.Width, bmp.Height);
					using (Graphics graphics = Graphics.FromImage(bmp))
					{
						VisualStyleRenderer renderer =
							new VisualStyleRenderer(VisualStyleElement.Button.CheckBox.CheckedDisabled);
						renderer.DrawBackground(graphics, rc, rc);
						m_TriStateImages.Images[0] = bmp;

						renderer.SetParameters(VisualStyleElement.Button.CheckBox.UncheckedNormal);
						renderer.DrawBackground(graphics, rc, rc);
						m_TriStateImages.Images[1] = bmp;

						renderer.SetParameters(VisualStyleElement.Button.CheckBox.CheckedNormal);
						renderer.DrawBackground(graphics, rc, rc);
						m_TriStateImages.Images[2] = bmp;
					}
				}
			}

			int index = GetCheckImageIndex(CheckState.Unchecked);
			ImageList = m_TriStateImages;
			ImageIndex = index;
			SelectedImageIndex = index;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:39,代码来源:TriStateTreeView.cs

示例4: ManagedWindowDrawTitleBarAndBorders

		protected override Rectangle ManagedWindowDrawTitleBarAndBorders (Graphics dc, Rectangle clip, InternalWindowManager wm)
		{
			if (!render_non_client_areas)
				return base.ManagedWindowDrawTitleBarAndBorders (dc, clip, wm);
			VisualStyleElement title_bar_element = ManagedWindowGetTitleBarVisualStyleElement (wm);
			VisualStyleElement left_border_element;
			VisualStyleElement right_border_element;
			VisualStyleElement bottom_border_element;
			ManagedWindowGetBorderVisualStyleElements (wm, out left_border_element, out right_border_element, out bottom_border_element);
			if (!VisualStyleRenderer.IsElementDefined (title_bar_element) ||
				(!wm.IsMinimized && (
				!VisualStyleRenderer.IsElementDefined (left_border_element) ||
				!VisualStyleRenderer.IsElementDefined (right_border_element) ||
				!VisualStyleRenderer.IsElementDefined (bottom_border_element))))
				return base.ManagedWindowDrawTitleBarAndBorders (dc, clip, wm);
			VisualStyleRenderer renderer = new VisualStyleRenderer (title_bar_element);
			Rectangle title_bar_rectangle = ManagedWindowGetTitleBarRectangle (wm);
			renderer.DrawBackground (dc, title_bar_rectangle, clip);
			if (!wm.IsMinimized) {
				int border_width = ManagedWindowBorderWidth (wm);
				renderer.SetParameters (left_border_element);
				renderer.DrawBackground (dc, new Rectangle (
					0,
					title_bar_rectangle.Bottom,
					border_width,
					wm.Form.Height - title_bar_rectangle.Bottom
					), clip);
				renderer.SetParameters (right_border_element);
				renderer.DrawBackground (dc, new Rectangle (
					wm.Form.Width - border_width,
					title_bar_rectangle.Bottom,
					border_width,
					wm.Form.Height - title_bar_rectangle.Bottom
					), clip);
				renderer.SetParameters (bottom_border_element);
				renderer.DrawBackground (dc, new Rectangle (
					0,
					wm.Form.Height - border_width,
					wm.Form.Width,
					border_width
					), clip);
			}
			return title_bar_rectangle;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:44,代码来源:ThemeVisualStyles.cs

示例5: CalcSize

 private static void CalcSize(Graphics g)
 {
     if (VisualStyleInformation.IsEnabledByUser) {
         VisualStyleRenderer renderer = new VisualStyleRenderer(_elementTop.VSElement);
         _markSizeTopBottom = renderer.GetPartSize(g, ThemeSizeType.True);
         renderer.SetParameters(_elementLeft.VSElement);
         _markSizeLeftRight = renderer.GetPartSize(g, ThemeSizeType.True);
     }
     else {
         _markSizeTopBottom = new Size(16, 16); //���̃T�C�Y�ł͐ݒ�ɂ���Ă̓_������
         _markSizeLeftRight = new Size(16, 16);
     }
 }
开发者ID:VirusFree,项目名称:Poderosa,代码行数:13,代码来源:PaneSplitter.cs

示例6: SetLayout

		private void SetLayout()
		{
			if (isMin6 && Application.RenderWithVisualStyles)
			{
				VisualStyleRenderer theme;
				using (Graphics g = this.CreateGraphics())
				{
					// Back button
					theme = new VisualStyleRenderer(VisualStyleElementEx.Navigation.BackButton.Normal);
					Size bbSize = theme.GetPartSize(g, ThemeSizeType.Draw);

					// Title
					theme.SetParameters(VisualStyleElementEx.AeroWizard.TitleBar.Active);
					titleBar.Height = Math.Max(theme.GetMargins2(g, MarginProperty.ContentMargins).Top, bbSize.Height + 2);
					titleBar.ColumnStyles[0].Width = bbSize.Width + 4F;
					titleBar.ColumnStyles[1].Width = titleImageIcon != null ? titleImageList.ImageSize.Width + 4F : 0;
					backButton.Size = bbSize;

					// Header
					theme.SetParameters(VisualStyleElementEx.AeroWizard.HeaderArea.Normal);
					headerLabel.Margin = theme.GetMargins2(g, MarginProperty.ContentMargins);
					headerLabel.ForeColor = theme.GetColor(ColorProperty.TextColor);

					// Content
					theme.SetParameters(VisualStyleElementEx.AeroWizard.ContentArea.Normal);
					this.BackColor = theme.GetColor(ColorProperty.FillColor);
					Padding cp = theme.GetMargins2(g, MarginProperty.ContentMargins);
					contentArea.ColumnStyles[0].Width = cp.Left;
					contentArea.RowStyles[1].Height = cp.Bottom;

					// Command
					theme.SetParameters(VisualStyleElementEx.AeroWizard.CommandArea.Normal);
					cp = theme.GetMargins2(g, MarginProperty.ContentMargins);
					commandArea.RowStyles[0].Height = cp.Top;
					commandArea.RowStyles[2].Height = cp.Bottom;
					commandArea.ColumnStyles[2].Width = contentArea.ColumnStyles[2].Width = cp.Right;
				}
			}
			else
			{
				backButton.Size = new Size(Properties.Resources.BackBtnStrip.Width, Properties.Resources.BackBtnStrip.Height / 4);
			}
		}
开发者ID:JohnThomson,项目名称:testBloom,代码行数:43,代码来源:WizardControl.cs

示例7: OnRenderSplitButtonBackground

		public override void OnRenderSplitButtonBackground (ToolStripItemRenderEventArgs e)
		{
			if (!ThemeVisualStyles.RenderClientAreas) {
				base.OnRenderSplitButtonBackground (e);
				return;
			}
			VisualStyleElement element, drop_down_element;
			if (IsDisabled (e.Item)) {
				element = VisualStyleElement.ToolBar.SplitButton.Disabled;
				drop_down_element = VisualStyleElement.ToolBar.SplitButtonDropDown.Disabled;;
			} else if (IsPressed (e.Item)) {
				element = VisualStyleElement.ToolBar.SplitButton.Pressed;
				drop_down_element = VisualStyleElement.ToolBar.SplitButtonDropDown.Pressed;
			} else if (IsChecked (e.Item))
				if (IsHot (e.Item)) {
					element = VisualStyleElement.ToolBar.SplitButton.HotChecked;
					drop_down_element = VisualStyleElement.ToolBar.SplitButtonDropDown.HotChecked;
				} else {
					element = VisualStyleElement.ToolBar.Button.Checked;
					drop_down_element = VisualStyleElement.ToolBar.SplitButtonDropDown.Checked;
				}
			else if (IsHot (e.Item)) {
				element = VisualStyleElement.ToolBar.SplitButton.Hot;
				drop_down_element = VisualStyleElement.ToolBar.SplitButtonDropDown.Hot;
			} else {
				element = VisualStyleElement.ToolBar.SplitButton.Normal;
				drop_down_element = VisualStyleElement.ToolBar.SplitButtonDropDown.Normal;
			}
			if (!VisualStyleRenderer.IsElementDefined (element) ||
				!VisualStyleRenderer.IsElementDefined (drop_down_element)) {
				base.OnRenderSplitButtonBackground (e);
				return;
			}
			ToolStripSplitButton tool_strip_split_button = (ToolStripSplitButton)e.Item;
			VisualStyleRenderer renderer = new VisualStyleRenderer (element);
			renderer.DrawBackground (e.Graphics, tool_strip_split_button.ButtonBounds);
			renderer.SetParameters (drop_down_element);
			renderer.DrawBackground (e.Graphics, tool_strip_split_button.DropDownButtonBounds);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:39,代码来源:ToolStripPainter.cs

示例8: OnPaint

 protected override void OnPaint(PaintEventArgs e)
 {
     int height = base.ClientSize.Height / 2;
     if (Application.RenderWithVisualStyles)
     {
         VisualStyleRenderer renderer = new VisualStyleRenderer((this.mouseOver == UpDownBase.ButtonID.Up) ? VisualStyleElement.Spin.Up.Hot : VisualStyleElement.Spin.Up.Normal);
         if (!base.Enabled)
         {
             renderer.SetParameters(VisualStyleElement.Spin.Up.Disabled);
         }
         else if (this.pushed == UpDownBase.ButtonID.Up)
         {
             renderer.SetParameters(VisualStyleElement.Spin.Up.Pressed);
         }
         renderer.DrawBackground(e.Graphics, new Rectangle(0, 0, 0x10, height));
         if (!base.Enabled)
         {
             renderer.SetParameters(VisualStyleElement.Spin.Down.Disabled);
         }
         else if (this.pushed == UpDownBase.ButtonID.Down)
         {
             renderer.SetParameters(VisualStyleElement.Spin.Down.Pressed);
         }
         else
         {
             renderer.SetParameters((this.mouseOver == UpDownBase.ButtonID.Down) ? VisualStyleElement.Spin.Down.Hot : VisualStyleElement.Spin.Down.Normal);
         }
         renderer.DrawBackground(e.Graphics, new Rectangle(0, height, 0x10, height));
     }
     else
     {
         ControlPaint.DrawScrollButton(e.Graphics, new Rectangle(0, 0, 0x10, height), ScrollButton.Up, (this.pushed == UpDownBase.ButtonID.Up) ? ButtonState.Pushed : (base.Enabled ? ButtonState.Normal : ButtonState.Inactive));
         ControlPaint.DrawScrollButton(e.Graphics, new Rectangle(0, height, 0x10, height), ScrollButton.Down, (this.pushed == UpDownBase.ButtonID.Down) ? ButtonState.Pushed : (base.Enabled ? ButtonState.Normal : ButtonState.Inactive));
     }
     if (height != ((base.ClientSize.Height + 1) / 2))
     {
         using (Pen pen = new Pen(this.parent.BackColor))
         {
             Rectangle clientRectangle = base.ClientRectangle;
             e.Graphics.DrawLine(pen, clientRectangle.Left, clientRectangle.Bottom - 1, clientRectangle.Right - 1, clientRectangle.Bottom - 1);
         }
     }
     base.OnPaint(e);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:44,代码来源:UpDownBase.cs

示例9: OnPaint

	    protected override void OnPaint(PaintEventArgs e)
		{
			var clientRect = this.ClientRectangle;
			var fillRect = clientRect;
			fillRect.Width = (int)(_value / 100.0 * clientRect.Width);
			try
			{
				// draw background
				var renderer = new VisualStyleRenderer(VisualStyleElement.ProgressBar.Bar.Normal);
				renderer.SetParameters(VsStyles.ProgressBar.Progress,
					VsStyles.ProgressBar.ProgressParts.PP_BAR,
					VsStyles.ProgressBar.FillStates.PBFS_NORMAL);
				renderer.DrawBackground(e.Graphics, this.ClientRectangle);

				// draw filled portion
				renderer.SetParameters(VsStyles.ProgressBar.Progress,
				   VsStyles.ProgressBar.ProgressParts.PP_FILL, (int)_fillState);
				renderer.DrawBackground(e.Graphics, fillRect);
			}
			catch(Exception)
			{
				// the VisualStyles stuff can fail when the OS is < Win7, in which case
				// draw a very basic progress bar manually
				e.Graphics.DrawRectangle(Pens.DarkGray, 0, 0, clientRect.Width - 1, clientRect.Height - 1);
				e.Graphics.FillRectangle(GetStateBrush(), 1, 1,
					Math.Min(fillRect.Width, clientRect.Width - 2), clientRect.Height - 2);
			}

			base.OnPaint(e);
		}
开发者ID:nhannd,项目名称:Xian,代码行数:30,代码来源:Meter.cs

示例10: OnPaint

		protected override void OnPaint(PaintEventArgs e)
		{
			base.OnPaint(e);

			const int thumbPadding = 2;
			const int trackPadding = 2;

			var left = ClientRectangle.Left;
			var top = ClientRectangle.Top;
			var width = ClientRectangle.Width;
			var height = ClientRectangle.Height;
			var cursor = PointToClient(MousePosition);

			// paint focus rectangle
			if (ShowFocusRectangle && Focused) ControlPaint.DrawFocusRectangle(e.Graphics, ClientRectangle);

			if (!IsLeftMouseButtonDown()) _thumbDragging = false;

			// compute object bounds
			if (Orientation == Orientation.Horizontal)
			{
				_trackBounds = new Rectangle(left + trackPadding, top + height/2 - _trackSize/2, width - 2*trackPadding, _trackSize);
				_thumbBounds = new Rectangle(ValueToPoint(Value).X - _thumbSize/2, top + thumbPadding, _thumbSize, height - 2*thumbPadding);
			}
			else
			{
				_trackBounds = new Rectangle(left + width/2 - _trackSize/2, top + trackPadding, _trackSize, height - 2*trackPadding);
				_thumbBounds = new Rectangle(left + thumbPadding, ValueToPoint(Value).Y - _thumbSize/2, width - 2*thumbPadding, _thumbSize);
			}

			if (System.Windows.Forms.Application.RenderWithVisualStyles)
			{
				if (Orientation == Orientation.Horizontal)
				{
					// paint track
					var renderer = new VisualStyleRenderer(VisualStyleElement.TrackBar.Track.Normal);
					renderer.DrawBackground(e.Graphics, _trackBounds);

					// paint thumb
					if (!Enabled)
						renderer.SetParameters(VisualStyleElement.TrackBar.Thumb.Disabled);
					else if (_thumbDragging)
						renderer.SetParameters(VisualStyleElement.TrackBar.Thumb.Pressed);
					else if (!_thumbBounds.Contains(cursor))
						renderer.SetParameters(Focused ? VisualStyleElement.TrackBar.Thumb.Focused : VisualStyleElement.TrackBar.Thumb.Normal);
					else
						renderer.SetParameters(IsLeftMouseButtonDown() ? VisualStyleElement.TrackBar.Thumb.Pressed : VisualStyleElement.TrackBar.Thumb.Hot);
					renderer.DrawBackground(e.Graphics, _thumbBounds);
				}
				else
				{
					// paint track
					var renderer = new VisualStyleRenderer(VisualStyleElement.TrackBar.TrackVertical.Normal);
					renderer.DrawBackground(e.Graphics, _trackBounds);

					// paint thumb
					if (!Enabled)
						renderer.SetParameters(VisualStyleElement.TrackBar.ThumbVertical.Disabled);
					else if (_thumbDragging)
						renderer.SetParameters(VisualStyleElement.TrackBar.ThumbVertical.Pressed);
					else if (!_thumbBounds.Contains(cursor))
						renderer.SetParameters(Focused ? VisualStyleElement.TrackBar.ThumbVertical.Focused : VisualStyleElement.TrackBar.ThumbVertical.Normal);
					else
						renderer.SetParameters(IsLeftMouseButtonDown() ? VisualStyleElement.TrackBar.ThumbVertical.Pressed : VisualStyleElement.TrackBar.ThumbVertical.Hot);
					renderer.DrawBackground(e.Graphics, _thumbBounds);
				}
			}
			else
			{
				// paint track
				ControlPaint.DrawBorder3D(e.Graphics, _trackBounds, Border3DStyle.Sunken);

				// paint thumb
				if (!Enabled)
					ControlPaint.DrawButton(e.Graphics, _thumbBounds, ButtonState.Inactive);
				else
					ControlPaint.DrawButton(e.Graphics, _thumbBounds, ButtonState.Normal);
			}
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:79,代码来源:SliderBar.cs

示例11: OnPaint

            /// <include file='doc\UpDownBase.uex' path='docs/doc[@for="UpDownBase.UpDownButtons.OnPaint"]/*' />
            /// <devdoc>
            ///     Handles painting the buttons on the control.
            ///
            /// </devdoc>
            protected override void OnPaint(PaintEventArgs e) {
                int half_height = ClientSize.Height / 2;

                /* Draw the up and down buttons */

                if (Application.RenderWithVisualStyles) {
                    VisualStyleRenderer vsr = new VisualStyleRenderer(mouseOver == ButtonID.Up ? VisualStyleElement.Spin.Up.Hot : VisualStyleElement.Spin.Up.Normal);

                    if (!Enabled) {
                        vsr.SetParameters(VisualStyleElement.Spin.Up.Disabled);
                    }
                    else if (pushed == ButtonID.Up) {
                        vsr.SetParameters(VisualStyleElement.Spin.Up.Pressed);
                    }

                    vsr.DrawBackground(e.Graphics, new Rectangle(0, 0, DefaultButtonsWidth, half_height));

                    if (!Enabled) {
                        vsr.SetParameters(VisualStyleElement.Spin.Down.Disabled);
                    }
                    else if (pushed == ButtonID.Down) {
                        vsr.SetParameters(VisualStyleElement.Spin.Down.Pressed);
                    }
                    else {
                        vsr.SetParameters(mouseOver == ButtonID.Down ? VisualStyleElement.Spin.Down.Hot : VisualStyleElement.Spin.Down.Normal);
                    }

                    vsr.DrawBackground(e.Graphics, new Rectangle(0, half_height, DefaultButtonsWidth, half_height));
                }
                else {
                    ControlPaint.DrawScrollButton(e.Graphics,
                                                  new Rectangle(0, 0, DefaultButtonsWidth, half_height),
                                                  ScrollButton.Up,
                                                  pushed == ButtonID.Up ? ButtonState.Pushed : (Enabled ? ButtonState.Normal : ButtonState.Inactive));

                    ControlPaint.DrawScrollButton(e.Graphics,
                                                  new Rectangle(0, half_height, DefaultButtonsWidth, half_height),
                                                  ScrollButton.Down,
                                                  pushed == ButtonID.Down ? ButtonState.Pushed : (Enabled ? ButtonState.Normal : ButtonState.Inactive));
                }

                if (half_height != (ClientSize.Height + 1) / 2) {
                    // When control has odd height, a line needs to be drawn below the buttons with the backcolor.
                    using (Pen pen = new Pen(this.parent.BackColor)) {
                        Rectangle clientRect = ClientRectangle;
                        e.Graphics.DrawLine(pen, clientRect.Left, clientRect.Bottom - 1, clientRect.Right - 1, clientRect.Bottom - 1);
                    }
                }

                base.OnPaint(e); // raise paint event, just in case this inner class goes public some day
            }
开发者ID:JianwenSun,项目名称:cc,代码行数:56,代码来源:UpDownBase.cs

示例12: OnPaint

            protected override void OnPaint(PaintEventArgs e)
            {
                if (Application.RenderWithVisualStyles)
                {
                    VisualStyleRenderer vsr;

                    // ReSharper disable AssignNullToNotNullAttribute
                    if (IsUp)
                    {
                        vsr = new VisualStyleRenderer(
                            _captured
                                ? VisualStyleElement.Spin.Up.Hot
                                : VisualStyleElement.Spin.Up.Normal);

                        if (!Enabled)
                            vsr.SetParameters(VisualStyleElement.Spin.Up.Disabled);
                        else if (_pushed)
                            vsr.SetParameters(VisualStyleElement.Spin.Up.Pressed);
                    }
                    else
                    {
                        vsr = new VisualStyleRenderer(
                            _captured
                                ? VisualStyleElement.Spin.Down.Hot
                                : VisualStyleElement.Spin.Down.Normal);

                        if (!Enabled)
                            vsr.SetParameters(VisualStyleElement.Spin.Down.Disabled);
                        else if (_pushed)
                            vsr.SetParameters(VisualStyleElement.Spin.Down.Pressed);
                    }
                    // ReSharper restore AssignNullToNotNullAttribute

                    vsr.DrawBackground(e.Graphics, new Rectangle(0, 0, Width, Height));
                }
                else
                {
                    ControlPaint.DrawScrollButton(
                        e.Graphics,
                        new Rectangle(0, 0, Width, Height),
                        IsUp ? ScrollButton.Up : ScrollButton.Down,
                        _pushed
                            ? ButtonState.Pushed
                            : (Enabled
                                ? ButtonState.Normal
                                : ButtonState.Inactive));
                }
            }
开发者ID:billings7,项目名称:EscherTilier,代码行数:48,代码来源:UpDownButtons.cs

示例13: OnRenderItemCheck

        protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
        {
            if (e.Item.IsOnDropDown && IsSupported)
            {

                var renderer = new VisualStyleRenderer("menu", 12, e.Item.Enabled ? 2 : 1);

                var bounds = new Rectangle(e.Item.ContentRectangle.X + 1, 0, e.Item.Bounds.Height, e.Item.Bounds.Height);

                if (e.Item.RightToLeft == RightToLeft.Yes)
                    bounds = new Rectangle(e.ToolStrip.ClientSize.Width - bounds.X - bounds.Width, bounds.Y, bounds.Width, bounds.Height);

                renderer.DrawBackground(e.Graphics, bounds);

                var imageRectangle = e.ImageRectangle;

                imageRectangle.X = bounds.X + bounds.Width / 2 - imageRectangle.Width / 2;
                imageRectangle.Y = bounds.Y + bounds.Height / 2 - imageRectangle.Height / 2;

                renderer.SetParameters("menu", 11, e.Item.Enabled ? 1 : 2);

                renderer.DrawBackground(e.Graphics, imageRectangle);

            }
            else
            {
                base.OnRenderItemCheck(e);
            }
        }
开发者ID:InoMurko,项目名称:win-sshfs,代码行数:29,代码来源:ContextMenuStripThemedRenderer.cs

示例14: OnPaint

        protected override void OnPaint(PaintEventArgs e)
        {
            // Draw the background

            _ownerPropertyEnum.Property.ParentGrid.DrawManager.DrawPropertyValueBackground(e.Graphics,
                ClientRectangle, _ownerPropertyEnum);

            // Draw the combobox arrow

            Rectangle buttonRect = GetButtonRect(e.Graphics);

            if (Application.RenderWithVisualStyles)
            {
                VisualStyleRenderer renderer1 = new VisualStyleRenderer(_mouseOver ? VisualStyleElement.ComboBox.DropDownButton.Hot : VisualStyleElement.ComboBox.DropDownButton.Normal);
                if (_pushed)
                    renderer1.SetParameters(VisualStyleElement.ComboBox.DropDownButton.Pressed);

                renderer1.DrawBackground(e.Graphics, buttonRect);
            }
            else
            {
                ControlPaint.DrawComboButton(e.Graphics, buttonRect, _mouseOver ? ButtonState.Pushed : ButtonState.Normal);
            }

            if (Focused && (_ownerPropertyEnum.Property.InPlaceCtrlInAction == null))
            {
                Rectangle focusRect = buttonRect;
                focusRect.Inflate(-3, -3);
                ControlPaint.DrawFocusRectangle(e.Graphics, focusRect);
            }

            // Draw the value
            if (_edit == null)
            {
                Rectangle valueRect = ClientRectangle;
                valueRect.Width -= buttonRect.Width + 1;

                if (Focused && (_ownerPropertyEnum.Property.InPlaceCtrlInAction == null))
                {
                    Rectangle fillRect = _ownerPropertyEnum.Property.Value.GetStringValueRect(e.Graphics, valueRect, Point.Empty);
                    fillRect.Y++;
                    fillRect.Height-=2;
                    fillRect.X -= PropertyGrid.GlobalTextMargin / 2;
                    fillRect.Width = buttonRect.Left - 1 - fillRect.Left;
                    e.Graphics.FillRectangle(SystemBrushes.FromSystemColor(SystemColors.Highlight), fillRect);
                }

                Color valueColor;
                if (_ownerPropertyEnum.Property.Enabled == false)
                    valueColor = SystemColors.GrayText;
                else
                {
                    if (Focused && (_ownerPropertyEnum.Property.InPlaceCtrlInAction == null))
                        valueColor = SystemColors.HighlightText;
                    else
                        valueColor = _ownerPropertyEnum.Property.Value.ForeColor;
                }

                _ownerPropertyEnum.Property.Value.DrawValue(e.Graphics, valueRect, valueColor, _ownerPropertyEnum, Text);
            }

            base.OnPaint(e);
        }
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:63,代码来源:PropInPlaceColorChooser.cs


注:本文中的System.Windows.Forms.VisualStyles.VisualStyleRenderer.SetParameters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。