• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# PushButtonState类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中PushButtonState的典型用法代码示例。如果您正苦于以下问题:C# PushButtonState类的具体用法?C# PushButtonState怎么用?C# PushButtonState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PushButtonState类属于命名空间,在下文中一共展示了PushButtonState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DrawButton

		public static void DrawButton (Graphics g, Rectangle bounds, string buttonText, Font font, TextFormatFlags flags, Image image, Rectangle imageBounds, bool focused, PushButtonState state)
		{
			if (Application.RenderWithVisualStyles || always_use_visual_styles == true) {
				VisualStyleRenderer vsr = GetPushButtonRenderer (state);

				vsr.DrawBackground (g, bounds);

				if (image != null)
					vsr.DrawImage (g, imageBounds, image);
			} else {
				if (state == PushButtonState.Pressed)
					ControlPaint.DrawButton (g, bounds, ButtonState.Pushed);
				else
					ControlPaint.DrawButton (g, bounds, ButtonState.Normal);

				if (image != null)
					g.DrawImage (image, imageBounds);
			}

			Rectangle focus_rect = bounds;
			focus_rect.Inflate (-3, -3);

			if (focused)
				ControlPaint.DrawFocusRectangle (g, focus_rect);

			if (buttonText != String.Empty)
				if (state == PushButtonState.Disabled)
					TextRenderer.DrawText (g, buttonText, font, focus_rect, SystemColors.GrayText, flags);
				else
					TextRenderer.DrawText (g, buttonText, font, focus_rect, SystemColors.ControlText, flags);
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:31,代码来源:ButtonRenderer.cs


示例2: OnGotFocus

	   protected override void OnGotFocus(EventArgs e) {
		  if (!showSplit) {
			 base.OnGotFocus(e);
			 return;
		  }

		  if (!State.Equals(PushButtonState.Pressed) && !State.Equals(PushButtonState.Disabled)) {
			 State = PushButtonState.Default;
		  }
	   }
开发者ID:nithinphilips,项目名称:SMOz,代码行数:10,代码来源:SplitButton.cs


示例3: IsBackgroundPartiallyTransparent

        /// <include file='doc\ButtonRenderer.uex' path='docs/doc[@for="ButtonRenderer.IsBackgroundPartiallyTransparent"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Returns true if the background corresponding to the given state is partially transparent, else false.
        ///    </para>
        /// </devdoc>
        public static bool IsBackgroundPartiallyTransparent(PushButtonState state) {
            if (RenderWithVisualStyles) {
                InitializeRenderer((int)state);

                return visualStyleRenderer.IsBackgroundPartiallyTransparent();
            }
            else {
                return false; //for downlevel, this is false
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:16,代码来源:ButtonRenderer.cs


示例4: OnKeyDown

	   protected override void OnKeyDown(KeyEventArgs kevent) {
		  if (showSplit) {
			 if (kevent.KeyCode.Equals(Keys.Down)) {
				ShowContextMenuStrip();
			 } else if (kevent.KeyCode.Equals(Keys.Space) && kevent.Modifiers == Keys.None) {
				State = PushButtonState.Pressed;
			 }
		  }

		  base.OnKeyDown(kevent);
	   }
开发者ID:nithinphilips,项目名称:SMOz,代码行数:11,代码来源:SplitButton.cs


示例5: ConvertToButtonState

        internal static ButtonState ConvertToButtonState(PushButtonState state)
        {
            switch (state)
            {
                case PushButtonState.Pressed:
                    return ButtonState.Pushed;

                case PushButtonState.Disabled:
                    return ButtonState.Inactive;
            }
            return ButtonState.Normal;
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:ButtonRenderer.cs


示例6: DataGridViewImageButtonCell

        private bool _enabled; // Is the button enabled

        #endregion Fields

        #region Constructors

        protected DataGridViewImageButtonCell()
        {
            // In my project, buttons are disabled by default
            _enabled = false;
            _buttonState = PushButtonState.Disabled;

            // Changing this value affects the appearance of the image on the button.
            _buttonImageOffset = 2;

            // Call the routine to load the images specific to a column.
            LoadImages();
        }
开发者ID:venta-holding,项目名称:wd_in_work,代码行数:18,代码来源:frm_product_supply.cs


示例7: DrawButton

 public static void DrawButton(Graphics g, Rectangle bounds, PushButtonState state)
 {
     if (RenderWithVisualStyles)
     {
         InitializeRenderer((int) state);
         visualStyleRenderer.DrawBackground(g, bounds);
     }
     else
     {
         ControlPaint.DrawButton(g, bounds, ConvertToButtonState(state));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:ButtonRenderer.cs


示例8: DataGridViewCheckBoxCell

		public DataGridViewCheckBoxCell ()
		{
			check_state = PushButtonState.Normal;
			editingCellFormattedValue = false;
			editingCellValueChanged = false;
			falseValue = null;
			flatStyle = FlatStyle.Standard;
			indeterminateValue = null;
			threeState = false;
			trueValue = null;
			ValueType = null;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:12,代码来源:DataGridViewCheckBoxCell.cs


示例9: DataGridViewImageButtonCell

        private bool _enabled; // Is the button enabled

        #endregion Fields

        #region Constructors

        protected DataGridViewImageButtonCell()
        {
            // In my project, buttons are disabled by default
            font = new Font("Arial", 8);
            _enabled = true;
            _buttonState= PushButtonState.Normal;

            // Changing this value affects the appearance of the image on the button.
            _buttonImageOffset = 4;

            // Call the routine to load the images specific to a column.
            LoadImages();
        }
开发者ID:dstrucl,项目名称:Tangenta40,代码行数:19,代码来源:DataGridViewButtonImageCell.cs


示例10: OnKeyUp

 /// <summary>
 /// Raises the KeyUp event</summary>
 /// <param name="kevent">KeyEventArgs that contains the event data</param>
 protected override void OnKeyUp(KeyEventArgs kevent)
 {
     if (kevent.KeyCode.Equals(Keys.Space))
     {
         if (MouseButtons == MouseButtons.None)
         {
             MState = PushButtonState.Normal;
         }
     }
     base.OnKeyUp(kevent);
 }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:14,代码来源:SplitButton.cs


示例11: OnPaintButtonImpl

        private void OnPaintButtonImpl(Graphics g, PushButtonState state, bool drawFocusCues, bool drawKeyboardCues)
        {
            Color backColor;
            Color outlineColor;
            Color arrowFillColor;
            Color arrowOutlineColor;

            switch (state)
            {
                case PushButtonState.Disabled:
                    backColor = Color.Transparent;
                    outlineColor = BackColor;
                    arrowFillColor = Color.Gray;
                    arrowOutlineColor = Color.Black;
                    break;

                case PushButtonState.Hot:
                    backColor = Color.FromArgb(64, SystemColors.HotTrack);
                    outlineColor = backColor;
                    arrowFillColor = Color.Blue;
                    arrowOutlineColor = Color.White;
                    break;

                case PushButtonState.Default:
                case PushButtonState.Normal:
                    backColor = Color.Transparent;
                    outlineColor = Color.Transparent;
                    arrowFillColor = Color.Black;
                    arrowOutlineColor = Color.White;
                    break;

                case PushButtonState.Pressed:
                    backColor = Color.FromArgb(192, SystemColors.Highlight);
                    outlineColor = Color.FromArgb(192, SystemColors.Highlight);
                    arrowFillColor = Color.Blue;
                    arrowOutlineColor = Color.White;
                    break;

                default:
                    throw new InvalidEnumArgumentException("buttonState");
            }

            // Draw parent background
            IPaintBackground asIpb = Parent as IPaintBackground;

            if (!this.drawWithGradient || asIpb == null)
            {
                if (asIpb != null)
                {
                    Rectangle screenRect = RectangleToScreen(ClientRectangle);
                    Rectangle parentRect = Parent.RectangleToClient(screenRect);

                    g.TranslateTransform(-Left, -Top, MatrixOrder.Append);
                    asIpb.PaintBackground(g, parentRect);
                    g.TranslateTransform(+Left, +Top, MatrixOrder.Append);
                }
                else
                {
                    using (SolidBrush backBrush = new SolidBrush(BackColor))
                    {
                        g.FillRectangle(backBrush, ClientRectangle);
                    }
                }
            }
            else
            {
                if (this.backBufferSurface != null &&
                    (this.backBufferSurface.Width != ClientSize.Width || this.backBufferSurface.Height != ClientSize.Height))
                {
                    this.backBuffer.Dispose();
                    this.backBuffer = null;

                    this.backBufferSurface.Dispose();
                    this.backBufferSurface = null;
                }

                if (this.backBufferSurface == null)
                {
                    this.backBufferSurface = new Surface(ClientSize.Width, ClientSize.Height);
                    this.backBuffer = new RenderArgs(this.backBufferSurface);
                }

                Rectangle screenRect = RectangleToScreen(ClientRectangle);
                Rectangle parentRect = Parent.RectangleToClient(screenRect);

                using (Graphics bg = Graphics.FromImage(this.backBuffer.Bitmap))
                {
                    bg.TranslateTransform(-Left, -Top, MatrixOrder.Append);
                    asIpb.PaintBackground(bg, parentRect);
                }

                BitmapData bitmapData = this.backBuffer.Bitmap.LockBits(
                    new Rectangle(0, 0, this.backBuffer.Bitmap.Width, this.backBuffer.Bitmap.Height), 
                    ImageLockMode.ReadWrite, 
                    PixelFormat.Format32bppArgb);

                int startAlpha;
                int finishAlpha;

                if (this.arrowDirection == ArrowDirection.Left || this.arrowDirection == ArrowDirection.Up)
//.........这里部分代码省略.........
开发者ID:metadeta96,项目名称:openpdn,代码行数:101,代码来源:ArrowButton.cs


示例12: DrawButton

        public virtual void DrawButton(Graphics surface, DropDownButtonRenderingArgs args, PushButtonState state)
        {
            surface.SmoothingMode = SmoothingMode.HighQuality;
            surface.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
            surface.PixelOffsetMode = PixelOffsetMode.HighQuality;
            surface.InterpolationMode = InterpolationMode.HighQualityBicubic;
            surface.CompositingQuality = CompositingQuality.HighQuality;
            if (args.Image == null)
            { ButtonRenderer.DrawButton(surface, args.Bounds, args.Focused, state); }
            else
            { ButtonRenderer.DrawButton(surface, args.Bounds, args.Image, args.ImageBounds, args.Focused, state); }

            if (state == PushButtonState.Disabled)
            {
                TextRenderer.DrawText(surface, args.Text, args.Font, args.Bounds, SystemColors.GrayText, args.BackColor, args.TextFormatFlags);
            }
            else
            {
                TextRenderer.DrawText(surface, args.Text, args.Font, args.Bounds, args.ForeColor, args.BackColor, args.TextFormatFlags);
            }
        }
开发者ID:jonasjelonek,项目名称:GUIFramework,代码行数:21,代码来源:DropDownButton.cs


示例13: SetButtonDrawState

 private void SetButtonDrawState()
 {
     if (Bounds.Contains(Parent.PointToClient(Cursor.Position)))
     {
         State = PushButtonState.Hot;
     }
     else if (Focused)
     {
         State = PushButtonState.Default;
     }
     else if (!Enabled)
     {
         State = PushButtonState.Disabled;
     }
     else
     {
         State = PushButtonState.Normal;
     }
 }
开发者ID:john-peterson,项目名称:processhacker,代码行数:19,代码来源:SplitButton.cs


示例14: OnMouseDown

        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (!showSplit)
            {
                base.OnMouseDown(e);
                return;
            }

            //handle ContextMenu re-clicking the drop-down region to close the menu
            if (m_SplitMenuStrip != null && e.Button == MouseButtons.Left && !isMouseEntered)
                skipNextOpen = true;

            if (dropDownRectangle.Contains(e.Location) && !isSplitMenuVisible && e.Button == MouseButtons.Left)
            {
                ShowContextMenuStrip();
            }
            else
            {
                State = PushButtonState.Pressed;
            }
        }
开发者ID:john-peterson,项目名称:processhacker,代码行数:21,代码来源:SplitButton.cs


示例15: OnMouseEnter

        protected override void OnMouseEnter(EventArgs e)
        {
            if (!showSplit)
            {
                base.OnMouseEnter(e);
                return;
            }

            isMouseEntered = true;

            if (!State.Equals(PushButtonState.Pressed) && !State.Equals(PushButtonState.Disabled))
            {
                State = PushButtonState.Hot;
            }
               
        }
开发者ID:john-peterson,项目名称:processhacker,代码行数:16,代码来源:SplitButton.cs


示例16: OnKeyUp

        protected override void OnKeyUp(KeyEventArgs kevent)
        {
            if (kevent.KeyCode.Equals(Keys.Space))
            {
                if (Control.MouseButtons == MouseButtons.None)
                {
                    State = PushButtonState.Normal;
                }
            }
            else if (kevent.KeyCode.Equals(Keys.Apps))
            {
                if (Control.MouseButtons == MouseButtons.None && !isSplitMenuVisible)
                {
                    ShowContextMenuStrip();
                }
            }

            base.OnKeyUp(kevent);
        }
开发者ID:john-peterson,项目名称:processhacker,代码行数:19,代码来源:SplitButton.cs


示例17: OnLostFocus

 /// <summary>
 /// Raises the LostFocus event</summary>
 /// <param name="e">EventArgs that contains the event data</param>
 protected override void OnLostFocus(EventArgs e)
 {
     if (!m_showSplit)
     {
         base.OnLostFocus(e);
         return;
     }
     if (!MState.Equals(PushButtonState.Pressed) && !MState.Equals(PushButtonState.Disabled))
     {
         MState = PushButtonState.Normal;
     }
 }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:15,代码来源:SplitButton.cs


示例18: OnMouseDown

        /// <summary>
        /// Raises the MouseDown event</summary>
        /// <param name="e">MouseEventArgs that contains the event data</param>
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (!m_showSplit)
            {
                base.OnMouseDown(e);
                return;
            }

            if (m_dropDownRectangle.Contains(e.Location))
            {
                ShowContextMenuStrip();
            }
            else
            {
                MState = PushButtonState.Pressed;
            }
        }
开发者ID:BeRo1985,项目名称:LevelEditor,代码行数:20,代码来源:SplitButton.cs


示例19: MouseDownHandler

		private void MouseDownHandler (object sender, MouseEventArgs e)
		{
			if ((e.Button & MouseButtons.Left) == 0)
				return;

			if (ShowSlider) {
				Rectangle right = RightScrollButtonArea;
				Rectangle left = LeftScrollButtonArea;
				if (right.Contains (e.X, e.Y)) {
					right_slider_state = PushButtonState.Pressed;
					if (CanScrollRight) {
						slider_pos++;
						SizeTabs ();

						// UIA Framework Event: Horizontally Scrolled
						OnUIAHorizontallyScrolled (EventArgs.Empty);

						switch (this.Alignment) {
							case TabAlignment.Top:
								Invalidate (new Rectangle (0, 0, Width, ItemSize.Height));
								break;
							case TabAlignment.Bottom:
								Invalidate (new Rectangle (0, DisplayRectangle.Bottom, Width, Height - DisplayRectangle.Bottom));
								break;
							case TabAlignment.Left:
								Invalidate (new Rectangle (0, 0, DisplayRectangle.Left, Height));
								break;
							case TabAlignment.Right:
								Invalidate (new Rectangle (DisplayRectangle.Right, 0, Width - DisplayRectangle.Right, Height));
								break;
						}
						
					} else {
						Invalidate (right);
					}
					return;
				} else if (left.Contains (e.X, e.Y)) {
					left_slider_state = PushButtonState.Pressed;
					if (CanScrollLeft) {
						slider_pos--;
						SizeTabs ();

						// UIA Framework Event: Horizontally Scrolled
						OnUIAHorizontallyScrolled (EventArgs.Empty);

						switch (this.Alignment) {
							case TabAlignment.Top:
								Invalidate (new Rectangle (0, 0, Width, ItemSize.Height));
								break;
							case TabAlignment.Bottom:
								Invalidate (new Rectangle (0, DisplayRectangle.Bottom, Width, Height - DisplayRectangle.Bottom));
								break;
							case TabAlignment.Left:
								Invalidate (new Rectangle (0, 0, DisplayRectangle.Left, Height));
								break;
							case TabAlignment.Right:
								Invalidate (new Rectangle (DisplayRectangle.Right, 0, Width - DisplayRectangle.Right, Height));
								break;
						}
					} else {
						Invalidate (left);
					}
					return;
				}
			}

			int count = Controls.Count;
			for (int i = SliderPos; i < count; i++) {
				if (!GetTabRect (i).Contains (e.X, e.Y))
					continue;
				SelectedIndex = i;
				mouse_down_on_a_tab_page = true;
				break;
			}
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:75,代码来源:TabControl.cs


示例20: OnEnabledChanged

        protected override void OnEnabledChanged(EventArgs e)
        {
            if (Enabled)
                State = PushButtonState.Normal;
            else
                State = PushButtonState.Disabled;

            base.OnEnabledChanged(e);
        }
开发者ID:john-peterson,项目名称:processhacker,代码行数:9,代码来源:SplitButton.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Puzzle类代码示例发布时间:2022-05-24
下一篇:
C# Purchase类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap