本文整理汇总了C#中System.Windows.Forms.ComboBox.Refresh方法的典型用法代码示例。如果您正苦于以下问题:C# ComboBox.Refresh方法的具体用法?C# ComboBox.Refresh怎么用?C# ComboBox.Refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ComboBox
的用法示例。
在下文中一共展示了ComboBox.Refresh方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RefreshCurveEqComboBox
public void RefreshCurveEqComboBox(ComboBox cb, INCCAnalysisParams.CurveEquationVals v)
{
cb.Items.Clear();
foreach (INCCAnalysisParams.CurveEquation cs in System.Enum.GetValues(typeof(INCCAnalysisParams.CurveEquation)))
{
//Per Martyn, use equation string, not named value. 7/17/2014 HN
cb.Items.Add(cs.ToDisplayString());
}
cb.Refresh();
cb.SelectedIndex = cb.FindString (v.cal_curve_equation.ToDisplayString());
}
示例2: CreatePlaylist
public static void CreatePlaylist(ref CPlaylist list, ref ComboBox cbx, ref ListBox lbx, String name, String path)
{
list = new CPlaylist();
list.Name = name;
list.Path = path + "\\" + name;
lbx.Items.Clear();
cbx.Items.Add(list);
cbx.Sorted = false;
cbx.Sorted = true;
cbx.Invalidate();
cbx.Refresh();
for (int i = 0; i < cbx.Items.Count; ++i)
{
if (cbx.Items[i].ToString() == list.Name)
{
cbx.SelectedIndex = i;
break;
}
}
}
示例3: CargarComboBox
public void CargarComboBox(ComboBox objComboBox)
{
try
{
DataTable dataTable = new DataTable("TipoCambio");
dataTable.Columns.Add("Id");
dataTable.Columns.Add("Name");
dataTable.Rows.Add("PEN", "SOLES");
dataTable.Rows.Add("USD", "DÓLARES");
objComboBox.DataSource = dataTable;
objComboBox.DisplayMember = "Name";
objComboBox.ValueMember = "Id";
objComboBox.SelectedIndex = 1;
objComboBox.Refresh();
}
catch (Exception)
{
throw;
}
}
示例4: SubtypeChange
//.........这里部分代码省略.........
pRDButton.AutoSize = true;
pNewGpBox.Controls.Add(pRDButton);
pRDButton.Top = pNewGpBox.Height / 2 - pRDButton.Height / 2 - 2;
tbPg.Controls.Add(pNewGpBox);
try
{
tbPg.Controls.Remove(pCmbBox);
//Dim cnts() As Control = tbPg.Controls.Find("lblEdit" & strFld, False)
//If cnts.Length > 0 Then
// tbPg.Controls.Remove(cnts(0))
//End If
}
catch// (Exception ex)
{
}
pNewGpBox = null;
pRDButton = null;
}
else
{
//Set the domain value
pCmbBox.DataBindings.DefaultDataSourceUpdateMode = DataSourceUpdateMode.Never;
pCmbBox.DataSource = Globals.DomainToList((IDomain)pCV);
pCmbBox.DisplayMember = "getDisplay";
pCmbBox.ValueMember = "getValue";
pCmbBox.Visible = true;
pCmbBox.Refresh();
string codeVal = "";
string displayVal = "";
Globals.SubtypeValuesAtIndex(0, (ISubtypes)pCV, ref codeVal, ref displayVal);
pCmbBox.Text = displayVal;
}
}
}
//If the contorl is a coded value domain with two values
}
else if (cntrlPnl is CustomPanel)
{
//Get the Field
strFld = cntrlPnl.Tag.ToString();
if (strFld.IndexOf("|") > 0)
{
strFld = (strFld.Substring(0, strFld.IndexOf("|"))).Trim();
}
//Get the fomain
pCV = (ICodedValueDomain)pSubTypes.get_Domain(intSubVal, strFld);
if (pCV == null)
{
cntrlPnl.Controls.Clear();
}
else
{
示例5: llenarComboBox
public void llenarComboBox(ComboBox cBox, SqlCommand sp, string nombreCampo)
{
cBox.Items.Clear();
try
{
using (SqlConnection conn = new SqlConnection(Settings.Default.ConnectionString))
{
sp.Connection.Open();
SqlDataReader rdr = sp.ExecuteReader();
while (rdr.Read())
{
cBox.Items.Add(rdr[nombreCampo].ToString());
}
sp.Connection.Close();
}
cBox.Refresh();
}
catch (SqlException ex)
{
MessageBox.Show(ex.Message);
}
}
示例6: FillWeightVariableCombo
/// <summary>
/// FillWeightVariableCombo()
/// </summary>
/// <param name="cmb">ComboBox to be filled</param>
/// <param name="scopeWord">The scope of the variable</param>
protected void FillWeightVariableCombo(ComboBox cmb, VariableType scopeWord)
{
cmb.Items.Clear();
VariableCollection vars = this.EpiInterpreter.Context.MemoryRegion.GetVariablesInScope(scopeWord);
cmb.BeginUpdate();
foreach (IVariable var in vars)
{
if (this.EpiInterpreter.Context.DataSet.Tables["output"].Columns.Contains(var.Name))
{
Type type = this.EpiInterpreter.Context.DataSet.Tables["output"].Columns[var.Name].DataType;
switch (Type.GetTypeCode(type))
{
case TypeCode.Boolean:
case TypeCode.Byte:
case TypeCode.SByte:
case TypeCode.UInt16:
case TypeCode.UInt32:
case TypeCode.UInt64:
case TypeCode.Int16:
case TypeCode.Int32:
case TypeCode.Int64:
case TypeCode.Decimal:
case TypeCode.Double:
case TypeCode.Single:
cmb.Items.Add(var.Name.ToString());
break;
}
}
}
cmb.EndUpdate();
cmb.Sorted = true;
cmb.Refresh();
}
示例7: FillVariableCombo
/// <summary>
/// FillvariableCombo()
/// </summary>
/// <param name="cmb">ComboBox to be filled</param>
/// <param name="scopeWord">The scope of the variable</param>
/// <param name="typ">Limit selection to (DataType)</param>
protected void FillVariableCombo(ComboBox cmb, VariableType scopeWord, DataType typ)
{
cmb.Items.Clear();
VariableCollection vars = this.EpiInterpreter.Context.MemoryRegion.GetVariablesInScope(scopeWord);
cmb.BeginUpdate();
foreach (IVariable var in vars)
{
int VType = (int)var.DataType;
int FType = (int)typ;
if (!(var is Epi.Fields.PredefinedDataField) && ((VType & FType) == VType))
{
cmb.Items.Add(var.Name.ToString());
}
}
cmb.EndUpdate();
cmb.Sorted = true;
cmb.Refresh();
}
示例8: LlenarCombo_Windows
public bool LlenarCombo_Windows( ComboBox 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;
}
}
示例9: setupCombobox
//.........这里部分代码省略.........
//SerialListCopy.Dispose();
//if (!_InitDone)
//{
// cmbStation.DataSource = _bs_Stations;
// cmbStation.DisplayMember = "Value";
// cmbStation.ValueMember = "Key";
// cmbStationToStationFrom.DataSource = _bs_StationsFrom;
// cmbStationToStationFrom.DisplayMember = "Value";
// cmbStationToStationFrom.ValueMember = "Key";
// cmbStationToStationTo.DataSource = _bs_StationsTo;
// cmbStationToStationTo.DisplayMember = "Value";
// cmbStationToStationTo.ValueMember = "Key";
//}
//_pt.PrintAndReset("5");
//cbIncludeWithinRegionOfStation.SelectedIndexChanged -= cbIncludeWithinRegionOfStation_SelectionChangeCommitted;
//var previouslySelectedValue = cbIncludeWithinRegionOfStation.SelectedItem;
//cbIncludeWithinRegionOfStation.Items.Clear();
//var systems = StationDirectory.Keys.Select(x => (object)(StructureHelper.CombinedNameToSystemName(x))).OrderBy(x => x).Distinct().ToArray();
//cbIncludeWithinRegionOfStation.Items.Add("<Current System>");
//cbIncludeWithinRegionOfStation.Items.AddRange(systems);
////cbIncludeWithinRegionOfStation.SelectedIndex = 0;
//cbIncludeWithinRegionOfStation.DropDownStyle = ComboBoxStyle.DropDownList;
//_pt.PrintAndReset("6");
//if (previouslySelectedValue != null)
// cbIncludeWithinRegionOfStation.SelectedItem = previouslySelectedValue;
//else
// cbIncludeWithinRegionOfStation.SelectedItem = "<Current System>";
//cbIncludeWithinRegionOfStation.SelectedIndexChanged += cbIncludeWithinRegionOfStation_SelectionChangeCommitted;
//int ListIndex;
//_pt.PrintAndReset("7");
//if ((Key_cmbStation != null) && _StationIndices.TryGetValue(Key_cmbStation, out ListIndex))
// cmbStation.SelectedIndex = ListIndex;
//if ((Key_cmbStation != null) && _StationIndices.TryGetValue(Key_cmbStationToStationFrom, out ListIndex))
// cmbStationToStationFrom.SelectedIndex = ListIndex;
//if ((Key_cmbStation != null) && _StationIndices.TryGetValue(Key_cmbStationToStationTo, out ListIndex))
// cmbStationToStationTo.SelectedIndex = ListIndex;
//cbCommodity.Items.Clear();
//_pt.PrintAndReset("8");
//foreach (var commodity in CommodityDirectory.OrderBy(x => x.Key))
//{
// cbCommodity.Items.Add(commodity.Key);
//}
//cbCommodity.SelectedItem = null;
//if (cbCommodity.Items.Count > 0)
// cbCommodity.SelectedItem = cbCommodity.Items[0];
//lvAllComms.Items.Clear();
////_pt.PrintAndReset("9");
//Debug.Print("Anzahl = " + CommodityDirectory.Count.ToString());
//// Populate all commodities tab
//foreach (var commodity in CommodityDirectory)
//{
// decimal bestBuyPrice;
// decimal bestSellPrice;
// string bestBuy;
// string bestSell;
// decimal buyers;
// decimal sellers;
// //_pt.PrintAndReset("9_1");
// GetBestBuyAndSell(commodity.Key, out bestBuyPrice, out bestSellPrice, out bestBuy, out bestSell, out buyers, out sellers);
// //_pt.PrintAndReset("9_2");
// lvAllComms.Items.Add(new ListViewItem(new[]
// { commodity.Key,
// bestBuyPrice.ToString(CultureInfo.InvariantCulture) != "0" ? bestBuyPrice.ToString(CultureInfo.InvariantCulture) : "",
// bestBuy,
// buyers.ToString(CultureInfo.InvariantCulture),
// bestSellPrice.ToString(CultureInfo.InvariantCulture) != "0" ? bestSellPrice.ToString(CultureInfo.InvariantCulture) : "",
// bestSell,
// sellers.ToString(CultureInfo.InvariantCulture),
// bestBuyPrice != 0 && bestSellPrice != 0 ? (bestSellPrice - bestBuyPrice).ToString(CultureInfo.InvariantCulture) : ""
// }));
// //_pt.PrintAndReset("9_3");
//}
////_pt.PrintAndReset("10");
//cmbStation.EndUpdate();
//cmbStationToStationFrom.EndUpdate();
//cmbStationToStationTo.EndUpdate();
//cbCommodity.EndUpdate();
////_pt.PrintAndReset("11");
//UpdateStationToStation();
////_pt.PrintAndReset("12");
//Cursor = oldCursor;
//}
private void setupCombobox(ComboBox CBRefreshed, List<KeyValuePair<string, string>> DDItems)
{
CBRefreshed.DataSource = null;
CBRefreshed.Items.Clear();
CBRefreshed.DataSource = DDItems;
CBRefreshed.ValueMember = "Key";
CBRefreshed.DisplayMember = "Value";
if (CBRefreshed.Items.Count > 0)
CBRefreshed.SelectedItem = CBRefreshed.Items[0];
else
CBRefreshed.SelectedItem = null;
CBRefreshed.Refresh();
}
示例10: PostItemChangedProvinceId
/// <summary>
/// 項目値変更後の処理 - プロヴィンスID
/// </summary>
/// <param name="control">プロヴィンスコンボボックス</param>
/// <param name="unit">ユニット</param>
private void PostItemChangedProvinceId(ComboBox control, Unit unit)
{
// 項目の値を更新する
UpdateItemValue(control, unit);
// 項目の色を更新する
control.Refresh();
}
示例11: AddItemstoComboBox
public static void AddItemstoComboBox(ComboBox pComboBox, List<ComboBoxItem> pItems)
{
pComboBox.DataSource = pItems;
pComboBox.DisplayMember = "key";
pComboBox.ValueMember = "value";
pComboBox.Refresh();
}
示例12: SetComboHeight
private void SetComboHeight(ComboBox ctrl, int iNewHeight)
{
const uint CB_SETITEMHEIGHT = 0x153;
SendMessage(ctrl.Handle, CB_SETITEMHEIGHT, -1, iNewHeight);
ctrl.Refresh();
}
示例13: isSelected
//presence validation for if a combo box is selected
public bool isSelected(ComboBox combobox, string name)
{
if (combobox.SelectedIndex < 0)
{
MessageBox.Show(name + " must be selected", "Error");
combobox.Refresh();
combobox.Focus();
return false;
}
return true;
}
示例14: AddControls
//.........这里部分代码省略.........
pLbl.Top = 0;
pCBox.Top = 5 + pLbl.Height;
pPnl.Width = c_ControlWidth;
pPnl.Margin = new Padding(0);
pPnl.Padding = new Padding(0);
pPnl.Top = 0;
pPnl.Left = 0;
pPnl.Height = pCBox.Height + pLbl.Height + 15;
pPnl.Controls.Add(pLbl);
pPnl.Controls.Add(pCBox);
pTbPg.Controls.Add(pPnl);
// pTbPg.Controls.Add(pCBox)
// MsgBox(pCBox.Items.Count)
pCBox.Visible = true;
string codeVal = "";
string displayVal = "";
Globals.DomainValuesAtIndex(0, (ICodedValueDomain)pCV, ref codeVal, ref displayVal);
pCBox.Text = displayVal;
//Try
//pCBox.SelectedIndex = 0
//Catch ex As Exception
//End Try
pCBox.Visible = true;
pCBox.Refresh();
// pNextControlTop = pCBox.Top + pCBox.Height + 7 + intLabelCtrlSpace
}
}
else if (pDom is RangeDomain)
{
IRangeDomain pRV = default(IRangeDomain);
//Create a lable for the field name
pLbl = new Label();
//Apply the field alias to the field name
pLbl.Text = strAli;
//Link the field to the name of the control
pLbl.Name = "lblEdit" + strfld;
//Add the control at the determined Location
pLbl.Left = 0;
pLbl.Top = 0;
//Apply global font
pLbl.Font = c_FntLbl;
//Create a graphics object to messure the text
g = pLbl.CreateGraphics();
s = g.MeasureString(pLbl.Text, pLbl.Font);
pLbl.Height = Convert.ToInt32(s.Height);
//If the text is larger then the control, truncate the control
if (s.Width >= c_ControlWidth)
{
pLbl.Width = c_ControlWidth;
//Use autosize if it fits
}
else
{
pLbl.AutoSize = true;
示例15: FillVariableCombo
/// <summary>
/// FillvariableCombo()
/// </summary>
/// <param name="cmb">ComboBox to be filled</param>
/// <param name="scopeWord">The scope of the variable</param>
protected void FillVariableCombo(ComboBox cmb, VariableType scopeWord)
{
cmb.Items.Clear();
List<EpiInfo.Plugin.IVariable> vars = this.EpiInterpreter.Context.GetVariablesInScope((VariableScope)scopeWord);
cmb.BeginUpdate();
foreach (EpiInfo.Plugin.IVariable var in vars)
{
if (!(var is Epi.Fields.PredefinedDataField))
{
cmb.Items.Add(var.Name.ToString());
}
}
cmb.EndUpdate();
cmb.Sorted = true;
cmb.Refresh();
}