コード例 #1
0
ファイル: FrmTranbound.cs プロジェクト: zanderphh/penglang
 private void tranboundView_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     if (e.Column.FieldName == "Status")
     {
         e.DisplayText = GetStatusCaption(e.CellValue.ToString());
     }
 }
 void view_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     if (e.RowHandle == GridControl.NewItemRowHandle)
     {
         e.Handled = true;
     }
 }
コード例 #3
0
        protected void BandedView_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            BandedGridView bandedView = (BandedGridView)MainView;

            //Hiển thị lương theo nhóm ca
            int focusedRowHandle = e.RowHandle;

            if (focusedRowHandle >= 0)
            {
                HREmployeePayRollsInfo objEmployeePayRollsInfo = bandedView.GetRow(focusedRowHandle) as HREmployeePayRollsInfo;
                if (objEmployeePayRollsInfo != null)
                {
                    foreach (var item in WorkingShiftGroupsList)
                    {
                        if (item.ADWorkingShiftGroupID > 0)
                        {
                            if (e.Column.FieldName == item.ADWorkingShiftGroupID.ToString())
                            {
                                decimal total = (decimal)objEmployeePayRollsInfo.HREmployeePayrollDetailsList.
                                                Where(o => o.HREmployeeTimeSheetOTDetailName == item.ADWorkingShiftGroupID.ToString() &&
                                                      !o.IsOT).
                                                Sum(o => o.HREmployeePayrollHours);

                                e.DisplayText = total.ToString("n4");
                            }
                            else if (e.Column.FieldName == "L" + item.ADWorkingShiftGroupID.ToString())
                            {
                                decimal total = (decimal)objEmployeePayRollsInfo.HREmployeePayrollDetailsList.
                                                Where(o => o.HREmployeeTimeSheetOTDetailName == item.ADWorkingShiftGroupID.ToString() &&
                                                      !o.IsOT).
                                                Sum(o => o.HREmployeePayrollSalaryFactor);

                                e.DisplayText = total.ToString("n0");
                            }
                        }
                    }

                    foreach (var item in OTFactorlist)
                    {
                        if (e.Column.FieldName == string.Format("TC{0}", item.ADOTFactorID.ToString()))
                        {
                            decimal total = (decimal)objEmployeePayRollsInfo.HREmployeePayrollDetailsList.
                                            Where(o => o.HREmployeeTimeSheetOTDetailName == item.ADOTFactorID.ToString() &&
                                                  o.IsOT).
                                            Sum(o => o.HREmployeePayrollHourFactor);
                            e.DisplayText = total.ToString("n5");
                        }
                        else if (e.Column.FieldName == string.Format("LTC{0}", item.ADOTFactorID.ToString()))
                        {
                            decimal total = (decimal)objEmployeePayRollsInfo.HREmployeePayrollDetailsList.
                                            Where(o => o.HREmployeeTimeSheetOTDetailName == item.ADOTFactorID.ToString() &&
                                                  o.IsOT).
                                            Sum(o => o.HREmployeePayrollSalaryFactor);

                            e.DisplayText = total.ToString("n0");
                        }
                    }
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// 自定义绘制单元格显示值。
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void UndoGridView_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     if (e.Column == this.gcolRowNum)
     {
         e.DisplayText = Convert.ToString(e.RowHandle + 1);
     }
 }
コード例 #5
0
 private static void V_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     if (e.Column.Name == "_xh")
     {
         e.DisplayText = (e.RowHandle + 1).ToString();
     }
 }
コード例 #6
0
        void GridViewOnCustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            BaseEditViewInfo info = ((GridCellInfo)e.Cell).ViewInfo;
            var   enumDescriptor  = new EnumDescriptor(typeof(ErrorType));
            var   row             = ((GridView)sender).GetRow(e.RowHandle);
            var   resultItem      = row as DisplayableValidationResultItem;
            Image errorIcon       = null;

            if (resultItem != null)
            {
                errorIcon = ErrorIcon(resultItem, enumDescriptor);
            }
            else if (Columns.Any())
            {
                var keyValuePairs = Columns.SelectMany(types => types);
                var propertyName  = e.Column.PropertyName();
                Func <KeyValuePair <ColumnWrapper, Validation.RuleType.RuleType>, bool> predicate = pair => propertyName == pair.Key.PropertyName;
                if (keyValuePairs.Any(predicate))
                {
                    var caption = keyValuePairs.Last(predicate).Value.ToString();
                    errorIcon = DXErrorProvider.GetErrorIconInternal((ErrorType)enumDescriptor.ParseCaption(caption));
                }
            }
            if (errorIcon != null)
            {
                info.ErrorIcon = errorIcon;
                info.CalcViewInfo(e.Graphics);
            }
        }
        private void gridView1_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            if (showDifferent == false)
            {
                return;
            }

            if (e.Column.FieldName != "调整金额")
            {
                return;
            }

            e.Appearance.ForeColor = Color.Black;
            e.Appearance.BackColor = Color.Transparent;

            AdjustJobGrade row = gridView1.GetRow(e.RowHandle) as AdjustJobGrade;

            if (row != null)
            {
                if (row.is_separator)
                {
                    return;
                }

                foreach (ModifyField field in row.内容不同的字段)
                {
                    if (field.称 == e.Column.FieldName)
                    {
                        e.Appearance.ForeColor = Color.Yellow;
                        e.Appearance.BackColor = Color.Red;
                    }
                }
            }
        }
コード例 #8
0
        private void gridView1_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            if (showDifferent == false) return;

            if (e.Column.FieldName.StartsWith("R") == false && 
                e.Column.FieldName != "职等数" && 
                e.Column.FieldName != "对比的职等" &&
                e.Column.FieldName != "年调" &&
                e.Column.FieldName != "年调率"
                ) return;

            e.Appearance.ForeColor = Color.Black;
            e.Appearance.BackColor = Color.Transparent;

            AdjustJobGrade row = gridView1.GetRow(e.RowHandle) as AdjustJobGrade;
            if (row != null)
            {
                if (row.is_separator) return;

                foreach (ModifyField field in row.内容不同的字段)
                {
                    if (field.名称 == e.Column.FieldName)
                    {
                        e.Appearance.ForeColor = Color.Yellow;
                        e.Appearance.BackColor = Color.Red;
                    }
                }
            }
        }
        void _View_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            if (_ActiveFilter == string.Empty)
            {
                return;
            }
            int index = e.DisplayText.IndexOf(_ActiveFilter);

            if (index < 0)
            {
                return;
            }
            e.Handled = true;
            var inf             = (e.Cell as GridCellInfo);
            TextEditViewInfo vi = inf.ViewInfo as TextEditViewInfo;

            e.Appearance.FillRectangle(e.Cache, e.Bounds);
            MultiColorDrawStringParams args = new MultiColorDrawStringParams(e.Appearance);

            args.Bounds = e.Bounds;
            args.Text   = e.DisplayText;
            args.Appearance.Assign(e.Appearance);
            AppearanceDefault apperance = LookAndFeelHelper.GetHighlightSearchAppearance(vi.LookAndFeel, !vi.UseHighlightSearchAppearance);

            e.Cache.Paint.DrawMultiColorString(e.Cache, e.Bounds, e.DisplayText, _ActiveFilter, vi.PaintAppearance, vi.PaintAppearance.GetTextOptions().GetStringFormat(vi.DefaultTextOptions),
                                               apperance.ForeColor, apperance.BackColor, false, index);
        }
コード例 #10
0
ファイル: MappingView.cs プロジェクト: valdiman/PK-Sim
        /// <summary>
        ///   This event handler mask all cells with special coloring if the cell value is not present in the combo box list of values for that column.
        /// </summary>
        private static void OnCustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            if (e.CellValue == null)
            {
                return;
            }
            bool isValueInList = false;

            if (e.Column.FieldName == DatabaseConfiguration.MappingColumns.COL_CONTAINER)
            {
                var comboBox = e.Column.ColumnEdit as RepositoryItemImageComboBox;
                if (comboBox != null)
                {
                    isValueInList |= (comboBox.Items.GetItem(e.CellValue) != null);
                }
            }
            else if (e.Column.FieldName == DatabaseConfiguration.MappingColumns.COL_TISSUE)
            {
                var comboBox = e.Column.ColumnEdit as RepositoryItemComboBox;
                if (comboBox != null)
                {
                    isValueInList |= comboBox.Items.Contains(e.CellValue);
                }
            }
            isValueInList |= (e.CellValue.ToString().Length == 0);

            e.Appearance.BeginUpdate();
            if (!isValueInList)
            {
                e.Appearance.ForeColor  = Color.Blue;
                e.Appearance.BackColor2 = Color.LightYellow;
            }
            e.Appearance.EndUpdate();
        }
コード例 #11
0
        private void layoutView_CustomDrawCardFieldValue(object sender, RowCellCustomDrawEventArgs e)
        {
            bool hovering   = HoverCard != null && e.RowHandle == HoverCard.RowHandle;
            bool isSideBand = e.Column == colLayoutSpacer;

            if (isSideBand)
            {
                e.Appearance.BackColor = hovering ? Color.FromArgb(140, 176, 89) : Color.FromArgb(146, 180, 93);
            }
            else
            {
                Color      generalColor = Color.FromArgb(231, 231, 231);
                LayoutView cardView     = sender as LayoutView;
                if (cardView != null)
                {
                    object       rowData = cardView.GetRow(e.RowHandle);
                    PropertyInfo proInfo = rowData.GetType().GetProperty("BgColor");
                    if (proInfo != null)
                    {
                        object colorValue = proInfo.GetValue(rowData, null);
                        if (colorValue is Color)
                        {
                            generalColor = (Color)colorValue;
                        }
                    }
                }
                e.Appearance.BackColor = hovering ? Color.FromArgb(236, 234, 235) : generalColor;// Color.FromArgb(231, 231, 231);
            }
        }
コード例 #12
0
        private void DrawFixedCells(RowCellCustomDrawEventArgs e)
        {
            EmployeePlanningWeek empl = GetEntityByRowHandle(e.RowHandle);

            if (Context != null)
            {
                if (e.Column == gc_PlusMinusHours)
                {
                    int value = empl.CountWeeklyPlusMinusHours;

                    Color color = Context.CountryColors.GetColorByEmployeePlusMinus(value);
                    e.Appearance.ForeColor = color;
                }
                if (e.Column == gc_SummOfAdditionalCharges)
                {
                    int value = empl.CountWeeklyAdditionalCharges;

                    Color color = Context.CountryColors.GetColorByEmployeeAdditionalCharges(value);
                    e.Appearance.ForeColor = color;
                }
                if (e.Column == gc_EmployeeBalanceHours)
                {
                    int value = empl.Saldo;

                    Color color = Context.CountryColors.GetColorByEmployeeBalanceHours(value);
                    e.Appearance.ForeColor = color;
                }
            }

            Painters.DrawFixedCells(e, empl.FullName, e.RowHandle == gridView.FocusedRowHandle);

            e.Handled = true;
        }
コード例 #13
0
        private void gridView1_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            DataRow row = gridView1.GetDataRow(e.RowHandle);

            if (row == null)
            {
                return;
            }
            if (row["运输服务完毕"].ToString() == "N")
            {
                //e.Appearance.BackColor = Color.OrangeRed;
                e.Appearance.ForeColor = Color.OrangeRed;
            }
            else if (row["运输服务完毕"].ToString() == "Y")
            {
                //e.Appearance.BackColor = Color.Green;
                e.Appearance.ForeColor = Color.Green;
            }

            if (e.RowHandle == gridView1.FocusedRowHandle)
            {
                e.Appearance.ForeColor = Color.White;
                e.Appearance.BackColor = Color.RoyalBlue;
            }
        }
コード例 #14
0
        private void gridView1_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            var view = sender as GridView;

            if (e.Column.VisibleIndex == 0 &&
                view.OptionsDetail.SmartDetailExpandButtonMode != DetailExpandButtonMode.AlwaysEnabled)
            {
                bool isMasterRowEmpty;
                if (view.OptionsDetail.SmartDetailExpandButtonMode == DetailExpandButtonMode.CheckAllDetails)
                {
                    isMasterRowEmpty = true;
                    for (var i = 0; i < view.GetRelationCount(e.RowHandle); i++)
                    {
                        if (!view.IsMasterRowEmptyEx(e.RowHandle, i))
                        {
                            isMasterRowEmpty = false;
                            break;
                        }
                    }
                }
                else
                {
                    isMasterRowEmpty = view.IsMasterRowEmpty(e.RowHandle);
                }

                if (isMasterRowEmpty)
                {
                    //(e.Cell as GridCellInfo).CellButtonRect = Rectangle.Empty;
                }
            }
        }
コード例 #15
0
        private void grdView_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            if (e.RowHandle < 0)
            {
                return;
            }

            bool selected = false;

            if (grdView.SelectedRowsCount > 0)
            {
                selected = Array.IndexOf <int>(grdView.GetSelectedRows(), e.RowHandle) >= 0;
            }

            if (e.CellValue == null || e.CellValue.GetType() == typeof(DBNull))
            {
                e.DisplayText = NullValueDisplayText;
                e.Appearance.TextOptions.VAlignment = DevExpress.Utils.VertAlignment.Center;
                e.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;

                if (!selected)
                {
                    e.Appearance.BackColor = NullValueBackColor;
                    e.Appearance.ForeColor = NullValueForeColor;
                }
            }
        }
コード例 #16
0
        void _View_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            if (_ActiveFilter == string.Empty)
            {
                return;
            }
            int index = e.DisplayText.IndexOf(_ActiveFilter);

            if (index < 0)
            {
                return;
            }
            e.Handled = true;
            e.Appearance.FillRectangle(e.Cache, e.Bounds);
            MultiColorDrawStringParams args = new MultiColorDrawStringParams(e.Appearance);

            args.Bounds = e.Bounds;
            args.Text   = e.DisplayText;
            args.Appearance.Assign(e.Appearance);
            AppearanceObject         apperance    = _View.PaintAppearance.SelectedRow;
            CharacterRangeWithFormat defaultRange = new CharacterRangeWithFormat(0, e.DisplayText.Length, e.Appearance.ForeColor, e.Appearance.BackColor);
            CharacterRangeWithFormat range        = new CharacterRangeWithFormat(index, _ActiveFilter.Length, apperance.ForeColor, apperance.BackColor);

            args.Ranges = new CharacterRangeWithFormat[] { defaultRange, range };
            paint.MultiColorDrawString(e.Cache, args);
        }
コード例 #17
0
        private void gridView1_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            GridView view = (GridView)sender;

            if (!view.OptionsView.ShowAutoFilterRow || !view.IsDataRow(e.RowHandle))
            {
                return;
            }

            string filterCellText = txtSearch.Text;// view.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, e.Column);

            if (String.IsNullOrEmpty(filterCellText))
            {
                return;
            }

            int filterTextIndex = e.DisplayText.IndexOf(filterCellText, StringComparison.CurrentCultureIgnoreCase);

            if (filterTextIndex == -1)
            {
                return;
            }

            XPaint.Graphics.DrawMultiColorString(e.Cache, e.Bounds, e.DisplayText, filterCellText, e.Appearance, Color.Black, Color.Gold, false, filterTextIndex);
            e.Handled = true;
        }
 private void UpdateButtonCollection(object view, RowCellCustomDrawEventArgs e, EditorButtonObjectCollection buttonCollection, ExtendedButtonEditViewInfo viewInfo)
 {
     foreach (EditorButtonObjectInfoArgs args in buttonCollection)
     {
         viewInfo.CustomButtonCaptions[args.Button] = GetButtonCaption(view as GridView, e.RowHandle, e.Column, args.Button);
     }
 }
コード例 #19
0
        private void gvFunction_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            if (e.RowHandle < 0)
            {
                return;
            }

            if (e.Column.FieldName == "FunctionName")
            {
                if (e.CellValue == null)
                {
                    return;
                }

                string FuncCode = "";
                foreach (DataRow drFunc in dtFuncName.Rows)
                {
                    if (drFunc["FunctionName"].ToString() == e.CellValue.ToString())
                    {
                        FuncCode = drFunc["Function No."].ToString();
                        break;
                    }
                }

                SetImage(e, icFunction.Images[FindIndexImgFunc(FuncCode)]);
            }
        }
        private void CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            if (FindListIsEmpty)
            {
                return;
            }

            int filterTextIndex = e.DisplayText.IndexOf(filterCellText, StringComparison.CurrentCultureIgnoreCase);

            if (filterTextIndex == -1)
            {
                return;
            }
            GridCell temp = new GridCell(e.RowHandle, e.Column);

            if (NeedHighLight(temp))
            {
                e.Appearance.BackColor = BackGroundColor;
                e.Cache.FillRectangle(BackGroundColor, e.Bounds);
            }

            GridCellInfo     gci  = e.Cell as GridCellInfo;
            TextEditViewInfo tevi = gci.ViewInfo as TextEditViewInfo;

            if (tevi == null)
            {
                return;
            }
            Rectangle textRect = new Rectangle(e.Bounds.X + tevi.MaskBoxRect.X, e.Bounds.Y + tevi.MaskBoxRect.Y, tevi.MaskBoxRect.Width, tevi.MaskBoxRect.Height);

            e.Cache.Paint.DrawMultiColorString(e.Cache, textRect, e.DisplayText, filterCellText, e.Appearance, e.Appearance.ForeColor, HighLightColor, false, filterTextIndex);

            e.Handled = true;
        }
コード例 #21
0
ファイル: MyCellMergeHelper.cs プロジェクト: kangseokin/test
 void view_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     if (IsMergedCell(e.RowHandle, e.Column))
     {
         e.Handled = !painter.IsCustomPainting;
     }
 }
コード例 #22
0
ファイル: CtrlTestMeas.cs プロジェクト: 708ninja/Calorimeter
        private void outsideGridView_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            if (e.DisplayText == "")
            {
                return;
            }
            if (e.Column == null)
            {
                return;
            }

            Color[] fgColors = { Color.Black, Color.Yellow, Color.White };
            Color[] bgColors = { SystemColors.Control, Color.LimeGreen, Color.DeepPink };

            bgColors[0] = (e.RowHandle % 2 == 1) ? outsideGridView.Appearance.EvenRow.BackColor : Color.White;

            int state = 0;

            switch (e.Column.FieldName)
            {
            case "Name":
            case "Unit":
                state = 0;
                break;

            case "Value":
                state = (int)context.Measure.Outsides[e.RowHandle].State;
                break;
            }

            e.Appearance.ForeColor = fgColors[state];
            e.Appearance.BackColor = bgColors[state];
        }
コード例 #23
0
 private void DrawPinnedImage(RowCellCustomDrawEventArgs e)
 {
     if (e.RowHandle != _View.FocusedRowHandle)
     {
         e.Handled = true;
     }
 }
コード例 #24
0
        public static void DrawCellWithColor(RowCellCustomDrawEventArgs e, Color color)
        {
            Rectangle cellBound = Rectangle.Inflate(e.Bounds, 1, 1);

            e.Cache.FillRectangle(color, cellBound);
            e.Appearance.DrawString(e.Cache, e.CellValue.ToString(), Rectangle.Inflate(e.Bounds, -2, -2));
        }
コード例 #25
0
 private void GV_Main_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     if (e.Column.FieldName == "XR005")
     {
         if (GV_Main.GetRowCellValue(e.RowHandle, "XR005") != null)
         {
             Bitmap img    = new Bitmap(Properties.Resources.Grades0);
             Bitmap img2   = null;
             float  mGrade = 0;
             float.TryParse(GV_Main.GetRowCellValue(e.RowHandle, "XR005").ToString(), out mGrade);
             if (mGrade >= 0)
             {
                 img2 = new Bitmap(Properties.Resources.Grades50);
             }
             else
             {
                 img2 = new Bitmap(Properties.Resources.Grades_50);
             }
             mGrade = Math.Abs(mGrade);
             int mXR005 = (int)(mGrade / 5 * 160);
             //int mXR005 = (int)(float.Parse(GV_Main.GetRowCellValue(e.RowHandle, "XR005").ToString()) / 5 * 160);
             Graphics g = Graphics.FromImage(img);
             g.DrawImage(img2, new Rectangle(0, 0, mXR005, 32), new Rectangle(0, 0, mXR005, 32), GraphicsUnit.Pixel);
             e.Cache.Paint.DrawImage(e.Graphics, img, new Rectangle(e.Bounds.X, e.Bounds.Y, 160, 32));
             e.Handled = true;
         }
     }
 }
コード例 #26
0
ファイル: MainForm.cs プロジェクト: staherianYMCA/test
        private void GridView_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            if (e.Column.FieldName != "DX$CheckboxSelectorColumn" /*e.Column.AbsoluteIndex != -1*/)
            {
                return;
            }

            ObjectState state;
            var         value = IsNeedDisable(e, gridView);

            if (value)
            {
                _checkEdit.Enabled = true;
                state = ObjectState.Normal;
            }
            else
            {
                _checkEdit.Enabled = false;
                state = ObjectState.Disabled;
            }

            DrawCheckBox(e.Graphics, new Rectangle(e.Bounds.X + 1, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), Convert.ToBoolean(e.CellValue), state);

            e.Handled = true;
        }
コード例 #27
0
 private void cardView_CustomDrawCardFieldCaption(object sender, RowCellCustomDrawEventArgs e)
 {
     if (e.DisplayText.ToString().Contains("Imagen"))
     {
         e.DisplayText = string.Empty;
     }
 }
コード例 #28
0
        private void SetImage(RowCellCustomDrawEventArgs e, Image image)
        {
            GridCellInfo     gci  = e.Cell as GridCellInfo;
            TextEditViewInfo info = gci.ViewInfo as TextEditViewInfo;

            info.ContextImage = image;
            info.CalcViewInfo(e.Graphics);
        }
コード例 #29
0
        private void DrawCaption(RowCellCustomDrawEventArgs e)
        {
            Rectangle bounds = e.Bounds;

            bounds.Inflate(-2, -2);
            e.Appearance.DrawString(e.Cache, e.DisplayText, bounds);
            e.Handled = true;
        }
コード例 #30
0
        private void gridView1_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            GridView view = sender as GridView;
            //if (e.Column.VisibleIndex == 0 && view.IsMasterRowEmpty(e.RowHandle))
            //{

            //}
        }
コード例 #31
0
 void _View_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     if (e.Column != _Column)
     {
         return;
     }
     MyArgs.DrawHeader(e.Cache, e.Column, GetColumnCaption(e.RowHandle), e.Bounds);
 }
コード例 #32
0
ファイル: Painters.cs プロジェクト: 5509850/baumax
        public static void DrawDailyViewCell(RowCellCustomDrawEventArgs e, int index, DailyViewStyle view, StoreDay storeday, EmployeeDayView dayView)
        {
            Rectangle cellBound = Rectangle.Inflate(e.Bounds, 1, 1);

            e.Cache.FillRectangle(Color.White, cellBound);

            Rectangle rect;
            int squareWidth = cellBound.Width;
            Color squareColor = Color.White;
            //int index = infoColumn.FromTime / 15;
            int squareCount = 1;

            if (view == DailyViewStyle.View30)
            {
                cellBound = Rectangle.Inflate(cellBound, -2, 0);
                squareWidth = ((cellBound.Width - 1) / 2);
                squareCount = 2;
            }
            else if (view == DailyViewStyle.View60)
            {
                cellBound = Rectangle.Inflate(cellBound, -2, 0);

                squareWidth = ((cellBound.Width - 3) / 4);
                squareCount = 4;
            }

            int positionX = cellBound.X;
            int currentTime = index * 15;
            Color backColor = Color.White;

            for (int i = 0; i < squareCount; i++)
            {
                currentTime = (index + i) * 15;

                if (!storeday.IsOpeningTime((short)currentTime))
                {
                    backColor = Color.LightGray;
                }
                else backColor = Color.White;

                squareColor = dayView.GetColor(index + i);

                rect = new Rectangle(positionX, cellBound.Y, squareWidth, cellBound.Height);

                if (squareColor == Color.White)
                    squareColor = backColor;

                e.Cache.FillRectangle(squareColor, rect);

                positionX += squareWidth + 1;

            }

            e.Handled = true;
        }
コード例 #33
0
 void GridViewOnCustomDrawCell(object sender, RowCellCustomDrawEventArgs e) {
     BaseEditViewInfo info = ((GridCellInfo)e.Cell).ViewInfo;
     var enumDescriptor = new EnumDescriptor(typeof(ErrorType));
     var row = ((GridView)sender).GetRow(e.RowHandle);
     var resultItem = row as DisplayableValidationResultItem;
     Image errorIcon = null;
     if (resultItem != null) {
         errorIcon = ErrorIcon(resultItem, enumDescriptor);
     } else if (Columns.Any()) {
         var caption = Columns.SelectMany(types => types).Last(pair => e.Column.PropertyName() == pair.Key.PropertyName).Value.ToString();
         errorIcon = DXErrorProvider.GetErrorIconInternal((ErrorType)enumDescriptor.ParseCaption(caption));
     }
     if (errorIcon != null) {
         info.ErrorIcon = errorIcon;
         info.CalcViewInfo(e.Graphics);
     }
 }
コード例 #34
0
ファイル: frmConsultarDEuda.cs プロジェクト: TarekMulla/cra
        private void bandedGridView1_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            double riesgo;
            GridView currentView = sender as GridView;

            if (e.Column.FieldName == "Riesgo")
            {
                if (currentView.GetRowCellValue(e.RowHandle, currentView.Columns[11]) != null)
                {
                    riesgo = (double)currentView.GetRowCellValue(e.RowHandle, currentView.Columns[11]);
                    if (riesgo < 0)
                    {
                        e.Appearance.BackColor = Color.Red;
                    }
                }
            }
        }
コード例 #35
0
ファイル: ImportForm.cs プロジェクト: ShomreiTorah/Billing
		private void peopleView_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e) {
			var person = (Person)peopleView.GetRow(e.RowHandle);
			if (person != null)
				e.Appearance.BackColor = Color.FromArgb(128,
					matchColors[Matcher.GetMatchScore(viewModel.CurrentPayment, person)]);
		}
コード例 #36
0
 private void gvShowCateInfor_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     if (_selectedRowHandle.GetValueOrDefault(GridControl.InvalidRowHandle) == e.RowHandle)
     {
         e.Appearance.BackColor = Color.LightBlue;
         e.Appearance.BackColor2 = Color.LightCyan;
     }
 }
コード例 #37
0
 private void gridRecieveView_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     if (e.Column == colSelectManufacturer)
     {
         if (e.CellValue == null || e.CellValue.ToString() == "")
         {
             e.DisplayText = "Select Manufacturer";
         }
     }
 }
コード例 #38
0
 private void cardView1_CustomDrawCardField(object sender, RowCellCustomDrawEventArgs e)
 {
 }
コード例 #39
0
 private void gridOrderView_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     if (e.Column == colsQtyPerPack)
     {
         if (e.CellValue.ToString() == "")
         {
             e.Appearance.BackColor = Color.FromArgb(244, 244, 244);
         }
     }
     else if (e.Column == colPacks)
     {
         DataRow dr = gridOrderView.GetDataRow(e.RowHandle);
         if (dr["QtyPerPack"] == null || dr["QtyPerPack"].ToString() == "")
         {
             e.Appearance.BackColor = Color.FromArgb(244, 244, 244);
         }
     }
 }
コード例 #40
0
        private void gridView1_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            if (gridView1.GetRow(e.RowHandle) == null) return;

            E_ExamResult dr = gridView1.GetRow(e.RowHandle) as E_ExamResult;
            if (!dr.IsExamed)
            {
                e.Appearance.ForeColor = Color.Red;
            }
           
        }
コード例 #41
0
ファイル: Painters.cs プロジェクト: 5509850/baumax
 public static void DrawWithImage(RowCellCustomDrawEventArgs e, Image image, Color color)
 {
     e.Appearance.BackColor = color;
     e.Graphics.DrawImage(image, image.Size.Width, image.Size.Height);
     e.Appearance.DrawBackground(e.Graphics,e.Cache, e.Bounds);
 }
コード例 #42
0
ファイル: GridViewFilter.cs プロジェクト: toxig/ParnasPlayer
        void _View_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            if (_ActiveFilter == string.Empty) return;

            if (!Filter_words) // точное совпадение
            {
                if (e.DisplayText.IndexOf(_ActiveFilter) < 0) return;
                DrawSelect(sender, e, _ActiveFilter);
            }
            else // все слова через пробел
            {
                for (int i = 0; i < FilterText.Length; i++)
                {
                    DrawSelect(sender, e, FilterText[i]);
                }
            }
        }
コード例 #43
0
ファイル: UCProductAll.cs プロジェクト: vpjulia/Salvia
        private void gridViewMainProduct_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
           // if (e.RowHandle == this.grid. FocusedView.FocusedRowHandle) return;

            if( this.gridViewMainProduct.IsValidRowHandle(e.RowHandle)&(e.RowHandle!=GridControl.AutoFilterRowHandle))
            if (gridViewMainProduct.GetDataRow(e.RowHandle).RowState != DataRowState.Unchanged)
            {
                e.Appearance.BackColor = Color.LightGreen;
                e.Appearance.Font = e.Cache.GetFont(e.Appearance.Font, FontStyle.Bold);
                
           }
        }
コード例 #44
0
ファイル: Products.cs プロジェクト: sethjuarez/DevAV
 void layoutView_CustomDrawCardFieldValue(object sender, RowCellCustomDrawEventArgs e) {
     if(e.Column.FieldName != colImage.FieldName) return;
     e.DefaultDraw();
     e.Graphics.DrawRectangle(e.Cache.GetPen(layoutView.Appearance.FieldCaption.ForeColor), e.Bounds);
     e.Handled = true;
 }
コード例 #45
0
 private void gvResults_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     IAdditionalContent row;
     SizeF ef;
     int height;
     Image image;
     Rectangle rectangle;
     if (e.Column.FieldName == "Version")
     {
         row = this.gvResults.GetRow(e.RowHandle) as IAdditionalContent;
         Font font = new Font(this.gcVersion.AppearanceCell.Font, FontStyle.Regular);
         Color masterForeColor = Program.Settings.StylePreferences.MasterForeColor;
         if (e.Bounds.Contains(this.LastMouseLoc))
         {
             this.Cursor = Cursors.Default;
         }
         int num = 8;
         ef = DrawUtil.MeasureString(e.Graphics, row.Version.ToString(), font);
         height = (int) ef.Height;
         int width = (int) ef.Width;
         int num4 = e.Bounds.Left + num;
         int num5 = (e.Bounds.Top + (e.Bounds.Height / 2)) - (height / 2);
         using (Brush brush = new SolidBrush(masterForeColor))
         {
             e.Graphics.DrawString(row.Version.ToString(), font, brush, (float) num4, (float) num5);
         }
         if (!this.ViewingVersionHistory && (row.Version > 1))
         {
             image = VaultImages.btn_history_up;
             rectangle = new Rectangle((num4 + width) + num, DrawUtil.Center(e.Bounds, image.Size).Y, image.Size.Width, image.Size.Height);
             if ((rectangle.Contains(this.LastMouseLoc) && (row == this.DlMouseDown)) && ((Control.MouseButtons & MouseButtons.Left) != MouseButtons.None))
             {
                 image = VaultImages.btn_history_down;
                 if (rectangle.Contains(this.LastMouseLoc))
                 {
                     this.Cursor = Cursors.Hand;
                 }
                 else if (e.Bounds.Contains(this.LastMouseLoc))
                 {
                     this.Cursor = Cursors.Default;
                 }
             }
             else if (rectangle.Contains(this.LastMouseLoc))
             {
                 image = VaultImages.btn_history_over;
                 this.Cursor = Cursors.Hand;
             }
             else if (e.Bounds.Contains(this.LastMouseLoc))
             {
                 this.Cursor = Cursors.Default;
             }
             e.Graphics.DrawImage(image, rectangle);
         }
         e.Handled = true;
     }
     else if (e.Column.FieldName == "Download")
     {
         row = this.gvResults.GetRow(e.RowHandle) as IAdditionalContent;
         int num6 = 4;
         image = VaultImages.download_up;
         string text = string.Format(Loc.Get("{0} kb"), row.DownloadSize.ToString());
         ef = DrawUtil.MeasureString(e.Graphics, text, this.DownloadSizeFont);
         height = (int) ef.Height;
         rectangle = new Rectangle(DrawUtil.Center(e.Bounds, image.Size).X, e.Bounds.Y + num6, image.Size.Width, image.Size.Height);
         if ((AdditionalContent.IsDownloadingContent(row) || AdditionalContent.DownloadExistsLocal(row)) || !AdditionalContent.DownloadsEnabled)
         {
             image = VaultImages.download_inactive;
             if (e.Bounds.Contains(this.LastMouseLoc))
             {
                 this.Cursor = Cursors.Default;
             }
         }
         else if ((rectangle.Contains(this.LastMouseLoc) && (row == this.DlMouseDown)) && ((Control.MouseButtons & MouseButtons.Left) != MouseButtons.None))
         {
             image = VaultImages.download_down;
             if (rectangle.Contains(this.LastMouseLoc))
             {
                 this.Cursor = Cursors.Hand;
             }
             else if (e.Bounds.Contains(this.LastMouseLoc))
             {
                 this.Cursor = Cursors.Default;
             }
         }
         else if (rectangle.Contains(this.LastMouseLoc))
         {
             image = VaultImages.download_over;
             this.Cursor = Cursors.Hand;
         }
         else if (e.Bounds.Contains(this.LastMouseLoc))
         {
             this.Cursor = Cursors.Default;
         }
         e.Graphics.DrawImage(image, rectangle);
         using (SolidBrush brush2 = new SolidBrush(Color.Gray))
         {
             Point point = DrawUtil.Center(new Rectangle(e.Bounds.X, ((e.Bounds.Y + num6) + image.Height) + num6, e.Bounds.Width, height), new Size((int) ef.Width, height));
             e.Graphics.DrawString(text, this.DownloadSizeFont, brush2, (PointF) point);
         }
         e.Handled = true;
     }
 }
コード例 #46
0
ファイル: CustomMap.cs プロジェクト: micheljung/gpgnetfix
 private static void view_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     GridView view = sender as GridView;
     if (e.Column.FieldName == "PreviewImage50")
     {
         CustomMap row = view.GetRow(e.RowHandle) as CustomMap;
         if (row != null)
         {
             PreviewCellBounds[row.ID] = e.Bounds;
         }
     }
 }
コード例 #47
0
ファイル: Painters.cs プロジェクト: 5509850/baumax
        public static void DrawFixedCells_2(RowCellCustomDrawEventArgs e, string employeefullname, bool isfocused, bool usedText)
        {
            HeaderObjectInfoArgs args = new HeaderObjectInfoArgs();
            args.BackAppearance = e.Appearance;
            args.Bounds = Rectangle.Inflate(e.Bounds, 2, 2);
            args.Cache = e.Cache;
            args.Caption = null;
            args.State = (isfocused) ? ObjectState.Hot : ObjectState.Normal;
            if (usedText )
                e.Appearance.ForeColor = Color.Black;
            DevExpress.LookAndFeel.UserLookAndFeel.Default.Painter.Header.DrawObject(args);

            e.Appearance.DrawString(e.Cache,
                                    (usedText) ? employeefullname : e.CellValue.ToString(),//employeefullname,
                                    Rectangle.Inflate(e.Bounds, -2, -2),
                                    e.Cache.GetSolidBrush(e.Appearance.ForeColor),
                                    e.Appearance.GetStringFormat(TextOptions.DefaultOptionsMultiLine));
        }
コード例 #48
0
ファイル: FrmLadderView.cs プロジェクト: micheljung/gpgnetfix
 private void gvLadder_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     LadderParticipant row = this.gvLadder.GetRow(e.RowHandle) as LadderParticipant;
     if ((row != null) && row.ReportPending)
     {
         int[] selectedRows = this.gvLadder.GetSelectedRows();
         if (((selectedRows != null) && (selectedRows.Length > 0)) && (Array.IndexOf<int>(selectedRows, e.RowHandle) >= 0))
         {
             e.Appearance.BackColor = Color.FromArgb(0xad, 0xb0, 0xd4);
             e.Appearance.BackColor2 = Color.FromArgb(0xad, 0xb0, 0xd4);
         }
         else
         {
             e.Appearance.BackColor = Color.FromArgb(0x45, 0x48, 0x6d);
             e.Appearance.BackColor2 = Color.FromArgb(0x45, 0x48, 0x6d);
         }
     }
 }
コード例 #49
0
ファイル: Painters.cs プロジェクト: 5509850/baumax
 public static void DrawCellWithColor(RowCellCustomDrawEventArgs e, Color color)
 {
     Rectangle cellBound = Rectangle.Inflate(e.Bounds, 1, 1);
     e.Cache.FillRectangle(color, cellBound);
     e.Appearance.DrawString(e.Cache, e.CellValue.ToString(), Rectangle.Inflate(e.Bounds, -2, -2));
 }
コード例 #50
0
ファイル: Form1.cs プロジェクト: SmokeVLG/FormationOfSchedule
        private void gridView3_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            if (e.RowHandle == gridView3.FocusedRowHandle)
            {
                e.Appearance.BackColor = Color.FromArgb(0, 128, 255);
                e.Appearance.ForeColor = Color.White;
            }
            else
            {

                if (gridView3.GetDataRow(e.RowHandle)["FPcodeStavrolen"].ToString() == "")
                    e.Appearance.BackColor = Color.FromArgb(255, 255, 220);
            }
        }
コード例 #51
0
ファイル: Form1.cs プロジェクト: algz/ReactiveControlAnalysis
 private void bandedGridView1_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     if (IsMergedCell(e.RowHandle, e.Column))
         e.Handled = !(painter.IsCustomPainting);
 }
コード例 #52
0
        private void gvEventLog_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            if (e == null || e.Column.Tag == null)
                return;

            if (e.Column.Tag.Equals("assigned_to")) {
                CTScEventAndFollowUpLog _item = gvEventLog.GetRow(e.RowHandle) as CTScEventAndFollowUpLog;
                if (_item != null && _item.assigned_user != null) {
                    if (_item.assigned_user == UserSession.CurrentUser.UserId)
                        e.Graphics.DrawImage(global::SalesConsultant.Properties.Resources.assigned_to_me, e.Bounds.X, e.Bounds.Y, 16, 16);
                    else if (_item.assigned_user == 0)
                        e.Graphics.DrawImage(global::SalesConsultant.Properties.Resources.assigned_to_team, e.Bounds.X, e.Bounds.Y, 16, 16);
                    else if (_item.assigned_user != UserSession.CurrentUser.UserId && _item.assigned_user != 0 && _item.assigned_user != null)
                        e.Graphics.DrawImage(global::SalesConsultant.Properties.Resources.assigned_to_other, e.Bounds.X, e.Bounds.Y, 16, 16);
                    e.Handled = true;
                }
            }
            else if (e.Column.Tag.Equals("call_method")) {
                CTScEventAndFollowUpLog _item = gvEventLog.GetRow(e.RowHandle) as CTScEventAndFollowUpLog;
                if (_item != null && !string.IsNullOrEmpty(_item.call_method)) {
                    if (_item.call_method.Equals("Call Board"))
                        e.Graphics.DrawImage(global::SalesConsultant.Properties.Resources.call_board_2, e.Bounds.X, e.Bounds.Y, 16, 16);
                    else if (_item.call_method.Equals("Call Direct"))
                        e.Graphics.DrawImage(global::SalesConsultant.Properties.Resources.call_direct, e.Bounds.X, e.Bounds.Y, 16, 16);
                    else if (_item.call_method.Equals("Call Mobile"))
                        e.Graphics.DrawImage(global::SalesConsultant.Properties.Resources.call_mobile, e.Bounds.X, e.Bounds.Y, 16, 16);
                    else if (_item.call_method.Equals("Call Anonymous") || !string.IsNullOrEmpty(_item.contact_no))
                        e.Graphics.DrawImage(global::SalesConsultant.Properties.Resources.call_anonymous, e.Bounds.X, e.Bounds.Y, 16, 16);
                    e.Handled = true;
                }
                else {
                    if (_item != null && !string.IsNullOrEmpty(_item.contact_no)) {
                        e.Graphics.DrawImage(global::SalesConsultant.Properties.Resources.call_anonymous, e.Bounds.X, e.Bounds.Y, 16, 16);
                        e.Handled = true;
                    }
                }
            }
            else if (e.Column.Tag.Equals("event_status_icon")) {
                CTScEventAndFollowUpLog _item = gvEventLog.GetRow(e.RowHandle) as CTScEventAndFollowUpLog;
                if (_item != null && !string.IsNullOrEmpty(_item.event_status)) {
                    if (_item.event_status.Equals("Successfull"))
                        e.Graphics.DrawImage(global::SalesConsultant.Properties.Resources.completed, e.Bounds.X, e.Bounds.Y, 16, 16);
                    else if (_item.event_status.Equals("No Answer"))
                        e.Graphics.DrawImage(global::SalesConsultant.Properties.Resources.no_answer, e.Bounds.X, e.Bounds.Y, 16, 16);
                    else if (_item.event_status.Equals("Busy Signal"))
                        e.Graphics.DrawImage(global::SalesConsultant.Properties.Resources.busy_signal, e.Bounds.X, e.Bounds.Y, 16, 16);
                    else if (_item.event_status.Equals("Call Diverted To") || _item.event_status.Equals("Call Referal To"))
                        e.Graphics.DrawImage(global::SalesConsultant.Properties.Resources.call_refered_to, e.Bounds.X, e.Bounds.Y, 16, 16);
                    else if (_item.event_status.Equals("Don't Have Time") || _item.event_status.Equals("Contact not found"))
                        e.Graphics.DrawImage(global::SalesConsultant.Properties.Resources.flag_purple, e.Bounds.X, e.Bounds.Y, 16, 16);
                    else if (_item.event_type.Equals("Nurture Log"))
                        e.Graphics.DrawImage(global::SalesConsultant.Properties.Resources.nurture_log, e.Bounds.X, e.Bounds.Y, 16, 16);
                    else if (_item.event_type.Equals("Nurture Event"))
                        e.Graphics.DrawImage(global::SalesConsultant.Properties.Resources.nurture, e.Bounds.X, e.Bounds.Y, 16, 16);
                    else if (_item.event_type.Equals("Todo"))
                        e.Graphics.DrawImage(global::SalesConsultant.Properties.Resources.todo, e.Bounds.X, e.Bounds.Y, 16, 16);
                    else if (_item.event_type.Equals("Make Call"))
                        e.Graphics.DrawImage(global::SalesConsultant.Properties.Resources.make_call, e.Bounds.X, e.Bounds.Y, 16, 16);
                }
            }
        }
コード例 #53
0
        private void gridViewDrivers_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
        {
            var row = gridViewDrivers.GetRow(e.RowHandle) as DriverModel;
            if (row == null)
                return;

            if (row.LicenseID == 0)
                e.Appearance.BackColor = StatusColors.Red;
        }
コード例 #54
0
ファイル: frmLS2ZS.cs プロジェクト: wangshu/NY_HACK
 private void gridView1_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     if (string.Compare(this.gridView1.GetRowCellValue(e.RowHandle, "R5").ToString(), this.Stra.Format(DateTime.Now.Date.ToString(), '-')) < 0)
     {
         e.Appearance.ForeColor = Color.Red;
     }
 }
コード例 #55
0
 private void gvFriend_Member_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     if (e.Column.FieldName == "Text")
     {
         object row = (sender as GridView).GetRow(e.RowHandle);
         if (row is TextLine)
         {
             TextLine line = row as TextLine;
             if (line != null)
             {
                 float left = e.Bounds.Left;
                 foreach (TextSegment segment in line.TextSegments)
                 {
                     Font textFont;
                     Color textColor;
                     if (segment.TextFont != null)
                     {
                         textFont = segment.TextFont;
                     }
                     else
                     {
                         textFont = Program.Settings.Chat.Appearance.DefaultFont;
                     }
                     if (segment.TextColor != Color.Empty)
                     {
                         textColor = segment.TextColor;
                     }
                     else if (line.TextColor != Color.Empty)
                     {
                         textColor = line.TextColor;
                     }
                     else
                     {
                         textColor = Program.Settings.Chat.Appearance.DefaultColor;
                     }
                     int num2 = (e.Bounds.Height - textFont.Height) / 2;
                     using (Brush brush = new SolidBrush(textColor))
                     {
                         e.Graphics.DrawString(segment.Text, textFont, brush, (PointF) new Point((int) left, e.Bounds.Y + num2));
                         left += e.Graphics.MeasureString(segment.Text, textFont).Width;
                     }
                 }
                 e.Handled = true;
             }
         }
     }
 }
コード例 #56
0
ファイル: GridViewFilter.cs プロジェクト: toxig/ParnasPlayer
 void DrawSelect(object sender, RowCellCustomDrawEventArgs e, string text)
 {
     int index = e.DisplayText.IndexOf(text);
     e.Handled = true;
     e.Appearance.FillRectangle(e.Cache, e.Bounds);
     MultiColorDrawStringParams args = new MultiColorDrawStringParams(e.Appearance);
     args.Bounds = e.Bounds;
     args.Text = e.DisplayText;
     args.Appearance.Assign(e.Appearance);
     AppearanceObject apperance = _View.PaintAppearance.SelectedRow;
     CharacterRangeWithFormat defaultRange = new CharacterRangeWithFormat(0, e.DisplayText.Length, e.Appearance.ForeColor, e.Appearance.BackColor);
     CharacterRangeWithFormat range = new CharacterRangeWithFormat(index, text.Length, apperance.ForeColor, apperance.BackColor);
     args.Ranges = new CharacterRangeWithFormat[] { defaultRange, range };
     paint.MultiColorDrawString(e.Cache, args);
 }
コード例 #57
0
 private void gvChat_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     try
     {
         if (this.mFirstChatDraw)
         {
             this.mFirstChatDraw = false;
             Program.Settings.StylePreferences.StyleControl(this.gvPrivateChat, EventArgs.Empty);
         }
         if ((e.Column.Name != this.colPlayer.Name) && (e.Column.Name != this.colText.Name))
         {
             e.Handled = false;
         }
         else
         {
             this.ChatRowPoints[e.RowHandle] = e.Bounds;
             if (e.Column.AbsoluteIndex > 0)
             {
                 ChatLine row = this.gvPrivateChat.GetRow(e.RowHandle) as ChatLine;
                 if (row != null)
                 {
                     IText text = null;
                     if ((e.Column.AbsoluteIndex == 1) && (row.PlayerSegments.Count > 0))
                     {
                         text = row.PlayerSegments[0];
                     }
                     else if ((e.Column.AbsoluteIndex == 2) && (row.TextSegments.Count > 0))
                     {
                         text = row.TextSegments[0];
                     }
                     if (text != null)
                     {
                         int num;
                         int index;
                         float num6;
                         float x;
                         float y;
                         int num9;
                         int num10;
                         ChatLink link2;
                         SolidBrush brush;
                         string[] strArray;
                         int num11;
                         SizeF ef;
                         Brush brush2;
                         Font font2;
                         Font textFont = text.TextFont;
                         Rectangle bounds = e.Bounds;
                         ChatLink[] linkArray = null;
                         Dictionary<int, ChatLink> dictionary = null;
                         SortedList<int, Emote> list = null;
                         List<string> list2 = null;
                         List<MultiVal<int, int>> list3 = null;
                         string str = text.Text;
                         string str2 = null;
                         if (e.Column.AbsoluteIndex == 2)
                         {
                             if (!(!Program.Settings.Chat.Links.ShowChatLinks || (!row.ContainsLinks.HasValue ? false : !row.ContainsLinks.Value)))
                             {
                                 linkArray = ChatLink.FindLinks(text.Text, ChatLink.Emote);
                                 for (num = 0; num < linkArray.Length; num++)
                                 {
                                     if (Emote.AllEmotes.ContainsKey(linkArray[num].DisplayText))
                                     {
                                         text.Text = text.Text.Replace(linkArray[num].FullUrl, linkArray[num].DisplayText);
                                     }
                                 }
                                 dictionary = ChatLink.CreateCharacterIndex(ChatLink.FindLinks(str));
                                 row.ContainsLinks = new bool?((dictionary != null) && (dictionary.Count > 0));
                             }
                             if (!(!Program.Settings.Chat.Emotes.ShowEmotes || (!row.ContainsEmotes.HasValue ? false : !row.ContainsEmotes.Value)))
                             {
                                 list2 = new List<string>();
                                 list3 = new List<MultiVal<int, int>>();
                                 list = new SortedList<int, Emote>();
                                 foreach (Emote emote in Emote.AllEmotes.Values)
                                 {
                                     index = str.IndexOf(emote.CharSequence);
                                     while (index >= 0)
                                     {
                                         bool flag = false;
                                         if (dictionary != null)
                                         {
                                             foreach (ChatLink link in dictionary.Values)
                                             {
                                                 if ((index > link.StartIndex) && (index < link.EndIndex))
                                                 {
                                                     flag = true;
                                                 }
                                             }
                                         }
                                         if (!flag)
                                         {
                                             list3.Add(new MultiVal<int, int>(index, emote.CharSequence.Length));
                                             list.Add(index, emote);
                                         }
                                         index = str.IndexOf(emote.CharSequence, (int) (index + emote.CharSequence.Length));
                                         if (!(!Program.Settings.Chat.Links.ShowChatLinks || (!row.ContainsLinks.HasValue ? false : !row.ContainsLinks.Value)))
                                         {
                                             if (str2 == null)
                                             {
                                                 str2 = str;
                                             }
                                             str2 = str2.Replace(emote.CharSequence, "");
                                         }
                                     }
                                 }
                                 row.ContainsEmotes = new bool?((list != null) && (list.Count > 0));
                             }
                         }
                         if ((list != null) && (list.Count > 0))
                         {
                             list3.Add(new MultiVal<int, int>(str.Length, 0));
                             list.Add(str.Length, null);
                             SortedList<int, MultiVal<int, int>> list4 = new SortedList<int, MultiVal<int, int>>(list3.Count);
                             list4[-1] = new MultiVal<int, int>(0, 0);
                             foreach (MultiVal<int, int> val in list3)
                             {
                                 list4[val.Value1] = val;
                             }
                             for (num = 1; num < list4.Count; num++)
                             {
                                 int num3 = list4.Values[num - 1].Value1;
                                 index = list4.Values[num].Value1;
                                 int num4 = list4.Values[num - 1].Value2;
                                 int num5 = list4.Values[num].Value2;
                                 list2.Add(str.Substring(num3 + num4, index - (num3 + num4)));
                             }
                             dictionary = ChatLink.CreateCharacterIndex(ChatLink.FindLinks(str2));
                             num6 = textFont.Height + 3;
                             x = bounds.X;
                             y = bounds.Y;
                             num9 = (this.colText.VisibleWidth - 10) + bounds.X;
                             num10 = 0;
                             link2 = null;
                             using (brush = new SolidBrush(text.TextColor))
                             {
                                 for (num = 0; num < list2.Count; num++)
                                 {
                                     if (list2[num].Length > 0)
                                     {
                                         strArray = DrawUtil.SplitString(list2[num], " ");
                                         for (num11 = 0; num11 < strArray.Length; num11++)
                                         {
                                             if (link2 == null)
                                             {
                                                 if ((dictionary.Count > 0) && dictionary.ContainsKey(num10))
                                                 {
                                                     link2 = dictionary[num10];
                                                 }
                                                 if (link2 != null)
                                                 {
                                                     using (brush2 = new SolidBrush(link2.LinkColor))
                                                     {
                                                         using (font2 = new Font(textFont, FontStyle.Underline))
                                                         {
                                                             ef = DrawUtil.MeasureString(e.Graphics, link2.DisplayText + " ", font2);
                                                             if (((ef.Width <= (num9 - bounds.Left)) || (x != bounds.Left)) && ((x + ef.Width) > num9))
                                                             {
                                                                 x = bounds.X;
                                                                 y += num6;
                                                             }
                                                             e.Graphics.DrawString(link2.DisplayText, font2, brush2, x, y);
                                                         }
                                                     }
                                                 }
                                                 else
                                                 {
                                                     ef = DrawUtil.MeasureString(e.Graphics, strArray[num11], textFont);
                                                     if (((ef.Width <= (num9 - bounds.Left)) || (x != bounds.Left)) && ((x + ef.Width) > num9))
                                                     {
                                                         x = bounds.X;
                                                         y += num6;
                                                     }
                                                     e.Graphics.DrawString(strArray[num11], textFont, brush, x, y);
                                                 }
                                                 num10 += strArray[num11].Length;
                                                 x += ef.Width;
                                             }
                                             else
                                             {
                                                 num10 += strArray[num11].Length;
                                             }
                                             if ((link2 != null) && (num10 >= link2.EndIndex))
                                             {
                                                 link2 = null;
                                             }
                                         }
                                     }
                                     if (list.Values[num] != null)
                                     {
                                         float num12 = ((float) textFont.Height) / ((float) list.Values[num].Image.Height);
                                         float width = list.Values[num].Image.Width * num12;
                                         if ((x + width) > num9)
                                         {
                                             x = bounds.X;
                                             y += num6;
                                         }
                                         e.Graphics.DrawImage(list.Values[num].Image, x, y, width, (float) textFont.Height);
                                         x += width;
                                     }
                                 }
                             }
                         }
                         else if ((dictionary != null) && (dictionary.Count > 0))
                         {
                             num6 = textFont.Height + 3;
                             x = bounds.X;
                             y = bounds.Y;
                             num9 = (this.colText.VisibleWidth - 10) + bounds.X;
                             num10 = 0;
                             link2 = null;
                             using (brush = new SolidBrush(text.TextColor))
                             {
                                 strArray = DrawUtil.SplitString(str, " ");
                                 for (num11 = 0; num11 < strArray.Length; num11++)
                                 {
                                     if (link2 == null)
                                     {
                                         if ((dictionary.Count > 0) && dictionary.ContainsKey(num10))
                                         {
                                             link2 = dictionary[num10];
                                         }
                                         if (link2 != null)
                                         {
                                             using (brush2 = new SolidBrush(link2.LinkColor))
                                             {
                                                 using (font2 = new Font(textFont, FontStyle.Underline))
                                                 {
                                                     ef = DrawUtil.MeasureString(e.Graphics, link2.DisplayText + " ", font2);
                                                     if (((ef.Width <= (num9 - bounds.Left)) || (x != bounds.Left)) && ((x + ef.Width) > num9))
                                                     {
                                                         x = bounds.X;
                                                         y += num6;
                                                     }
                                                     e.Graphics.DrawString(link2.DisplayText, font2, brush2, x, y);
                                                 }
                                             }
                                         }
                                         else
                                         {
                                             ef = DrawUtil.MeasureString(e.Graphics, strArray[num11], textFont);
                                             if (((ef.Width <= (num9 - bounds.Left)) || (x != bounds.Left)) && ((x + ef.Width) > num9))
                                             {
                                                 x = bounds.X;
                                                 y += num6;
                                             }
                                             e.Graphics.DrawString(strArray[num11], textFont, brush, x, y);
                                         }
                                         num10 += strArray[num11].Length;
                                         x += ef.Width;
                                     }
                                     else
                                     {
                                         num10 += strArray[num11].Length;
                                     }
                                     if ((link2 != null) && (num10 >= link2.EndIndex))
                                     {
                                         link2 = null;
                                     }
                                 }
                             }
                         }
                         else
                         {
                             using (brush = new SolidBrush(text.TextColor))
                             {
                                 num6 = textFont.Height + 3;
                                 x = bounds.Left;
                                 y = bounds.Top;
                                 num9 = (this.colText.VisibleWidth - 10) + bounds.X;
                                 num10 = 0;
                                 strArray = DrawUtil.SplitString(str, " ");
                                 for (num11 = 0; num11 < strArray.Length; num11++)
                                 {
                                     ef = DrawUtil.MeasureString(e.Graphics, strArray[num11], textFont);
                                     if (((ef.Width <= (num9 - bounds.Left)) || (x != bounds.Left)) && ((x + ef.Width) > num9))
                                     {
                                         x = bounds.Left;
                                         y += num6;
                                     }
                                     e.Graphics.DrawString(strArray[num11], textFont, brush, x, y);
                                     num10 += strArray[num11].Length;
                                     x += ef.Width;
                                 }
                             }
                         }
                     }
                     e.Handled = true;
                 }
             }
         }
     }
     catch (Exception exception)
     {
         ErrorLog.WriteLine(exception);
     }
 }
コード例 #58
0
 void gridViewDisp_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     var row = gridViewDisp.GetRow(e.RowHandle) as DispatchCatalogModel;
     if (row != null)
     {
         if (gridViewDisp.FocusedRowHandle == e.RowHandle)
         {
             e.Appearance.ForeColor = Color.Black;
         }
         if (row.IsConfirmed)
         {
             e.Appearance.BackColor = Color.LightGreen;
         }
         if (e.Column.Name == col_Cancelled.Name && row.IsCancelled)
         {
             e.Appearance.BackColor = Color.IndianRed;
         }
         if (this.BoldColumn != null && e.RowHandle == BoldColumn.RowHandle && e.Column.Name == BoldColumn.Column.Name)
         {
             e.Appearance.Font = new Font(e.Appearance.Font.FontFamily, 10.0f, FontStyle.Bold);
         }
     }
 }
コード例 #59
0
 private void CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
     if (e.Column.AbsoluteIndex + 1 == timeColumn)
     {
         e.Column.AppearanceCell.BackColor = Color.FromArgb(214, 251, 254);
         return;
     }
     if (objectColumns.ContainsKey(e.Column.AbsoluteIndex + 1))
     {
         e.Column.AppearanceCell.BackColor = Color.FromArgb(253, 223, 239);
         return;
     }
     if (paramColumns.Contains(e.Column.AbsoluteIndex + 1))
     {
         e.Column.AppearanceCell.BackColor = Color.FromArgb(194, 206, 252);
         return;
     }
     e.Column.AppearanceCell.BackColor = Color.LemonChiffon;
 }
コード例 #60
0
ファイル: OrderForm.cs プロジェクト: pvx/ShopOrder
 private void GridViewCustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
 {
 }