本文整理汇总了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;
}
示例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();
}
}
}
}
示例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);
}
}
示例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);
}
}
示例5: SetCheckState
protected override void SetCheckState(TreeNodeAdv node, CheckState value)
{
if (node.Tag is FileNode)
return;
base.SetCheckState(node, value);
}
示例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);
}
示例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();
}
}
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
示例12: SearchParams
public SearchParams(String DepartingAirport, String ArrivingAirport,
String OnDays, CheckState RoundTrip)
{
departingAirport = DepartingAirport;
arrivingAirport = ArrivingAirport;
onDays = OnDays;
roundTrip = RoundTrip;
}
示例13: SetAllItem
void SetAllItem(CheckState state)
{
foreach (ListViewItem item in listView1.SelectedItems)
{
item.Tag = state;
}
SetState();
}
示例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;
}
示例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;
}