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


C# PushButtonState类代码示例

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


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


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