當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。