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


C# CheckState类代码示例

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


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

示例1:

	// Constructor.
	public ItemCheckEventArgs
				(int index, CheckState newCheckValue, CheckState currentValue)
			{
				this.index = index;
				this.newCheckValue = newCheckValue;
				this.currentValue = currentValue;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:8,代码来源:ItemCheckEventArgs.cs

示例2: DrawCheckBackground

 // used by DataGridViewCheckBoxCell
 internal static void DrawCheckBackground(bool controlEnabled, CheckState controlCheckState, Graphics g, Rectangle bounds, Color checkColor, Color checkBackground, bool disabledColors, ColorData colors)
 {                       
     using ( WindowsGraphics wg = WindowsGraphics.FromGraphics( g )) {
         WindowsBrush brush;
         if (!controlEnabled && disabledColors) {
             brush = new WindowsSolidBrush(wg.DeviceContext, SystemColors.Control);
         }
         else if (controlCheckState == CheckState.Indeterminate && checkBackground == SystemColors.Window && disabledColors) {
             Color comboColor = SystemInformation.HighContrast ? SystemColors.ControlDark :
                     SystemColors.Control;
             byte R = (byte)((comboColor.R + SystemColors.Window.R) / 2);
             byte G = (byte)((comboColor.G + SystemColors.Window.G) / 2);
             byte B = (byte)((comboColor.B + SystemColors.Window.B) / 2);
             brush = new WindowsSolidBrush(wg.DeviceContext, Color.FromArgb(R, G, B));
         }
         else {
             brush = new WindowsSolidBrush(wg.DeviceContext, checkBackground);
         }
         
         try {
             wg.FillRectangle(brush, bounds);
         }
         finally {
             if (brush != null) {
                 brush.Dispose();
             }
         }
     }
 }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:30,代码来源:CheckBoxBaseAdapter.cs

示例3: PaintOver

        internal override void PaintOver(PaintEventArgs e, CheckState state) {
            ColorData colors = PaintPopupRender(e.Graphics).Calculate();
            LayoutData layout = PaintPopupLayout(e, state == CheckState.Unchecked, SystemInformation.HighContrast ? 2 : 1).Layout();

            Graphics g = e.Graphics;
            //Region original = g.Clip;

            Rectangle r = Control.ClientRectangle;

            Brush backbrush = null;
            if (state == CheckState.Indeterminate) {
                backbrush = CreateDitherBrush(colors.highlight, colors.buttonFace);
            }

            try {
                PaintButtonBackground(e, r, backbrush);
            }
            finally {
                if (backbrush != null) {
                    backbrush.Dispose();
                    backbrush = null;
                }
            }
            if (Control.IsDefault) {
                r.Inflate(-1, -1);
            }

            PaintImage(e, layout);
            PaintField(e, layout, colors, colors.windowText, true);

            DrawDefaultBorder(g, r, colors.options.highContrast ? colors.windowText : colors.buttonShadow, this.Control.IsDefault);

            if (SystemInformation.HighContrast) {
                using (Pen windowFrame = new Pen(colors.windowFrame),
                       highlight = new Pen(colors.highlight),
                       buttonShadow = new Pen(colors.buttonShadow)) {

                    // top, left white
                    g.DrawLine(windowFrame, r.Left + 1, r.Top + 1, r.Right - 2, r.Top + 1);
                    g.DrawLine(windowFrame, r.Left + 1, r.Top + 1, r.Left + 1, r.Bottom - 2);

                    // bottom, right white
                    g.DrawLine(windowFrame, r.Left, r.Bottom - 1, r.Right, r.Bottom - 1);
                    g.DrawLine(windowFrame, r.Right - 1, r.Top, r.Right - 1, r.Bottom);

                    // top, left gray
                    g.DrawLine(highlight, r.Left, r.Top, r.Right, r.Top);
                    g.DrawLine(highlight, r.Left, r.Top, r.Left, r.Bottom);

                    // bottom, right gray
                    g.DrawLine(buttonShadow, r.Left + 1, r.Bottom - 2, r.Right - 2, r.Bottom - 2);
                    g.DrawLine(buttonShadow, r.Right - 2, r.Top + 1, r.Right - 2, r.Bottom - 2);
                }

                r.Inflate(-2, -2);
            }
            else {
                Draw3DLiteBorder(g, r, colors, true);
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:60,代码来源:ButtonPopupAdapter.cs

示例4: PaintUp

        internal override void PaintUp(PaintEventArgs e, CheckState state)
        {
            if (Control.Appearance == Appearance.Button) {
				ButtonAdapter.PaintUp(e, Control.CheckState);
            }
            else {
                ColorData colors = PaintRender(e.Graphics).Calculate();
                LayoutData layout = Layout(e).Layout();
                PaintButtonBackground(e, Control.ClientRectangle, null);

                //minor adjustment to make sure the appearance is exactly the same as Win32 app.
                int focusRectFixup = layout.focus.X & 0x1; // if it's odd, subtract one pixel for fixup.
                if (!Application.RenderWithVisualStyles) {
                    focusRectFixup = 1 - focusRectFixup;
                }

                if (!layout.options.everettButtonCompat) {
                    layout.textBounds.Offset(-1, -1); 
                }
                layout.imageBounds.Offset(-1, -1);
                layout.focus.Offset(-(focusRectFixup+1), -2);
                layout.focus.Width = layout.textBounds.Width + layout.imageBounds.Width - 1;
                layout.focus.Intersect(layout.textBounds);

                if( layout.options.textAlign != LayoutUtils.AnyLeft && layout.options.useCompatibleTextRendering && layout.options.font.Italic) {
                    // fixup for GDI+ text rendering.  VSW#515164
                    layout.focus.Width += 2;
                }

                PaintImage(e, layout);
                DrawCheckBox(e, layout);
                PaintField(e, layout, colors, colors.windowText, true);
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:34,代码来源:CheckBoxStandardAdapter.cs

示例5: SetCheckState

        protected override void SetCheckState(TreeNodeAdv node, CheckState value)
        {
            if (node.Tag is FileNode)
                return;

            base.SetCheckState(node, value);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:7,代码来源:NodeCheckBox.cs

示例6: Fill

        public static void Fill(this CheckedListBox source, string[] values, CheckState initCheckState)
        {
            source.Items.Clear();

            foreach (string value in values)
                source.Items.Add(value, initCheckState);
        }
开发者ID:skt90u,项目名称:skt90u-framework-dotnet,代码行数:7,代码来源:ExtCheckedListBox.cs

示例7: DrawCheckBackground

 internal static void DrawCheckBackground(bool controlEnabled, CheckState controlCheckState, Graphics g, Rectangle bounds, Color checkColor, Color checkBackground, bool disabledColors, ButtonBaseAdapter.ColorData colors)
 {
     using (WindowsGraphics graphics = WindowsGraphics.FromGraphics(g))
     {
         WindowsBrush brush;
         if (!controlEnabled && disabledColors)
         {
             brush = new WindowsSolidBrush(graphics.DeviceContext, SystemColors.Control);
         }
         else if (((controlCheckState == CheckState.Indeterminate) && (checkBackground == SystemColors.Window)) && disabledColors)
         {
             Color color = SystemInformation.HighContrast ? SystemColors.ControlDark : SystemColors.Control;
             byte red = (byte) ((color.R + SystemColors.Window.R) / 2);
             byte green = (byte) ((color.G + SystemColors.Window.G) / 2);
             byte blue = (byte) ((color.B + SystemColors.Window.B) / 2);
             brush = new WindowsSolidBrush(graphics.DeviceContext, Color.FromArgb(red, green, blue));
         }
         else
         {
             brush = new WindowsSolidBrush(graphics.DeviceContext, checkBackground);
         }
         try
         {
             graphics.FillRectangle(brush, bounds);
         }
         finally
         {
             if (brush != null)
             {
                 brush.Dispose();
             }
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:34,代码来源:CheckBoxBaseAdapter.cs

示例8: CheckState2Int32

 public static Int32 CheckState2Int32(CheckState state)
 {
     Int32 stateInt32 = 0;
     if(state == CheckState.Indeterminate) stateInt32 = 1;
     else if(state == CheckState.Checked)  stateInt32 = 2;
     return stateInt32;
 }
开发者ID:oneshoturdone,项目名称:GBotGUI,代码行数:7,代码来源:SettingsUtilities.cs

示例9: PaintOver

        internal override void PaintOver(PaintEventArgs e, CheckState state) {
            System.Drawing.Graphics g = e.Graphics;
            if (Control.Appearance == Appearance.Button) {
                ButtonPopupAdapter adapter = new ButtonPopupAdapter(Control);
                adapter.PaintOver(e, Control.CheckState);
            }
            else {
                ColorData colors = PaintPopupRender(e.Graphics).Calculate();
                LayoutData layout = PaintPopupLayout(e, true).Layout();

                Region original = e.Graphics.Clip;
                PaintButtonBackground(e, Control.ClientRectangle, null);

                PaintImage(e, layout);
                
                DrawCheckBackground(e, layout.checkBounds, colors.windowText, colors.options.highContrast ? colors.buttonFace : colors.highlight, true, colors);
                DrawPopupBorder(g, layout.checkBounds, colors);
                DrawCheckOnly(e, layout, colors, colors.windowText, colors.highlight, true);

                e.Graphics.Clip = original;
                e.Graphics.ExcludeClip(layout.checkArea);

                PaintField(e, layout, colors, colors.windowText, true);
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:25,代码来源:CheckBoxPopupAdapter.cs

示例10: DrawCheckBox

        private void DrawCheckBox(Graphics g, Rectangle bounds, CheckState state)
        {
            // If I Were A Painter... That would look way better. Sorry.

            int size;
            int boxTop;

            size = bounds.Size.Height < bounds.Size.Width ? bounds.Size.Height : bounds.Size.Width;
            size = size > ((int)g.DpiX / 7) ? ((int)g.DpiX / 7) : size;

            boxTop = bounds.Y + (bounds.Height - size) / 2;

            using (Pen p = new Pen(this.Owner.ForeColor))
            {
                g.DrawRectangle(p, bounds.X, boxTop, size, size);
            }

            if (state != CheckState.Unchecked)
            {
                using (Pen p = new Pen(state == CheckState.Indeterminate ? SystemColors.GrayText : SystemColors.ControlText))
                {
                    g.DrawLine(p, bounds.X, boxTop, bounds.X + size, boxTop + size);
                    g.DrawLine(p, bounds.X, boxTop + size, bounds.X + size, boxTop);
                }
            }
        }
开发者ID:tatar1nro,项目名称:KKM_Inventory_WinCE,代码行数:26,代码来源:DataGridCustomCheckBoxColumn.cs

示例11: PaintUp

 internal override void PaintUp(PaintEventArgs e, CheckState state)
 {
     if (base.Control.Appearance == Appearance.Button)
     {
         this.ButtonAdapter.PaintUp(e, base.Control.CheckState);
     }
     else
     {
         ButtonBaseAdapter.ColorData colors = base.PaintRender(e.Graphics).Calculate();
         ButtonBaseAdapter.LayoutData layout = this.Layout(e).Layout();
         base.PaintButtonBackground(e, base.Control.ClientRectangle, null);
         int num = layout.focus.X & 1;
         if (!Application.RenderWithVisualStyles)
         {
             num = 1 - num;
         }
         if (!layout.options.everettButtonCompat)
         {
             layout.textBounds.Offset(-1, -1);
         }
         layout.imageBounds.Offset(-1, -1);
         layout.focus.Offset(-(num + 1), -2);
         layout.focus.Width = (layout.textBounds.Width + layout.imageBounds.Width) - 1;
         layout.focus.Intersect(layout.textBounds);
         if (((layout.options.textAlign != (ContentAlignment.BottomLeft | ContentAlignment.MiddleLeft | ContentAlignment.TopLeft)) && layout.options.useCompatibleTextRendering) && layout.options.font.Italic)
         {
             layout.focus.Width += 2;
         }
         base.PaintImage(e, layout);
         base.DrawCheckBox(e, layout);
         base.PaintField(e, layout, colors, colors.windowText, true);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:CheckBoxStandardAdapter.cs

示例12: SearchParams

 public SearchParams(String DepartingAirport, String ArrivingAirport,
     String OnDays, CheckState RoundTrip)
 {
     departingAirport = DepartingAirport;
     arrivingAirport = ArrivingAirport;
     onDays = OnDays;
     roundTrip = RoundTrip;
 }
开发者ID:JordanChin,项目名称:Ingres,代码行数:8,代码来源:Routes.cs

示例13: SetAllItem

		void SetAllItem(CheckState state)
		{
			foreach (ListViewItem item in listView1.SelectedItems)
			{
				item.Tag = state;
			}
			SetState();
		}
开发者ID:RyuumaKishita,项目名称:EnchantMapEditor.Net,代码行数:8,代码来源:SetCollisionByMapKindForm.cs

示例14: CheckStateToTimeVisibility

 public static AppointmentTimeVisibility CheckStateToTimeVisibility(CheckState state)
 {
     if (state == CheckState.Checked)
         return AppointmentTimeVisibility.Always;
     if (state == CheckState.Unchecked)
         return AppointmentTimeVisibility.Never;
     return AppointmentTimeVisibility.Auto;
 }
开发者ID:kimykunjun,项目名称:test,代码行数:8,代码来源:DemoUtils.cs

示例15: Combine

		public static CheckState Combine(this CheckState checkState1, CheckState checkState2)
		{
			if (checkState1 == CheckState.Checked && checkState2 == CheckState.Checked)
				return CheckState.Checked;
			if (checkState1 == CheckState.Unchecked && checkState2 == CheckState.Unchecked)
				return CheckState.Unchecked;
			return CheckState.Indeterminate;
		}
开发者ID:rsdn,项目名称:janus,代码行数:8,代码来源:WinFormsHelper.cs


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