当前位置: 首页>>代码示例>>C#>>正文


C# Forms.DataGridViewCellFormattingEventArgs类代码示例

本文整理汇总了C#中System.Windows.Forms.DataGridViewCellFormattingEventArgs的典型用法代码示例。如果您正苦于以下问题:C# DataGridViewCellFormattingEventArgs类的具体用法?C# DataGridViewCellFormattingEventArgs怎么用?C# DataGridViewCellFormattingEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataGridViewCellFormattingEventArgs类属于System.Windows.Forms命名空间,在下文中一共展示了DataGridViewCellFormattingEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: dgpreview_CellFormatting

 private void dgpreview_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     if (e.RowIndex > -1 && e.ColumnIndex > -1 && dgpreview.SelectedCells.Count > 0)
     {
         string n = dgpreview.Columns[e.ColumnIndex].Name;
         if (dgpreview.Rows[e.RowIndex].DataBoundItem != null)
         {
             if (n == "ActionInfo" && App.CurrentConfig.SteamIntegrationActivated)
             {
                 GamePreview gp = (GamePreview)dgpreview.Rows[e.RowIndex].DataBoundItem;
                 string t = "";
                 string k = Functions.Translation("keys");
                 if (gp.TargetGame.Keys.Count == 1) k = "key";
                 else if (gp.TargetGame.Keys.Count == 0) k = Functions.Translation("no key");
                 string keys = k;
                 if (gp.TargetGame.Keys.Count > 0) keys = gp.TargetGame.Keys.Count.ToString("N0") + " " + k;
                 switch (gp.Action)
                 {
                     case GamePreview.ImportAction.CreateANewGame:
                         t = string.Format(Functions.Translation("Create a new game and add {0}"), keys);
                         break;
                     case GamePreview.ImportAction.ImportKeysInExistingGame:
                         t = Functions.Translation("Import in a existing game");
                         break;
                     case GamePreview.ImportAction.UserActionRequired:
                         t = Functions.Translation("Not importable, please import this line manually");
                         break;
                 }
                 if (gp.ActionInfo.Length > 0) t += " (" + gp.ActionInfo + ")";
                 e.Value = t;
             }
         }
     }
 }
开发者ID:Alfred-Wallace,项目名称:GKeyBank,代码行数:34,代码来源:Import.cs

示例2: AmountCellFormating

 private void AmountCellFormating(DataGridView grd, DataGridViewCellFormattingEventArgs e)
 {
     if (grd.Columns[e.ColumnIndex].Name.Equals("Amount"))
     {
         e.Value = string.Format("CHF {0}.-", e.Value);
     }
 }
开发者ID:smermod,项目名称:TKDManager,代码行数:7,代码来源:frmPayments.cs

示例3: dataGridView_CellFormatting

 private void dataGridView_CellFormatting( object sender, DataGridViewCellFormattingEventArgs e )
 {
     if( (e.ColumnIndex == Offset.Index) && (e.Value != null) )
     {
         byte b = (byte)e.Value;
         e.Value = b.ToString( "X2" );
         e.FormattingApplied = true;
     }
     else if( e.ColumnIndex == ActionColumn.Index )
     {
         if( (e.RowIndex >= 0) && (e.ColumnIndex >= 0) &&
             (dataGridView[e.ColumnIndex, e.RowIndex] is DataGridViewComboBoxCell) &&
             (dataGridView.Rows[e.RowIndex].DataBoundItem is ActionMenu) )
         {
             ActionMenu menu = dataGridView.Rows[e.RowIndex].DataBoundItem as ActionMenu;
             if( menu.Default != null )
             {
                 ActionMenuEntry a = menu.Default.MenuAction;
                 if( a != (e.Value as ActionMenuEntry) )
                 {
                     e.CellStyle.BackColor = Color.Blue;
                     e.CellStyle.ForeColor = Color.White;
                 }
             }
         }
     }
 }
开发者ID:Wi150nZ,项目名称:lioneditor,代码行数:27,代码来源:AllActionMenusEditor.cs

示例4: ChangesViewCellFormatting

        private void ChangesViewCellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (changesView.Columns["img"] == null)
            {
                return;
            }

            if ((e.ColumnIndex == changesView.Columns["img"].Index) && (e.Value != null))
            {
                DataGridViewCell cell =
                    changesView.Rows[e.RowIndex].Cells[e.ColumnIndex];
                DataGridViewCell valueCell =
                    changesView.Rows[e.RowIndex].Cells["EventType"];
                var eventType = (int)valueCell.Value;

                switch (eventType)
                {
                    case 1:
                        cell.ToolTipText = "Добавлена пара";
                        break;
                    case 2:
                        cell.ToolTipText = "Отменена пара";
                        break;
                    case 3:
                        cell.ToolTipText = "Изменена аудитория";
                        break;
                    default:
                        cell.ToolTipText = "Страх и ужас";
                        break;

                }
            }
        }
开发者ID:BesuglovS,项目名称:UchOtd,代码行数:33,代码来源:Changes.cs

示例5: dataGridView_CellFormatting

 private void dataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     Vehicle vehicle = dataGridView.Rows[e.RowIndex].DataBoundItem as Vehicle;
         try
         {
             if (dataGridView.Columns[e.ColumnIndex].Name == "OriginId")
             {
                 e.Value = vehicle.OriginCustomer.Id;
             }
             else if (dataGridView.Columns[e.ColumnIndex].Name == "OriginName")
             {
                 e.Value = vehicle.OriginCustomer.Name;
             }
             else if (dataGridView.Columns[e.ColumnIndex].Name == "CurrentId")
             {
                 e.Value = vehicle.CurrentCustomer.Id;
             }
             else if (dataGridView.Columns[e.ColumnIndex].Name == "CurrentName")
             {
                 e.Value = vehicle.CurrentCustomer.Name;
             }
             else if (dataGridView.Columns[e.ColumnIndex].Name == "VehicleType")
             {
                 e.Value = vehicle.Vehicletype.Name;
             }
         }
         catch
         {
             MessageUtil.ShowTips("错误" + vehicle.Serial);
         }
 }
开发者ID:jilichao,项目名称:vtms,代码行数:31,代码来源:SearchForm.cs

示例6: DgSalesOrdersCellFormatting

        void DgSalesOrdersCellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            SalesOrderLine salesOrderLine = (SalesOrderLine)DgSalesOrders.Rows[e.RowIndex].DataBoundItem;

            switch (DgSalesOrders.Columns[e.ColumnIndex].DataPropertyName) {

                case "customer" :
                    e.Value = salesOrderLine.SalesOrder.Customer.name;
                    break;

                case "salesOrderDate" :
                    e.Value = string.Format( "{0:dd/MM/yyyy}", salesOrderLine.SalesOrder.salesOrderDate);
                    break;

                case "product" :
                    e.Value = salesOrderLine.Product.description;
                    break;

                case "status" :
                    e.Value = salesOrderLine.SalesOrderStatus.description;
                    e.CellStyle.BackColor = GetStatusColor(salesOrderLine.SalesOrderStatus);
                    break;

            }
        }
开发者ID:jlmonteagudo,项目名称:sales-order-processing,代码行数:25,代码来源:FormSalesOrdersManagement.cs

示例7: dataGridView1_CellFormatting

 private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     if (dataGridView1.Rows[e.RowIndex].Cells["saleheadstatusname"].Value.ToString() == "ยกเลิก")
     {
         dataGridView1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.LightPink;
     }
 }
开发者ID:itktc,项目名称:projectktc-v2,代码行数:7,代码来源:MainSaleRe.cs

示例8: DgvHead_CellFormatting

 private void DgvHead_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     if (DgvHead.Rows[e.RowIndex].Cells[12].Value.ToString() == "ยกเลิก")//สถานะรายงาน
     {
         DgvHead.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Red;
     }
 }
开发者ID:itktc,项目名称:projectktc-v2,代码行数:7,代码来源:frmMakingNetsWage.cs

示例9: dgvSyncData_CellFormatting

 /// <summary> 格式化
 /// </summary>
 private void dgvSyncData_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     if (e.Value == null || string.IsNullOrEmpty(e.Value.ToString()))
     {
         return;
     }
     string fieldNmae = dgvSyncDataLog.Columns[e.ColumnIndex].DataPropertyName;
     if (fieldNmae.Equals("business_name"))
     {
         DataSources.EnumInterfaceType enumInterfaceType = (DataSources.EnumInterfaceType)Convert.ToInt16(e.Value.ToString());
         e.Value = DataSources.GetDescription(enumInterfaceType, true);
     }
     if (fieldNmae.Equals("external_sys"))
     {
         DataSources.EnumExternalSys enumExternalSys = (DataSources.EnumExternalSys)Convert.ToInt16(e.Value.ToString());
         e.Value = DataSources.GetDescription(enumExternalSys, true);
     }
     if (fieldNmae.Equals("sync_direction"))
     {
         DataSources.EnumSyncDirection enumSyncDirection = (DataSources.EnumSyncDirection)Convert.ToInt16(e.Value.ToString());
         e.Value = DataSources.GetDescription(enumSyncDirection, true);
     }
     if (fieldNmae.Equals("sync_start_time") || fieldNmae.Equals("sync_end_time"))
     {
         long ticks = (long)e.Value;
         e.Value = Common.UtcLongToLocalDateTime(ticks);
     }
 }
开发者ID:caocf,项目名称:workspace-kepler,代码行数:30,代码来源:UCSyncDataLog.cs

示例10: gridFiles_CellFormatting

 private void gridFiles_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     var row = gridFiles.Rows[e.RowIndex];
     var file = (StatusFileForGrid) row.DataBoundItem;
     e.CellStyle.BackColor = GetGridFilesLocalColor(file.Type);
     e.CellStyle.SelectionBackColor = e.CellStyle.BackColor;
 }
开发者ID:urise,项目名称:GitSubmoduleManager,代码行数:7,代码来源:StatusForm.cs

示例11: dataGridView1_CellFormatting

        private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if(  dataGridView1.Columns[e.ColumnIndex].Name == "tgThucTe"
                ||
                dataGridView1.Columns[e.ColumnIndex].Name == "tgDung"){

            if (e.Value != null && e.Value != DBNull.Value)
                e.Value = ((TimeSpan)e.Value).Hours.ToString("00") + ":" +
                           ((TimeSpan)e.Value).Minutes.ToString("00");
                }
            //var hvh = (HistoryNhanVien)dataGridView1.Rows[e.RowIndex].DataBoundItem;
            //if (e.ColumnIndex == 0)
            //{
            //    e.Value = hvh.NhanVien.MaThe;
            //}
            //if (e.ColumnIndex == 1)
            //{
            //    e.Value = hvh.NhanVien.TenNhanVien;
            //}
            //if (e.ColumnIndex == 2) {
            //    e.Value = hvh.IsCheckin ? "Checkin" : "Checkout";
            //}
            //if (e.ColumnIndex == 4) {
            //    e.Value = (hvh.IsCheckin) ? DateTimeUtil.timeToString(hvh.Ca.GioBatDau) : DateTimeUtil.timeToString(hvh.Ca.GioKetThuc);
            //}
            //if (e.ColumnIndex == 5)
            //{
            //    e.Value = DateTimeUtil.timeToString( hvh.ThoiGian.TimeOfDay);
            //}
        }
开发者ID:hynguyen2610,项目名称:OlympicGym,代码行数:30,代码来源:FrmLichSuNhanVien.cs

示例12: dgvJuridicPersons_CellFormatting

 private void dgvJuridicPersons_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     if (dgvJuridicPersons.Columns[e.ColumnIndex].Name == "ColumnJuridicPersonAccountId")
     {
         e.Value = (e.Value as AccountDTO).Code;
     }
 }
开发者ID:JulianColaiacovo,项目名称:JuBrenFlo,代码行数:7,代码来源:FormJuridicPersons.cs

示例13: OnCellFormatting

        void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.ColumnIndex == 1)
            {

            }
        }
开发者ID:jpazarzis,项目名称:hogar,代码行数:7,代码来源:HandicappingFactorWorkbenchForm.cs

示例14: dataGridView_selectedCourses_CellFormatting

 private void dataGridView_selectedCourses_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     if (dataGridView_selectedCourses.Columns[e.ColumnIndex].HeaderText == "上课时间")
     {
         e.Value = Utils.DecodeTime(e.Value.ToString());
     }
 }
开发者ID:tsenmu,项目名称:elective-management-system,代码行数:7,代码来源:UserForm.cs

示例15: dgvPoints_CellFormatting

        private void dgvPoints_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            Point p = (Point)dgvPoints.Rows[e.RowIndex].DataBoundItem;

            switch (p.Type)
            {
                case BasicType.ANALOG_STATUS:
                    if (p.ValueAnalog.HasValue)
                        dgvPoints["dgvPoints_colValue", e.RowIndex].Value = p.ValueAnalog.ToString();
                    else
                        dgvPoints["dgvPoints_colValue", e.RowIndex].Value = "Unknown";

                    break;

                case BasicType.DIGITAL_STATUS:
                    if (p.ValueDigital.HasValue)
                        dgvPoints["dgvPoints_colValue", e.RowIndex].Value = p.ValueDigital > 0 ? "ON" : "OFF";
                    else
                        dgvPoints["dgvPoints_colValue", e.RowIndex].Value = "Unknown";

                    break;

                default:

                    break;
            }
        }
开发者ID:robrhce,项目名称:Tulip,代码行数:27,代码来源:frmPointSummary.cs


注:本文中的System.Windows.Forms.DataGridViewCellFormattingEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。