本文整理汇总了C#中CheckBox类的典型用法代码示例。如果您正苦于以下问题:C# CheckBox类的具体用法?C# CheckBox怎么用?C# CheckBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CheckBox类属于命名空间,在下文中一共展示了CheckBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected async override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.view_expense);
dialog = ServiceContainer.Resolve<IMessageDialog>();
var id = Intent.GetIntExtra("ID", -1);
viewModel = ServiceContainer.Resolve<ExpenseViewModel>();
await viewModel.Init(id);
this.ActionBar.Title = viewModel.Title;
viewModel.IsBusyChanged = (busy) =>
{
if (busy)
AndHUD.Shared.Show(this, "Loading...");
else
AndHUD.Shared.Dismiss(this);
};
name = FindViewById<EditText>(Resource.Id.name);
date = FindViewById<DatePicker>(Resource.Id.date);
notes = FindViewById<EditText>(Resource.Id.notes);
total = FindViewById<EditText>(Resource.Id.total);
billable = FindViewById<CheckBox>(Resource.Id.billable);
category = FindViewById<Spinner>(Resource.Id.category);
category.Adapter = new ArrayAdapter<string>(this, global::Android.Resource.Layout.SimpleSpinnerDropDownItem, viewModel.Categories);
category.SetSelection(viewModel.Categories.IndexOf(viewModel.Category));
name.Text = viewModel.Name;
date.DateTime = viewModel.Due;
notes.Text = viewModel.Notes;
total.Text = viewModel.Total;
billable.Checked = viewModel.Billable;
}
示例2: MainForm
public MainForm ()
{
//
// _richTextBox
//
_richTextBox = new RichTextBox ();
_richTextBox.Dock = DockStyle.Top;
_richTextBox.Height = 160;
Controls.Add (_richTextBox);
//
// _wordWrapCheckBox
//
_wordWrapCheckBox = new CheckBox ();
_wordWrapCheckBox.Checked = _richTextBox.WordWrap;
_wordWrapCheckBox.Location = new Point (8, 170);
_wordWrapCheckBox.Text = "WordWrap";
_wordWrapCheckBox.CheckedChanged += new EventHandler (WordWrapCheckBox_CheckedChanged);
Controls.Add (_wordWrapCheckBox);
//
// MainForm
//
ClientSize = new Size (300, 200);
Location = new Point (250, 100);
StartPosition = FormStartPosition.Manual;
Text = "bug #81488";
Load += new EventHandler (MainForm_Load);
}
示例3: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Settings);
ActionBar.SetDisplayHomeAsUpEnabled(true);
counter = 0;
var prefs =
AndroidAppPreferences.Create(Application.Context.GetSharedPreferences(KeySndrApplication.AppPreferencesId, FileCreationMode.Private));
editIpView = FindViewById<EditText>(Resource.Id.ipEditText);
editPortView = FindViewById<EditText>(Resource.Id.portEditText);
useCacheView = FindViewById<CheckBox>(Resource.Id.enableCache);
if (!string.IsNullOrEmpty(prefs.Ip))
editIpView.Text = prefs.Ip;
if (prefs.Port > 0)
editPortView.Text = prefs.Port.ToString();
useCacheView.Checked = prefs.UseCache;
probe = new Probe("KeySndrServer");
probe.BeaconsUpdated += Probe_BeaconsUpdated;
t = new Timer(1000);
t.Elapsed += TimerOnElapsed;
if (Intent.Extras == null || !Intent.Extras.ContainsKey("search"))
return;
}
示例4: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
setupParent(FindViewById<LinearLayout>(Resource.Id.mainLayout));
listViewGoodsMain = FindViewById<ListView>(Resource.Id.listViewGoodsMain);
goodsItemsList = new List<GoodsItem>();
goodsItemsList.Add(new GoodsItem() { Id = 1, Quantity = 1, Name = "Пельмешки"});
goodsItemsList.Add(new GoodsItem() { Id = 2, Quantity = 2, Name = "Сосисоны" });
myGoodsItemsAdapter = new GoodsItemsAdapter(this, goodsItemsList);
listViewGoodsMain.Adapter = myGoodsItemsAdapter;
var emptyText = FindViewById<TextView>(Resource.Id.textViewGoodsListEmpty);
listViewGoodsMain.EmptyView = emptyText;
editTextNewProduct = FindViewById<EditText>(Resource.Id.EditTextNewProduct);
editTextNewProduct.EditorAction += editTextNewProduct_EditorAction;
editTextNewProduct.Click += editTextNewProduct_Click;
checkBoxRed = FindViewById<CheckBox>(Resource.Id.checkBoxRed);
checkBoxRed.Click += checkBoxRed_Click;
}
示例5: Initialize
public static void Initialize()
{
ClearMenu = MainMenu.AddSubMenu("Clear", "Clear");
ClearMenu.AddGroupLabel("Clear Options");
_q = ClearMenu.Add("Clear.Q", new CheckBox("Use Q"));
_w = ClearMenu.Add("Clear.W", new CheckBox("Use W"));
}
示例6: Misc
static Misc()
{
// Initialize the menu values
Menu = Config.Menu.AddSubMenu("Misc");
_drawQ = Menu.Add("drawQ", new CheckBox("Draw Q"));
_drawW = Menu.Add("drawW", new CheckBox("Draw W"));
_drawE = Menu.Add("drawE", new CheckBox("Draw E"));
_drawReadySpellsOnly = Menu.Add("drawReady", new CheckBox("Draw ready spells only"));
Menu.AddSeparator();
_ksW = Menu.Add("ksQ", new CheckBox("KS with W"));
_ksR = Menu.Add("ksR", new CheckBox("KS with R"));
Menu.AddSeparator();
_useHeal = Menu.Add("useHeal", new CheckBox("Use Heal Smart"));
_useQSS = Menu.Add("useQSS", new CheckBox("Use QSS"));
Menu.AddSeparator();
for (int i = 0; i < EntityManager.Heroes.Allies.Count; i++)
{
_useHealOn[i] = Menu.Add("useHeal" + i, new CheckBox("Use Heal to save " + EntityManager.Heroes.Allies[i].ChampionName));
}
Menu.AddSeparator();
_useEOnGapcloser = Menu.Add("useEOnGapcloser", new CheckBox("Use E on Gapcloser", false));
_EOnImmobileEnemy = Menu.Add("EOnImmobile", new CheckBox("Use E on immobile enemy"));
_EOnSlowedEnemy = Menu.Add("EOnSlowed", new CheckBox("Use E on slowed enemy", false));
_useEInterrupt = Menu.Add("EToInterrupt", new CheckBox("Use E as interrupt"));
_interruptDangerLvl = Menu.Add("InterruptDangerLvl", new Slider("Interrupt Danger Lvl", 2, 1, 3));
Menu.AddSeparator();
_stealDrake = Menu.Add("stealDrake", new CheckBox("Try to steal Dragon"));
_stealBaron = Menu.Add("stealBaron", new CheckBox("Try to steal Baron"));
Menu.AddSeparator();
_autolevelskills = Menu.Add("autolevelskills", new CheckBox("Autolevelskills"));
_autoBuyStartingItems = Menu.Add("autoBuyStartingItems", new CheckBox("Autobuy Starting Items (SR only)"));
Menu.AddSeparator();
_useSkinHack = Menu.Add("useSkinHack", new CheckBox("Use Skinhack", false));
_skinId = Menu.Add("skinId", new Slider("Skin ID", 6, 1, 14));
}
示例7: btnSubmit_Click
protected void btnSubmit_Click(object sender, EventArgs e)
{
if (validateSelection() == false) return;
bool saved = false;
int i = 0;
int questionid = 0;
foreach (GridViewRow gr in gvwQuestionBank.Rows)
{
questionid = int.Parse(gvwQuestionBank.Rows[i].Cells[1].Text);
CheckBox cb = new CheckBox();
cb = (CheckBox)gr.Controls[0].FindControl("CheckBox1");
if (cb.Checked)
{
InsertQuestionDetails(questionid);
saved = true;
}
i = i + 1;
}
if (saved == true)
lblMessage.Text = "saved Successfully";
else lblMessage.Text = "no item selected";
}
示例8: Game_OnStart
private static void Game_OnStart(EventArgs args)
{
if (Player.Instance.Hero != Champion.Shaco && Player.Instance.Hero != Champion.Leblanc)
return;
CloneMenu = MainMenu.AddMenu("Clone control", "yodagodEOQ");
Chat.Print(Player.Instance.ChampionName + " clone controller loaded", Color.White);
Control = CloneMenu.Add("Clone", new CheckBox("Control clone"));
CloneMenu.AddGroupLabel("You can select a target with left click");
Mode = CloneMenu.Add("Mode", new Slider("", 2, 0, 2));
Mode.DisplayName = "If health > 40%:" + Modes[Mode.CurrentValue];
Mode.OnValueChange += delegate
(ValueBase<int> sender, ValueBase<int>.ValueChangeArgs Args)
{
sender.DisplayName = "If health > 40%:" + Modes[Args.NewValue];
};
Mode2 = CloneMenu.Add("Mode2", new Slider("", 0, 0, 2));
Mode2.DisplayName = "If health < 40%:" + Modes[Mode2.CurrentValue];
Mode2.OnValueChange += delegate
(ValueBase<int> sender, ValueBase<int>.ValueChangeArgs Args)
{
sender.DisplayName = "If health < 40%:" + Modes[Args.NewValue];
};
Range = CloneMenu.Add("Range", new Slider("Get targets within {0} range", 2000, 1, 10000));
Game.OnUpdate += ControlClone;
GameObject.OnCreate += CreateClone;
GameObject.OnDelete += DeleteClone;
}
示例9: OnCreateView
public override View OnCreateView(LayoutInflater Inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = Inflater.Inflate(R.Layout.fragment_menu, container, false);
// Make sure the two menu fragments are created.
FragmentManager fm = GetChildFragmentManager();
FragmentTransaction ft = fm.BeginTransaction();
mFragment1 = fm.FindFragmentByTag("f1");
if (mFragment1 == null) {
mFragment1 = new FragmentMenuSupport.MenuFragment();
ft.Add(mFragment1, "f1");
}
mFragment2 = fm.FindFragmentByTag("f2");
if (mFragment2 == null) {
mFragment2 = new FragmentMenuSupport.Menu2Fragment();
ft.Add(mFragment2, "f2");
}
ft.Commit();
// Watch check box clicks.
mCheckBox1 = (CheckBox)v.FindViewById(R.Id.menu1);
mCheckBox1.Click += (o, a) => UpdateFragmentVisibility();
mCheckBox2 = (CheckBox)v.FindViewById(R.Id.menu2);
mCheckBox2.Click += (o, a) => UpdateFragmentVisibility();
// Make sure fragments start out with correct visibility.
UpdateFragmentVisibility();
return v;
}
示例10: OnCreate
protected override async void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.Login);
GlobalServices.XjtuSite.Account.IsLoggedInChanged += Account_IsLoggedInChanged;
if (!await UpdateAccountStatus())
{
userNameView = FindViewById<EditText>(Resource.Id.accountNameEdit);
passwordView = FindViewById<EditText>(Resource.Id.passwordEdit);
savePasswordCheckBox = FindViewById<CheckBox>(Resource.Id.savePasswordCheckbox);
loginButton = FindViewById<Button>(Resource.Id.loginButton);
//ÔØÈëÉèÖá£
using (var pref = GetPreferences(FileCreationMode.Private))
{
userNameView.Text = pref.GetString("userName", "");
passwordView.Text = pref.GetString("password", "");
savePasswordCheckBox.Checked = pref.GetBoolean("savePassword", false);
}
if (!string.IsNullOrWhiteSpace(userNameView.Text)) passwordView.RequestFocus();
//ÕìÌýʼþ¡£
EventHandler<TextChangedEventArgs> userNamePasswordChanged = (_, e) =>
{
loginButton.Enabled = !string.IsNullOrWhiteSpace(userNameView.Text) &&
!string.IsNullOrEmpty(passwordView.Text);
};
userNameView.TextChanged += userNamePasswordChanged;
passwordView.TextChanged += userNamePasswordChanged;
savePasswordCheckBox.CheckedChange += SavePasswordCheckBox_CheckedChange;
loginButton.Click += LoginButton_Click;
}
}
示例11: btnDelete_Click
protected void btnDelete_Click(object sender, EventArgs e)
{
CheckBox cb = new CheckBox();
bool flag = false;
for (int i = 0; i < GridView1.Rows.Count; i++)
{
cb = (CheckBox)GridView1.Rows[i].FindControl("CheckBox1");
if (cb.Checked)
{
objbusinesskeywordbal.BusinessKeywordId = Convert.ToInt32(GridView1.Rows[i].Cells[3].Text);
objbusinesskeyworddal.DeleteBusinessKeyword(objbusinesskeywordbal);
flag = true;
}
}
if (flag == true)
{
Response.Write("<script>alert('Records deleted');</script>");
}
else
{
Response.Write("<script>alert('Please select record to delete');</script>");
}
bindgrid();
}
示例12: OnActivityCreated
public override void OnActivityCreated (Bundle savedInstanceState)
{
base.OnActivityCreated (savedInstanceState);
View decorView = Activity.Window.DecorView;
var parentView = (ViewGroup)Activity.Window.DecorView
.FindViewById (Resource.Id.sample_main_layout);
mLowProfileCheckBox = new CheckBox (Activity);
mLowProfileCheckBox.Text = "Enable Low Profile mode.";
parentView.AddView (mLowProfileCheckBox);
mHideNavCheckbox = new CheckBox (Activity);
mHideNavCheckbox.Checked = true;
mHideNavCheckbox.Text = "Hide Navigation bar";
parentView.AddView (mHideNavCheckbox);
mHideStatusBarCheckBox = new CheckBox (Activity);
mHideStatusBarCheckBox.Checked = true;
mHideStatusBarCheckBox.Text = "Hide Status Bar";
parentView.AddView (mHideStatusBarCheckBox);
mImmersiveModeCheckBox = new CheckBox (Activity);
mImmersiveModeCheckBox.Text = "Enable Immersive Mode.";
parentView.AddView (mImmersiveModeCheckBox);
mImmersiveModeStickyCheckBox = new CheckBox (Activity);
mImmersiveModeStickyCheckBox.Text = "Enable Immersive Mode (Sticky)";
parentView.AddView (mImmersiveModeStickyCheckBox);
}
示例13: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView(Resource.Layout.action_bar_fragment_menu);
// Make sure the two menu fragments are created.
var fm = SupportFragmentManager;
var ft = fm.BeginTransaction();
mFragment1 = (MenuFragment)fm.FindFragmentByTag("f1");
if (mFragment1 == null) {
mFragment1 = new MenuFragment();
ft.Add(mFragment1, "f1");
}
mFragment2 = (Menu2Fragment)fm.FindFragmentByTag("f2");
if (mFragment2 == null) {
mFragment2 = new Menu2Fragment();
ft.Add(mFragment2, "f2");
}
ft.Commit();
// Watch check box clicks.
mCheckBox1 = (CheckBox)FindViewById(Resource.Id.menu1);
mCheckBox1.Click += OnClickListener_OnClick;
mCheckBox2 = (CheckBox)FindViewById(Resource.Id.menu2);
mCheckBox2.Click += OnClickListener_OnClick;
mCheckBox3 = (CheckBox)FindViewById(Resource.Id.menu3);
mCheckBox3.Click += OnClickListener_OnClick;
mHasOptionsMenu = (CheckBox)FindViewById(Resource.Id.has_options_menu);
mHasOptionsMenu.Click += OnClickListener_OnClick;
mMenuVisibility = (CheckBox)FindViewById(Resource.Id.menu_visibility);
mMenuVisibility.Click += OnClickListener_OnClick;
// Make sure fragments start out with correct visibility.
UpdateFragmentVisibility();
}
示例14: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
List<Event> events = Event.GetAllEvents();
foreach (Event selectedEvent in events)
{
Panel pnlEvent = new Panel();
pnlEvent.ID = selectedEvent.ID.ToString();
pnlEvent.Attributes.Add("class", "panel");
CheckBox chkbxEventName = new CheckBox();
chkbxEventName.ID = "chkbx" + selectedEvent.Name;
chkbxEventName.Text = selectedEvent.Name;
pnlEvent.Controls.Add(chkbxEventName);
for (int i = 0; i < selectedEvent.MaxTeamSize; i++)
{
TextBox txtbxTTID = new TextBox();
txtbxTTID.ID = "TTID" + (i + 1).ToString() + selectedEvent.ID;
txtbxTTID.Attributes.Add("placeholder", "TTID " + (i + 1).ToString());
txtbxTTID.Attributes.Add("style", "display:none;");
pnlEvent.Controls.Add(txtbxTTID);
RegularExpressionValidator rev = new RegularExpressionValidator();
rev.ControlToValidate = txtbxTTID.ClientID;
rev.Attributes.Add("style", "display:none;");
rev.ValidationExpression = "\\d{4}";
rev.ErrorMessage = "*";
pnlEvent.Controls.Add(rev);
}
pnlEvents.Controls.Add(pnlEvent);
}
}
示例15: OnCreateView
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
Dialog.SetTitle (GetString (Resource.String.sign_in));
var v = inflater.Inflate (Resource.Layout.fingerprint_dialog_container, container, false);
mCancelButton = (Button)v.FindViewById (Resource.Id.cancel_button);
mCancelButton.Click += (object sender, EventArgs e) => Dismiss ();
mSecondDialogButton = (Button)v.FindViewById (Resource.Id.second_dialog_button);
mSecondDialogButton.Click += (object sender, EventArgs e) => {
if (mStage == Stage.Fingerprint) {
GoToBackup ();
} else {
VerifyPassword ();
}
};
mFingerprintContent = v.FindViewById (Resource.Id.fingerprint_container);
mBackupContent = v.FindViewById (Resource.Id.backup_container);
mPassword = v.FindViewById<EditText> (Resource.Id.password);
mPassword.SetOnEditorActionListener (this);
mPasswordDescriptionTextView = v.FindViewById<TextView> (Resource.Id.password_description);
mUseFingerprintFutureCheckBox = v.FindViewById<CheckBox> (Resource.Id.use_fingerprint_in_future_check);
mNewFingerprintEnrolledTextView = v.FindViewById<TextView> (Resource.Id.new_fingerprint_enrolled_description);
mFingerprintUiHelper = mFingerprintUiHelperBuilder.Build (
(ImageView)v.FindViewById (Resource.Id.fingerprint_icon),
(TextView)v.FindViewById (Resource.Id.fingerprint_status), this);
UpdateStage ();
// If fingerprint authentication is not available, switch immediately to the backup
// (password) screen.
if (!mFingerprintUiHelper.IsFingerprintAuthAvailable)
GoToBackup ();
return v;
}