本文整理汇总了C#中System.Windows.Forms.CheckedListBox类的典型用法代码示例。如果您正苦于以下问题:C# CheckedListBox类的具体用法?C# CheckedListBox怎么用?C# CheckedListBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CheckedListBox类属于System.Windows.Forms命名空间,在下文中一共展示了CheckedListBox类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddColumnsToCheckList
private static void AddColumnsToCheckList(CheckedListBox checkList, RowCollection rowCollection)
{
foreach (var columnHeader in rowCollection.GetColumnHeaders())
{
checkList.Items.Add(columnHeader);
}
}
开发者ID:ArneD,项目名称:unique-file-records-comparer,代码行数:7,代码来源:SelectColumnsForm.cs
示例2: DALControl
public DALControl(string dbTableName, string PascalTableName, bool isPascal, string preNS,
string preClass, string preModel,
bool isLog, CheckedListBox checkedListBox1, EnumDbType dbType)
{
this.TableName = dbTableName;
this.PascalTableName = PascalTableName;
this.IsPascal = isPascal;
this.PreNs = preNS;
this.SbTemp = new StringBuilder();
this.PreClass = preClass;
this.PreModel = preModel;
this.IsLog = isLog;
this.CheckedListBox1 = checkedListBox1;
this.DbType = dbType;
if (this.DbType == EnumDbType.Oracle)
{
dbHelper = "DbHelperOracle";
parameter = "OracleParameter";
paramsHelper = "ParamsHelperOracle";
}
else if (this.DbType == EnumDbType.SqlServer)
{
dbHelper = "DbHelperSqlServer";
parameter = "SqlParameter";
paramsHelper = "ParamsHelperSqlServer";
}
listPrimaryKey = TableControl.GetPrimayKeys(dbTableName, this.DbType);
dtColumns = ColumnControl.GetTableColumnsByTableName(dbTableName, this.DbType);
}
开发者ID:Raman0716,项目名称:MyCodeGenerate,代码行数:32,代码来源:DALControl.cs
示例3: ValidateCheckList
public static bool ValidateCheckList(CheckedListBox boxes, ErrorProvider errorProvider)
{
if(boxes.CheckedItems.Count > 0)
return true;
errorProvider.SetError(boxes, "Este campo es obligatorio");
return false;
}
开发者ID:faloi,项目名称:cuponete,代码行数:7,代码来源:ValidatorHelper.cs
示例4: foreach
protected List<ushort>GetChecked(CheckedListBox list)
{
List<ushort> result = new List<ushort>();
foreach (var c in list.CheckedItems)
result.Add((c is Zone) ? ushort.Parse((c as Zone).Id) : (c as Terminal).ReferenceId);
return result;
}
开发者ID:emergent-design,项目名称:quiche,代码行数:7,代码来源:UsersTab.cs
示例5: AdvancedFilter
public void AdvancedFilter(string searchString, CheckedListBox.CheckedItemCollection checkedItems)
{
// Start from scratch
gridView.Items.Clear();
// Repopulate if empty search
if (checkedItems.Count == 0 || searchString == "")
{
fullList.ForEach(item => gridView.Items.Add(item));
return;
}
// For each video file showing:
fullList.ForEach(item =>
{
// Big Linq Statement Translation:
// - Find tag entries from file that match type of checked items
// - Any entry that contains the search string, add that file to view
var file = (VideoFile)item.Tag;
if (checkedItems.Cast<Tag>().Select(tag =>
file.Tags.Find(entry => entry.TypeId == tag.Id)).
Any(match => match != null && match.Data.ToLower().Contains(searchString.ToLower())))
{
gridView.Items.Add(item);
}
});
}
开发者ID:Kaan0200,项目名称:Zoodevio_VideoLibrary,代码行数:27,代码来源:GridViewControl.cs
示例6: GameManager
/// <summary>
/// The GameManager constructor - responsible for
/// initialising data-fields needed by a game
/// manager object.
/// </summary>
/// <param name="charactersListBox">A CheckedListBox to hold game characters.</param>
/// <param name="battleResults">A ListBox to display the game's battle results.</param>
/// <param name="noOfPlayersInBattle">The number of players which can be in a battle.</param>
public GameManager(CheckedListBox charactersListBox, ListBox battleResults, int noOfPlayersInBattle)
{
///<summary>
///Initialising the list of game characters
///</summary>
this.characters = new List<Character>();
///<summary>
///Initialising the CheckedListBox the characters
///will be added to.
///</summary>
this.charactersListBox = charactersListBox;
///<summary>
///Initialising the ListBox which will display
///the game battle results.
///</summary>
this.battleResults = battleResults;
///<summary>
///Initialising the number of characters
///permitted in the game battle.
///</summary>
this.noOfPlayersInBattle = noOfPlayersInBattle;
}
开发者ID:rattfieldnz,项目名称:StrategyDesignGame,代码行数:33,代码来源:GameManager.cs
示例7: AddElement
/// <summary>
/// add new element
/// </summary>
/// <param name="cbElements"></param>
/// <param name="clbFactsAboutElements"></param>
public void AddElement(ComboBox cbElements, CheckedListBox clbFactsAboutElements)
{
string elementName = cbElements.Text;
cbElements.Items.Add(elementName);
Dictionary<Guid, bool> factsAboutElement = new Dictionary<Guid, bool>();
foreach (var item in clbFactsAboutElements.Items)
{
RuleArgumentListBoxItem factAboutElement = item as RuleArgumentListBoxItem;
factsAboutElement.Add(factAboutElement.Id, factAboutElement.Value);
}
Guid elementId = dataAccessLayer.InsertElement(elementName, factsAboutElement);
Element element = new Element
{
Id = elementId,
Name = elementName,
Facts = factsAboutElement.Select(fae => new FactAboutElement
{
Id = fae.Key,
Value = fae.Value,
Name = inferenceModule.Facts.Find(f => f.Id == fae.Key).Name
}).ToList()
};
inferenceModule.Elements.Add(element);
}
开发者ID:marcinfoder,项目名称:SystemEkspercki,代码行数:32,代码来源:Presenter.cs
示例8: Test_05_ChangingChannelSupportPersistsOnCommit
public void Test_05_ChangingChannelSupportPersistsOnCommit()
{
CheckedListBox edPolicySupport = new CheckedListBox();
ActionDetailController controller = new ActionDetailController();
controller.PolicySupportControl = edPolicySupport;
IResourceAction actionForTest = GetMockActionForTest();
controller.Connect(actionForTest);
List<PolicyType> policys = new List<PolicyType>(actionForTest.SupportedPolicySetting);
Assert.AreEqual(1, policys.Count, "Should start as ActiveContent and ClientEmail");
Assert.IsTrue(policys.Contains(PolicyType.ClientEmail), "Should start as ActiveContent and ClientEmail");
//get first non client email policy in list
int id = -1;
for (int i = 0; i < edPolicySupport.Items.Count; i++)
{
if (edPolicySupport.Items[i].ToString() != "Client Email Policy")
{
id = i;
break;
}
}
edPolicySupport.SetItemChecked(id, true);
policys = new List<PolicyType>(actionForTest.SupportedPolicySetting);
Assert.AreEqual(1, policys.Count, "We haven't committed anything yet");
Assert.IsTrue(policys.Contains(PolicyType.ClientEmail), "We haven't committed anything yet");
controller.Commit();
policys = new List<PolicyType>(actionForTest.SupportedPolicySetting);
Assert.AreEqual(2, policys.Count, "We haven't committed anything yet");
Assert.IsTrue(policys.Contains(PolicyType.ClientEmail), "We added ClientEmail, this should still be here");
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:32,代码来源:TestActionDetailController.cs
示例9: EditValue
/// <inheritdoc/>
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
#region Sanity checks
if (context == null) throw new ArgumentNullException(nameof(context));
if (provider == null) throw new ArgumentNullException(nameof(provider));
#endregion
var languages = value as LanguageSet;
if (languages == null) throw new ArgumentNullException(nameof(value));
var editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
if (editorService == null) return value;
var listBox = new CheckedListBox {CheckOnClick = true};
int i = 0;
foreach (var language in languages)
{
listBox.Items.Add(language);
listBox.SetItemChecked(i++, true);
}
foreach (var language in Languages.AllKnown.Except(languages))
listBox.Items.Add(language);
editorService.DropDownControl(listBox);
return new LanguageSet(listBox.CheckedItems.Cast<CultureInfo>());
}
开发者ID:nano-byte,项目名称:common,代码行数:28,代码来源:LanguageSetEditor.cs
示例10: LlenarChkbL_Desktop
public bool LlenarChkbL_Desktop(CheckedListBox Generico)
{
if (!Validar())
return false;
try
{
clsConexionBD objConexionBd = new clsConexionBD(strApp);
objConexionBd.SQL = strSQL;
if (!objConexionBd.LlenarDataSet(false))
{
strError = objConexionBd.Error;
objConexionBd.CerrarCnx();
objConexionBd = null;
return false;
}
Generico.DataSource = objConexionBd.DataSet_Lleno.Tables[0];
Generico.ValueMember = strCampoID;
Generico.DisplayMember = strCampoTexto;
Generico.Refresh();
objConexionBd.CerrarCnx();
objConexionBd = null;
return true;
}
catch (Exception ex)
{
strError = ex.Message;
return false;
}
}
开发者ID:jdzapataduque,项目名称:Cursos-Capacitando,代码行数:29,代码来源:ClsChkList.cs
示例11: GetSelectedItems
public static TextPackage[] GetSelectedItems(CheckedListBox listBox, List<TextPackage> licenseCaptions)
{
List<TextPackage> packs = new List<TextPackage>();
foreach (int index in listBox.CheckedIndices)
packs.Add(licenseCaptions[index]);
return packs.ToArray();
}
开发者ID:GRGSIBERIA,项目名称:ReadmeEditor,代码行数:7,代码来源:CheckedListMethod.cs
示例12: GetStudentUserListByYear
/// <summary>
/// GetStudentUserListByYear take StudentByYear sorted list created in the main program and the student years checkedlistbox and creates a hashtable
/// that will be used to look up the user list to display in the combolistbox display.
/// This does not use wmi service, but is the logical place add this method.
/// </summary>
/// <param name="slIn"></param>
/// <param name="checkListBox"></param>
/// <returns>sortlist</returns>
public Hashtable GetStudentUserListByYear(SortedList slIn, CheckedListBox checkListBox)
{
Hashtable ht = new Hashtable();
try
{
foreach (object itemChecked in checkListBox.CheckedItems)
{
ICollection keys = slIn.GetKeyList();
foreach (string s in keys)
{
if (s == itemChecked.ToString())
{
//this is the sortedlist of students for a given year
IList values = ((SortedList)slIn[s]).GetValueList();
//create the hashtable entries available students - this will be used to lookup and match students by year
foreach (string name in values)
{
ht.Add(name.ToUpper(), name.ToUpper());
}
}
}
}
}
catch (Exception e)
{
//re-throw exception for main calling
throw new Exception("WMIPropertiesHelper", e);
}
return (ht);
}
开发者ID:mcdonald1212,项目名称:ServerUtility,代码行数:38,代码来源:ServerUserCleanup.cs
示例13: CheckAll
/// <summary>
/// Checks all.
/// </summary>
/// <param name="cb">The cb.</param>
/// <param name="value">if set to <c>true</c> [value].</param>
public static void CheckAll(CheckedListBox cb, bool value)
{
for (var a = 0; a < cb.Items.Count; a++)
{
cb.SetItemChecked(a, value);
}
}
开发者ID:andreigec,项目名称:ANDREICSLIB,代码行数:12,代码来源:CheckedListBoxExtras.cs
示例14: clearItemCheckList
public static void clearItemCheckList(CheckedListBox check)
{
for (int item = 0; item < check.Items.Count; item++)
{
check.SetItemChecked(item, false);
}
}
开发者ID:MaximilianoFelice,项目名称:gdd-2014,代码行数:7,代码来源:FormHandler.cs
示例15: llenarFuncionalidadesDeRol
public static void llenarFuncionalidadesDeRol(CheckedListBox chkLstBox, String nombreRol)
{
chkLstBox.Items.Clear();
bool activo;
try
{
using (SqlConnection conn = new SqlConnection(main.connString))
using (SqlCommand cmd = new SqlCommand())
{
cmd.Connection = conn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "BONDIOLA.funcionalidades_asignadas_a_rol";
cmd.Parameters.Add(new SqlParameter("@nombreRol", nombreRol));
conn.Open();
SqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
activo = true;
if (String.Equals(rdr["Activo"], "0"))
{
activo = false;
}
chkLstBox.Items.Add((string)rdr["nombre_funcionalidad"], activo);
}
}
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
}
}
开发者ID:juanmjacobs,项目名称:gestion2c2013,代码行数:32,代码来源:Listado.cs
示例16: CargarCheckListBox
public void CargarCheckListBox( CheckedListBox CheckList )
{
IList ListarConceptos = GetAll();
((ListBox)CheckList).DataSource = ListarConceptos;
((ListBox)CheckList).DisplayMember = "concepto";
((ListBox)CheckList).ValueMember = "id_concepto";
}
开发者ID:ppincheira,项目名称:Facturacion,代码行数:7,代码来源:ConceptoImplement.cs
示例17: PresentationWindow
public PresentationWindow(CheckedListBox imageListBox_, int numOfTiles_, int delay)
{
this.TopMost = true;
this.FormBorderStyle = FormBorderStyle.None;
this.WindowState = FormWindowState.Maximized;
this.Paint += HandleHandlePaint;
this.Click += HandleHandleClick;
this.imageListBox = imageListBox_;
this.currentIndex = -1;
theTimer = new Timer();
theTimer.Interval = delay*1000;
theTimer.Tick += HandleTheTimerTick;
theTimer.Enabled = true;
this.numOfTiles = numOfTiles_;
this.numOfTilesInRow = (int)Math.Sqrt(numOfTiles);
shownTiles = new List<bool>();
for (int i = 0; i < numOfTiles; i++)
{
shownTiles.Add(false);
}
this.Finished += HandleHandleFinished;
NextImage();
}
开发者ID:rgcjonas,项目名称:tmp,代码行数:31,代码来源:PresentationWindow.cs
示例18: EditValue
/// <summary>
/// Edits a value based on some user input which is collected from a character control.
/// </summary>
/// <param name="context"></param>
/// <param name="provider"></param>
/// <param name="value"></param>
/// <returns></returns>
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
_dialogProvider = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
List<int> layerList = new List<int>();
LayoutLegend legend = context.Instance as LayoutLegend;
LayoutMap map = null;
if (legend != null)
map = legend.Map;
if (map == null)
return layerList;
CheckedListBox lb = new CheckedListBox();
List<int> originalList = value as List<int>;
if (originalList != null)
{
for (int i = map.MapControl.Layers.Count - 1; i >= 0 ; i--)
lb.Items.Add(map.MapControl.Layers[i].LegendText, originalList.Contains(i));
}
_dialogProvider.DropDownControl(lb);
for (int i = 0; i < lb.Items.Count; i ++)
{
if (lb.GetItemChecked(i))
layerList.Add(lb.Items.Count - 1 -i);
}
return layerList;
}
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:37,代码来源:LayoutLayerEditor.cs
示例19: cargarCamposChkLb
public void cargarCamposChkLb(DataTable dataTable, CheckedListBox checkListBox)
{
for (int i = 0; i < dataTable.Columns.Count; i++)
{
checkListBox.Items.Add(dataTable.Columns[i].ColumnName);
}
}
开发者ID:pablos7,项目名称:trabajo_final_cine,代码行数:7,代码来源:frmAdministrador.cs
示例20: CustTypeHandlerPanel
internal CustTypeHandlerPanel()
{
Label l;
Text = StringParser.Parse("${res:ComponentInspector.InspectorMenu.TypeHandlerOptionsPanel.Title}");
ICollection typeHandlers = TypeHandlerManager.Instance.GetTypeHandlers();
_typeHandlerCheck = new CheckedListBox();
_typeHandlerCheck.CheckOnClick = true;
_typeHandlerCheck.Dock = DockStyle.Fill;
_typeHandlerCheck.BackColor = BackColor;
_typeHandlerCheck.BorderStyle = BorderStyle.None;
_typeHandlerCheck.ThreeDCheckBoxes = true;
foreach (TypeHandlerManager.TypeHandlerInfo th in typeHandlers)
_typeHandlerCheck.Items.Add(th);
Controls.Add(_typeHandlerCheck);
l = new Label();
l.Dock = DockStyle.Top;
l.Height = 50;
l.Text = StringParser.Parse("${res:ComponentInspector.TypeHandlerOptionsPanel.InformationLabel}");
Controls.Add(l);
// Padding
l = new Label();
l.Dock = DockStyle.Top;
l.Height = 5;
Controls.Add(l);
}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:30,代码来源:CustTypeHandlerPanel.cs
注:本文中的System.Windows.Forms.CheckedListBox类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论