本文整理汇总了C#中System.Windows.Forms.DataGridViewRow.SetValues方法的典型用法代码示例。如果您正苦于以下问题:C# DataGridViewRow.SetValues方法的具体用法?C# DataGridViewRow.SetValues怎么用?C# DataGridViewRow.SetValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.DataGridViewRow
的用法示例。
在下文中一共展示了DataGridViewRow.SetValues方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddValidRow
private void AddValidRow(DataGridViewRow dr, Dictionary<string, string> results)
{
if (results.Count == 0) return;
// Prepare the new row
DataGridViewRow dgvr = new DataGridViewRow();
dgvr.CreateCells(gridViewResults);
DataGridViewCellStyle style = new DataGridViewCellStyle();
style.BackColor = Color.LightGreen;
style.ForeColor = Color.Black;
dgvr.Cells[3].Style = style;
// Based on the Crawling Settings, add the new data to the result grid view
switch (cs.CrawlItemType)
{
case "Social Media":
dgvr.SetValues(new object[] {count, dr.Cells[1].Value, dr.Cells[2].Value, "Valid", results["facebook"], results["linkedin"], results["twitter"], results["youtube"] });
SaveToDB(count, dr.Cells[1].Value, dr.Cells[2].Value, "Valid", results["facebook"], results["linkedin"], results["twitter"], results["youtube"]);
break;
case "Contact Info":
dgvr.SetValues(new object[] {count, dr.Cells[1].Value, dr.Cells[2].Value, "Valid", results["email"], results["phone"], results["fax"] });
break;
}
gridViewResults.Rows.Add(dgvr);
}
示例2: DialogShipGroupColumnFilter
public DialogShipGroupColumnFilter( DataGridView target, ShipGroupData group ) {
InitializeComponent();
var rows = new LinkedList<DataGridViewRow>();
var row = new DataGridViewRow();
row.CreateCells( ColumnView );
row.SetValues( "(全て)", null, null, "-" );
row.Cells[ColumnView_Width.Index].ReadOnly = true;
rows.AddLast( row );
foreach ( var c in group.ViewColumns.Values.OrderBy( c => c.DisplayIndex ) ) {
row = new DataGridViewRow();
row.CreateCells( ColumnView );
row.SetValues( target.Columns[c.Name].HeaderText, c.Visible, c.AutoSize, c.Width );
row.Cells[ColumnView_Width.Index].ValueType = typeof( int );
row.Tag = c.Name;
rows.AddLast( row );
}
ColumnView.Rows.AddRange( rows.ToArray() );
ScrLkColumnCount.Minimum = 0;
ScrLkColumnCount.Maximum = group.ViewColumns.Count;
ScrLkColumnCount.Value = group.ScrollLockColumnCount;
}
示例3: AddInvalidRow
private void AddInvalidRow(DataGridViewRow dr)
{
DataGridViewCellStyle style = new DataGridViewCellStyle();
style.BackColor = Color.Red;
style.ForeColor = Color.Black;
DataGridViewRow dgvr = new DataGridViewRow();
dgvr.CreateCells(gridViewResults);
dgvr.SetValues(new object[] {count, dr.Cells[1].Value, dr.Cells[2].Value, "Invalid" });
dgvr.Cells[3].Style = style;
gridViewResults.Rows.Add(dgvr);
}
示例4: AddNewTune
/// <summary>
/// Adds a new tune to the Tune List.
/// </summary>
/// <param name="assetNumber">Tune asset number</param>
/// <param name="tuneType">Tune type</param>
/// <param name="tuneDate">Tune date</param>
/// <param name="entryDate">Date tune entered into program</param>
/// <param name="staffMember">Tuning staff</param>
/// <param name="notes">Extra notes about the tune</param>
public void AddNewTune(string assetNumber, string tuneType, string tuneDate, string entryDate, string staffMember, string notes)
{
DataGridViewRow row = new DataGridViewRow();
row.CreateCells(mTuneListDGV);
bool rowSet = row.SetValues(assetNumber, tuneType, tuneDate, entryDate, staffMember, notes);
row.HeaderCell.Value = (1 + mTuneListDGV.Rows.Count).ToString() ;
mTuneListDGV.Rows.Add(row);
// The first entered row will be selected, we dont want this to happen.
if (mTuneListDGV.Rows.Count == 1)
{
mTuneListDGV.Rows[0].Selected = false;
// Now that the first row is inserted and unselected we can
// enable calls to OnSelectionChanged to actually do something
mAllowSelectionChange = true;
}
}
示例5: DialogShipGroupSortOrder
public DialogShipGroupSortOrder( DataGridView target, ShipGroupData group ) {
InitializeComponent();
var rows_enabled = new LinkedList<DataGridViewRow>();
var rows_disabled = new LinkedList<DataGridViewRow>();
var columns = target.Columns.Cast<DataGridViewColumn>();
var names = columns.Select( c => c.Name );
if ( group.SortOrder == null )
group.SortOrder = new List<KeyValuePair<string, ListSortDirection>>();
foreach ( var sort in group.SortOrder.Where( s => names.Contains( s.Key ) ) ) {
var row = new DataGridViewRow();
row.CreateCells( EnabledView );
row.SetValues( target.Columns[sort.Key].HeaderText, sort.Value );
row.Cells[EnabledView_Name.Index].Tag = sort.Key;
row.Tag = columns.FirstOrDefault( c => c.Name == sort.Key ).DisplayIndex;
rows_enabled.AddLast( row );
}
foreach ( var name in names.Where( n => group.SortOrder.Count( s => n == s.Key ) == 0 ) ) {
var row = new DataGridViewRow();
row.CreateCells( DisabledView );
row.SetValues( target.Columns[name].HeaderText );
row.Cells[DisabledView_Name.Index].Tag = name;
row.Tag = columns.FirstOrDefault( c => c.Name == name ).DisplayIndex;
rows_disabled.AddLast( row );
}
EnabledView.Rows.AddRange( rows_enabled.ToArray() );
DisabledView.Rows.AddRange( rows_disabled.ToArray() );
AutoSortFlag.Checked = group.AutoSortEnabled;
}
示例6: UpdateDataGrid
/// <summary>
/// 更新dataGridView
/// </summary>
/// <param name="_alarmlist"></param>
public void UpdateDataGrid(AlarmList _alarmlist)
{
dgvAlarmList.Rows.Clear();
int i = 0;
foreach (Alarm alarm in _alarmlist)
{
DataGridViewRow dgvr = new DataGridViewRow();
dgvr.SetValues(new object[4]);
dgvAlarmList.Rows.Add(dgvr);
dgvAlarmList.Rows[i].Cells["id"].Value = alarm.ID;
dgvAlarmList.Rows[i].Cells["unit"].Value = alarm.Unit;
dgvAlarmList.Rows[i].Cells["channel"].Value = alarm.Chanenl;
dgvAlarmList.Rows[i].Cells["action"].Value = alarm.AlarmEvent;
dgvAlarmList.Rows[i].Cells["time"].Value = alarm.Time;
//取出AlarmRoot
Data.AlarmRoot alarmRoot = new Data.AlarmRoot(Convert.ToInt32(alarm.Chanenl.IP), alarm.Unit.IP,
alarm.Chanenl.Code);
AlAlarmRoot.Add(alarmRoot.ToString());
i = i + 1;
}
dgv_Resize(dgvAlarmList);
//排序
if (dgvAlarmList.Columns != null)
{
// ReSharper disable AssignNullToNotNullAttribute
dgvAlarmList.Sort(dgvAlarmList.Columns["id"], ListSortDirection.Ascending);
// ReSharper restore AssignNullToNotNullAttribute
}
}
示例7: CreateShipViewRow
/// <summary>
/// ShipView用の新しい行のインスタンスを作成します。
/// </summary>
/// <param name="ship">追加する艦娘データ。</param>
private DataGridViewRow CreateShipViewRow( ShipData ship )
{
if ( ship == null ) return null;
DataGridViewRow row = new DataGridViewRow();
row.CreateCells( ShipView );
row.SetValues(
ship.MasterID,
ship.MasterShip.ShipType,
ship.MasterShip.Name,
ship.Level,
ship.ExpTotal,
ship.ExpNext,
ship.ExpNextRemodel,
new Fraction( ship.HPCurrent, ship.HPMax ),
ship.Condition,
new Fraction( ship.Fuel, ship.MasterShip.Fuel ),
new Fraction( ship.Ammo, ship.MasterShip.Ammo ),
GetEquipmentString( ship, 0 ),
GetEquipmentString( ship, 1 ),
GetEquipmentString( ship, 2 ),
GetEquipmentString( ship, 3 ),
GetEquipmentString( ship, 4 ),
ship.FleetWithIndex,
ship.RepairingDockID == -1 ? ship.RepairTime : -1000 + ship.RepairingDockID,
ship.FirepowerBase,
ship.FirepowerRemain,
ship.TorpedoBase,
ship.TorpedoRemain,
ship.AABase,
ship.AARemain,
ship.ArmorBase,
ship.ArmorRemain,
ship.ASWBase,
ship.EvasionBase,
ship.LOSBase,
ship.LuckBase,
ship.LuckRemain,
ship.IsLocked,
ship.SallyArea
);
row.Cells[ShipView_Name.Index].Tag = ship.ShipID;
row.Cells[ShipView_Level.Index].Tag = ship.ExpTotal;
{
DataGridViewCellStyle cs;
double hprate = (double)ship.HPCurrent / Math.Max( ship.HPMax, 1 );
if ( hprate <= 0.25 )
cs = CSRedRight;
else if ( hprate <= 0.50 )
cs = CSOrangeRight;
else if ( hprate <= 0.75 )
cs = CSYellowRight;
else if ( hprate < 1.00 )
cs = CSGreenRight;
else
cs = CSDefaultRight;
row.Cells[ShipView_HP.Index].Style = cs;
}
{
DataGridViewCellStyle cs;
if ( ship.Condition < 20 )
cs = CSRedRight;
else if ( ship.Condition < 30 )
cs = CSOrangeRight;
else if ( ship.Condition < Utility.Configuration.Config.Control.ConditionBorder )
cs = CSYellowRight;
else if ( ship.Condition < 50 )
cs = CSDefaultRight;
else
cs = CSGreenRight;
row.Cells[ShipView_Condition.Index].Style = cs;
}
row.Cells[ShipView_Fuel.Index].Style = ship.Fuel < ship.MasterShip.Fuel ? CSYellowRight : CSDefaultRight;
row.Cells[ShipView_Ammo.Index].Style = ship.Fuel < ship.MasterShip.Fuel ? CSYellowRight : CSDefaultRight;
{
DataGridViewCellStyle cs;
if ( ship.RepairTime == 0 )
cs = CSDefaultRight;
else if ( ship.RepairTime < 1000 * 60 * 60 )
cs = CSYellowRight;
else if ( ship.RepairTime < 1000 * 60 * 60 * 6 )
cs = CSOrangeRight;
else
cs = CSRedRight;
row.Cells[ShipView_RepairTime.Index].Style = cs;
}
row.Cells[ShipView_FirepowerRemain.Index].Style = ship.FirepowerRemain == 0 ? CSGrayRight : CSDefaultRight;
row.Cells[ShipView_TorpedoRemain.Index].Style = ship.TorpedoRemain == 0 ? CSGrayRight : CSDefaultRight;
row.Cells[ShipView_AARemain.Index].Style = ship.AARemain == 0 ? CSGrayRight : CSDefaultRight;
row.Cells[ShipView_ArmorRemain.Index].Style = ship.ArmorRemain == 0 ? CSGrayRight : CSDefaultRight;
//.........这里部分代码省略.........
示例8: LoadFiles
private void LoadFiles( string path ) {
if ( !Directory.Exists( path ) ) return;
CurrentPath = path;
APIView.Rows.Clear();
var rows = new LinkedList<DataGridViewRow>();
foreach ( string file in Directory.GetFiles( path, "*.json", SearchOption.TopDirectoryOnly ) ) {
var row = new DataGridViewRow();
row.CreateCells( APIView );
row.SetValues( Path.GetFileName( file ) );
rows.AddLast( row );
}
APIView.Rows.AddRange( rows.ToArray() );
APIView.Sort( APIView_FileName, ListSortDirection.Ascending );
}
示例9: UpdateDetailView
/// <summary>
/// 詳細ビューを更新します。
/// </summary>
private void UpdateDetailView( int equipmentID )
{
DetailView.SuspendLayout();
DetailView.Rows.Clear();
//装備数カウント
var eqs = KCDatabase.Instance.Equipments.Values.Where( eq => eq.EquipmentID == equipmentID );
var countlist = new IDDictionary<DetailCounter>();
foreach ( var eq in eqs ) {
var c = countlist[DetailCounter.CalculateID( eq )];
if ( c == null ) {
countlist.Add( new DetailCounter( eq.Level, eq.AircraftLevel ) );
c = countlist[DetailCounter.CalculateID( eq )];
}
c.countAll++;
c.countRemain++;
c.countRemainPrev++;
}
//装備艦集計
foreach ( var ship in KCDatabase.Instance.Ships.Values ) {
foreach ( var eq in ship.AllSlotInstance.Where( s => s != null && s.EquipmentID == equipmentID ) ) {
countlist[DetailCounter.CalculateID( eq )].countRemain--;
}
foreach ( var c in countlist.Values ) {
if ( c.countRemain != c.countRemainPrev ) {
int diff = c.countRemainPrev - c.countRemain;
c.equippedShips.Add( ship.NameWithLevel + ( diff > 1 ? ( " x" + diff ) : "" ) );
c.countRemainPrev = c.countRemain;
}
}
}
//行に反映
var rows = new List<DataGridViewRow>( eqs.Count() );
foreach ( var c in countlist.Values ) {
if ( c.equippedShips.Count() == 0 ) {
c.equippedShips.Add( "" );
}
foreach ( var s in c.equippedShips ) {
var row = new DataGridViewRow();
row.CreateCells( DetailView );
row.SetValues( c.level, c.aircraftLevel, c.countAll, c.countRemain, s );
rows.Add( row );
}
}
DetailView.Rows.AddRange( rows.ToArray() );
DetailView.Sort( DetailView_AircraftLevel, ListSortDirection.Ascending );
DetailView.Sort( DetailView_Level, ListSortDirection.Ascending );
DetailView.ResumeLayout();
Text = "装備一覧 - " + KCDatabase.Instance.MasterEquipments[equipmentID].Name;
}
示例10: DialogAlbumMasterShip
//.........这里部分代码省略.........
PowerUpFirepower.ImageList =
PowerUpTorpedo.ImageList =
PowerUpAA.ImageList =
PowerUpArmor.ImageList =
RemodelBeforeLevel.ImageList =
RemodelBeforeAmmo.ImageList =
RemodelBeforeSteel.ImageList =
RemodelAfterLevel.ImageList =
RemodelAfterAmmo.ImageList =
RemodelAfterSteel.ImageList =
ResourceManager.Instance.Icons;
TitleAirSuperiority.ImageList =
TitleDayAttack.ImageList =
TitleNightAttack.ImageList =
Equipment1.ImageList =
Equipment2.ImageList =
Equipment3.ImageList =
Equipment4.ImageList =
Equipment5.ImageList =
ResourceManager.Instance.Equipments;
TitleHP.ImageIndex = (int)ResourceManager.IconContent.ParameterHP;
TitleFirepower.ImageIndex = (int)ResourceManager.IconContent.ParameterFirepower;
TitleTorpedo.ImageIndex = (int)ResourceManager.IconContent.ParameterTorpedo;
TitleAA.ImageIndex = (int)ResourceManager.IconContent.ParameterAA;
TitleArmor.ImageIndex = (int)ResourceManager.IconContent.ParameterArmor;
TitleASW.ImageIndex = (int)ResourceManager.IconContent.ParameterASW;
TitleEvasion.ImageIndex = (int)ResourceManager.IconContent.ParameterEvasion;
TitleLOS.ImageIndex = (int)ResourceManager.IconContent.ParameterLOS;
TitleLuck.ImageIndex = (int)ResourceManager.IconContent.ParameterLuck;
TitleSpeed.ImageIndex = (int)ResourceManager.IconContent.ParameterSpeed;
TitleRange.ImageIndex = (int)ResourceManager.IconContent.ParameterRange;
Fuel.ImageIndex = (int)ResourceManager.IconContent.ResourceFuel;
Ammo.ImageIndex = (int)ResourceManager.IconContent.ResourceAmmo;
TitleBuildingTime.ImageIndex = (int)ResourceManager.IconContent.FormArsenal;
MaterialFuel.ImageIndex = (int)ResourceManager.IconContent.ResourceFuel;
MaterialAmmo.ImageIndex = (int)ResourceManager.IconContent.ResourceAmmo;
MaterialSteel.ImageIndex = (int)ResourceManager.IconContent.ResourceSteel;
MaterialBauxite.ImageIndex = (int)ResourceManager.IconContent.ResourceBauxite;
PowerUpFirepower.ImageIndex = (int)ResourceManager.IconContent.ParameterFirepower;
PowerUpTorpedo.ImageIndex = (int)ResourceManager.IconContent.ParameterTorpedo;
PowerUpAA.ImageIndex = (int)ResourceManager.IconContent.ParameterAA;
PowerUpArmor.ImageIndex = (int)ResourceManager.IconContent.ParameterArmor;
RemodelBeforeAmmo.ImageIndex = (int)ResourceManager.IconContent.ResourceAmmo;
RemodelBeforeSteel.ImageIndex = (int)ResourceManager.IconContent.ResourceSteel;
RemodelAfterAmmo.ImageIndex = (int)ResourceManager.IconContent.ResourceAmmo;
RemodelAfterSteel.ImageIndex = (int)ResourceManager.IconContent.ResourceSteel;
TitleAirSuperiority.ImageIndex = (int)ResourceManager.EquipmentContent.CarrierBasedFighter;
TitleDayAttack.ImageIndex = (int)ResourceManager.EquipmentContent.Seaplane;
TitleNightAttack.ImageIndex = (int)ResourceManager.EquipmentContent.Torpedo;
ParameterLevel.Value = ParameterLevel.Maximum = ExpTable.ShipMaximumLevel;
TableBattle.Visible = false;
BasePanelShipGirl.Visible = false;
ControlHelper.SetDoubleBuffered( TableShipName );
ControlHelper.SetDoubleBuffered( TableParameterMain );
ControlHelper.SetDoubleBuffered( TableParameterSub );
ControlHelper.SetDoubleBuffered( TableConsumption );
ControlHelper.SetDoubleBuffered( TableEquipment );
ControlHelper.SetDoubleBuffered( TableArsenal );
ControlHelper.SetDoubleBuffered( TableRemodel );
ControlHelper.SetDoubleBuffered( TableBattle );
ControlHelper.SetDoubleBuffered( ShipView );
//ShipView Initialize
ShipView.SuspendLayout();
ShipView_ShipID.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
ShipView_ShipType.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
ShipView.Rows.Clear();
List<DataGridViewRow> rows = new List<DataGridViewRow>( KCDatabase.Instance.MasterShips.Values.Count( s => s.Name != "なし" ) );
foreach ( var ship in KCDatabase.Instance.MasterShips.Values ) {
if ( ship.Name == "なし" ) continue;
DataGridViewRow row = new DataGridViewRow();
row.CreateCells( ShipView );
row.SetValues( ship.ShipID, KCDatabase.Instance.ShipTypes[ship.ShipType].Name, ship.NameWithClass );
rows.Add( row );
}
ShipView.Rows.AddRange( rows.ToArray() );
ShipView_ShipID.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
ShipView_ShipType.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
ShipView.Sort( ShipView_ShipID, ListSortDirection.Ascending );
ShipView.ResumeLayout();
}
示例11: DialogAlbumMasterEquipment
public DialogAlbumMasterEquipment() {
InitializeComponent();
TitleFirepower.ImageList =
TitleTorpedo.ImageList =
TitleAA.ImageList =
TitleArmor.ImageList =
TitleASW.ImageList =
TitleEvasion.ImageList =
TitleLOS.ImageList =
TitleAccuracy.ImageList =
TitleBomber.ImageList =
TitleSpeed.ImageList =
TitleRange.ImageList =
Rarity.ImageList =
MaterialFuel.ImageList =
MaterialAmmo.ImageList =
MaterialSteel.ImageList =
MaterialBauxite.ImageList =
ResourceManager.Instance.Icons;
EquipmentType.ImageList = ResourceManager.Instance.Equipments;
TitleFirepower.ImageIndex = (int)ResourceManager.IconContent.ParameterFirepower;
TitleTorpedo.ImageIndex = (int)ResourceManager.IconContent.ParameterTorpedo;
TitleAA.ImageIndex = (int)ResourceManager.IconContent.ParameterAA;
TitleArmor.ImageIndex = (int)ResourceManager.IconContent.ParameterArmor;
TitleASW.ImageIndex = (int)ResourceManager.IconContent.ParameterASW;
TitleEvasion.ImageIndex = (int)ResourceManager.IconContent.ParameterEvasion;
TitleLOS.ImageIndex = (int)ResourceManager.IconContent.ParameterLOS;
TitleAccuracy.ImageIndex = (int)ResourceManager.IconContent.ParameterAccuracy;
TitleBomber.ImageIndex = (int)ResourceManager.IconContent.ParameterBomber;
TitleSpeed.ImageIndex = (int)ResourceManager.IconContent.ParameterSpeed;
TitleRange.ImageIndex = (int)ResourceManager.IconContent.ParameterRange;
MaterialFuel.ImageIndex = (int)ResourceManager.IconContent.ResourceFuel;
MaterialAmmo.ImageIndex = (int)ResourceManager.IconContent.ResourceAmmo;
MaterialSteel.ImageIndex = (int)ResourceManager.IconContent.ResourceSteel;
MaterialBauxite.ImageIndex = (int)ResourceManager.IconContent.ResourceBauxite;
BasePanelEquipment.Visible = false;
ControlHelper.SetDoubleBuffered( TableEquipmentName );
ControlHelper.SetDoubleBuffered( TableParameterMain );
ControlHelper.SetDoubleBuffered( TableParameterSub );
ControlHelper.SetDoubleBuffered( TableArsenal );
ControlHelper.SetDoubleBuffered( EquipmentView );
//Initialize EquipmentView
EquipmentView.SuspendLayout();
EquipmentView_ID.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
EquipmentView_Icon.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
//EquipmentView_Type.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
EquipmentView.Rows.Clear();
List<DataGridViewRow> rows = new List<DataGridViewRow>( KCDatabase.Instance.MasterEquipments.Values.Count( s => s.Name != "なし" ) );
foreach ( var eq in KCDatabase.Instance.MasterEquipments.Values ) {
if ( eq.Name == "なし" ) continue;
DataGridViewRow row = new DataGridViewRow();
row.CreateCells( EquipmentView );
row.SetValues( eq.EquipmentID, eq.IconType, FormMain.Instance.Translator.GetTranslation(eq.CategoryTypeInstance.Name, Utility.TranslationType.EquipmentType), eq.Name );
rows.Add( row );
}
EquipmentView.Rows.AddRange( rows.ToArray() );
EquipmentView_ID.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
EquipmentView_Icon.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
//EquipmentView_Type.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
EquipmentView.Sort( EquipmentView_ID, ListSortDirection.Ascending );
EquipmentView.ResumeLayout();
}
示例12: UpdateBGMPlayerUI
private void UpdateBGMPlayerUI()
{
BGMPlayer_ControlGrid.Rows.Clear();
var rows = new DataGridViewRow[BGMHandles.Count];
int i = 0;
foreach ( var h in BGMHandles.Values ) {
var row = new DataGridViewRow();
row.CreateCells( BGMPlayer_ControlGrid );
row.SetValues( h.Enabled, h.HandleID, h.Path );
rows[i] = row;
i++;
}
BGMPlayer_ControlGrid.Rows.AddRange( rows );
BGMPlayer_VolumeAll.Value = (int)BGMHandles.Values.Average( h => h.Volume );
}
示例13: BindRow
void BindRow(DataGridViewRow row)
{
var vals = new object[Grid.Columns.Count];
var t = (Test)row.Tag;
if (t == null) throw new InvalidOperationException ("Row has no associated Test");
if (t.Result == TestResult.Pass) {
vals[_resultImageColIndex] = AllImages.Images[PassStatusIcon];
}
else if (t.Result == TestResult.Fail) {
vals[_resultImageColIndex] = AllImages.Images[FailStatusIcon];
}
else if (t.Result == TestResult.Unknown) {
vals[_resultImageColIndex] = AllImages.Images[UnknownStatusIcon];
}
if (!_funcElm.IsShared) {
vals[_thisColIndex] = t.ThisString;
}
foreach (var p in _paramInfos) {
var arg = t.GetArgument (p.Name);
vals[p.ColIndex] = arg.ValueString;
}
if (_testType == TestType.Function || _testType == TestType.PropertyGetter) {
vals[_resultColIndex] = t.ValueString;
vals[_expectedColIndex] = t.ExpectedValueString;
}
vals[_assertColIndex] = t.AssertString;
vals[_failColIndex] = TrimCellText (t.FailInfo);
row.SetValues (vals);
}
示例14: refresh
public void refresh(string connectionString)
{
List<int> focus_ids = new List<int>();
foreach (DataGridViewRow row in SelectedRows)
{
focus_ids.Add(row.Index);
}
int scrollIndexDiff = 0;
try {
scrollIndexDiff = this.SelectedRows[0].Index - this.FirstDisplayedScrollingRowIndex;
}
catch { }
Rows.Clear();
try
{
using (SqlConnection con = new SqlConnection(connectionString))
{
con.Open();
using (SqlCommand command = new SqlCommand(SelectQuery, con))
{
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
object[] values = new object[reader.FieldCount];
reader.GetValues(values);
DataGridViewRow row = new DataGridViewRow();
row.CreateCells(this);
row.SetValues(values);
this.Rows.Add(row);
}
reader.Close();
}
con.Close();
}
}
catch { }
tablestrip.filter_use(this);
foreach (DataGridViewRow row in Rows)
{
if (focus_ids.Contains(row.Index))
{
row.Selected = true;
}
else
{
row.Selected = false;
}
}
int scrollIndex = 0;
try { scrollIndex = this.SelectedRows[0].Index; } catch { }
while (scrollIndexDiff != 0)
{
if (scrollIndex == 0)
{
foreach (DataGridViewRow row in this.Rows)
{
if (row.Visible == true)
{
scrollIndex = row.Index;
break;
}
}
break;
}
scrollIndex--;
if (this.Rows[scrollIndex].Visible == true)
{
scrollIndexDiff--;
}
}
this.FirstDisplayedScrollingRowIndex = scrollIndex;
}
示例15: ClearQuestView
private void ClearQuestView() {
QuestView.Rows.Clear();
{
DataGridViewRow row = new DataGridViewRow();
row.CreateCells( QuestView );
row.SetValues( null, null, null, GeneralRes.Unacquired, null );
QuestView.Rows.Add( row );
}
}