private static Rectangle CalcSummaryRect(string text, RowObjectCustomDrawEventArgs e, GridColumn column)
		{
			var gridInfo = column.View.GetViewInfo() as GridViewInfo;
			var result = GetColumnBounds(column);
			SizeF sz = TextUtils.GetStringSize(e.Graphics, text, e.Appearance.Font);
			var width = Convert.ToInt32(sz.Width) + 1;
			if (!gridInfo.ViewRects.FixedLeft.IsEmpty)
			{
				var fixedLeftRight = gridInfo.ViewRects.FixedLeft.Right;
				var marginLeft = result.Right - width - fixedLeftRight;
				if (marginLeft < 0 && column.Fixed == FixedStyle.None)
					return Rectangle.Empty;
			}
			if (!gridInfo.ViewRects.FixedRight.IsEmpty)
			{
				var fixedRightLeft = gridInfo.ViewRects.FixedRight.Left;
				if (fixedRightLeft <= result.Right && column.Fixed == FixedStyle.None)
					return Rectangle.Empty;
			}
			result = FixLeftEdge(width, result);
			result.Width = result.Width;
			result.Y = e.Bounds.Y;
			result.Height = e.Bounds.Height - 2;

			return PreventSummaryTextOverlapping(e, result);
		}
		private void gridViewData_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e)
		{
			var view = sender as GridView;
			var items = GroupSummaryHelper.ExtractSummaryItems(view);
			if (items.Count == 0) return;
			GroupSummaryHelper.DrawBackground(e, view);
			GroupSummaryHelper.DrawSummaryValues(e, view, items);
			e.Handled = true;
		}
		public static void DrawBackground(RowObjectCustomDrawEventArgs e, GridView view)
		{
			var painter = e.Painter as GridGroupRowPainter;
			var info = e.Info as GridGroupRowInfo;
			int level = view.GetRowLevel(e.RowHandle);
			int row = view.GetDataRowHandleByGroupRowHandle(e.RowHandle);
			info.GroupText = string.Format("{0}: {1}", view.GroupedColumns[level].Caption,
				view.GetRowCellDisplayText(row, view.GroupedColumns[level]));
			e.Appearance.DrawBackground(e.Cache, info.Bounds);
			painter.ElementsPainter.GroupRow.DrawObject(info);
		}
		public static void DrawSummaryValues(RowObjectCustomDrawEventArgs e, GridView view, ArrayList items)
		{
			var values = view.GetGroupSummaryValues(e.RowHandle);
			foreach (GridGroupSummaryItem item in items)
			{
				var rect = GetColumnBounds(view, item);
				if (rect.IsEmpty) continue;
				var text = item.GetDisplayText(values[item], false);
				rect = CalcSummaryRect(text, e, view.Columns[item.FieldName]);
				e.Appearance.DrawString(e.Cache, text, rect);
			}
		}
Esempio n. 5
0
        private void gridView_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e)
        {
            GridView  view      = sender as GridView;
            object    val       = view.GetGroupRowValue(e.RowHandle);
            VisitCase visitCase = val != null && val is Guid?
                                  ObjectSpace.FindObject <VisitCase>(VisitCase.Fields.Oid == (Guid)val) : null;

            GridGroupRowInfo info = e.Info as GridGroupRowInfo;

            if (info.Column.FieldName == "Case.Oid")
            {
                info.GroupText = string.Format("Посещение {0} ({1})", visitCase.Num, visitCase != null &&
                                               visitCase.MainDiagnose != null && visitCase.MainDiagnose.Diagnose != null ?
                                               visitCase.MainDiagnose.Diagnose.MKB : null);
            }
        }
Esempio n. 6
0
        private void gridView_CustomDrawRowPreview(object sender, RowObjectCustomDrawEventArgs e)
        {
            const int dx = 8;
            Rectangle r  = e.Bounds;

            r.X     += e.Bounds.Height + dx + 2;
            r.Width -= (e.Bounds.Height + dx + 3);
            string file         = (string)gridView.GetRowCellValue(e.RowHandle, "Image");
            string originalPath = @"images/" + (String.IsNullOrEmpty(file)? "NoImage.png" : file);
            Image  tempImage    = Image.FromFile(originalPath);

            e.Graphics.DrawImage(tempImage, e.Bounds.X + dx,
                                 e.Bounds.Y, e.Bounds.Height, e.Bounds.Height);
            e.Appearance.DrawString(e.Cache, gridView.GetRowPreviewDisplayText(e.RowHandle), r);
            e.Handled = true;
        }
        private static Point DrawGroupRowCustomImage(RowObjectCustomDrawEventArgs e, GridGroupRowInfo info, GridView view, ImageList imgList)
        {
            var   imgIndex = view.GetDataSourceRowIndex(e.RowHandle);
            Image img;

            img = GetGroupRowCustomImage(imgList, imgIndex);
            var imgPos = CalcImgPosition(e, info);

            if (img == null)
            {
                return(imgPos);
            }
            info.Cache.Paint.DrawImage(e.Cache.Graphics, img, imgPos);
            Point imageRightBottomCorner = new Point(imgPos.X + img.Width, imgPos.Y);

            return(imageRightBottomCorner);
        }
        private static Image GetExpandButtonImage(RowObjectCustomDrawEventArgs e, GridView view, DevExpress.LookAndFeel.UserLookAndFeel lookAndFeel)
        {
            var currentSkin     = GridSkins.GetSkin(lookAndFeel);
            var plusMinusButton = currentSkin[GridSkins.SkinPlusMinus];

            ImageCollection images = plusMinusButton.Image?.GetImages() ?? plusMinusButton.Glyph?.GetImages();

            if (images == null)
            {
                return(null);
            }
            var rowExpanded = view.GetRowExpanded(e.RowHandle);
            var imgIndex    = rowExpanded ? 1 : 0;
            var img         = images.Images[imgIndex];

            return(img);
        }
Esempio n. 9
0
        void gridView1_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e)
        {
            //DevExpress.XtraGrid.Views.Grid.GridView view;
            //DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo ee;
            //DevExpress.Utils.Drawing.OpenCloseButtonInfoArgs ocb;
            //DevExpress.XtraGrid.Drawing.GridGroupRowPainter painter;

            //view = sender as DevExpress.XtraGrid.Views.Grid.GridView;
            //ee = e.Info as DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo;
            //ocb = new DevExpress.Utils.Drawing.OpenCloseButtonInfoArgs(e.Cache, ee.ButtonBounds,
            //    ee.GroupExpanded, ee.AppearanceGroupButton, DevExpress.Utils.Drawing.ObjectState.Normal);

            //if(!ee.ButtonBounds.IsEmpty) {
            //    painter = e.Painter as DevExpress.XtraGrid.Drawing.GridGroupRowPainter;
            //    painter.ElementsPainter.OpenCloseButton.DrawObject(ocb);
            //}

            //    e.Handled = true;

            //GridView view = sender as GridView;

            //DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo info =
            //    e.Info as DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo;

            //int handle = view.GetDataRowHandleByGroupRowHandle(e.RowHandle);

            //if (info.Column.FieldName == "NAME")
            //{
            //    StringBuilder oGroupText = new StringBuilder();
            //    oGroupText.Append(view.GetRowCellValue(handle, "NAME").ToString());
            //    oGroupText.Append(" - ");
            //    oGroupText.Append(view.GetRowCellValue(handle, "trancode").ToString());

            //    info.GroupText = oGroupText.ToString();
            //}
            //ucDynamicReport.gridView1.OptionsView.AllowHtmlDrawHeaders = true;
            //GridView view = sender as GridView;
            //GridGroupRowInfo info = e.Info as GridGroupRowInfo;
            //if (info.Column.FieldName == "NAME")
            //{
            //    string quantity = Static.ToStr(view.GetGroupRowValue(e.RowHandle, info.Column));
            //    //  string colorName = getColorName(quantity);
            //    //info.GroupText = info.Column.Caption + ": <color=" + colorName + ">" + info.GroupValueText + "</color> ";
            //    //info.GroupText += "<color=LightSteelBlue>" + view.GetGroupSummaryText(e.RowHandle) + "</color> ";
            //}
        }
        public RowObjectCustomDrawEventArgs GetRowObjectCustomDrawEventArgs(GraphicsCache cache, int rowHandle, Rectangle rect, out int textWidth)
        {
            GridRowInfo ri = (GridRowInfo)ViewInfo.RowsInfo.FindRow(rowHandle);

            if (ri == null)
            {
                textWidth = 0;
                return(null);
            }
            ri.DataBounds = new Rectangle(0, 0, rect.Width, rect.Height);
            RowObjectCustomDrawEventArgs args = new RowObjectCustomDrawEventArgs(cache, rowHandle, ElPainter.GroupRow, ri, ri.Appearance);

            textWidth    = (ViewInfo as MyGridViewInfo).CalcGroupRowTextWidth(args);
            args.Handled = true;

            RaiseCustomDrawGroupRow(args);
            return(args);
        }
Esempio n. 11
0
        private void View_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e)
        {
            DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo info = default(DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo);
            info = (DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo)e.Info;

            info.GroupText = " " + info.GroupText.TrimStart();
            e.Info.Paint.FillRectangle(e.Graphics, e.Appearance.GetBackBrush(e.Cache), e.Bounds);
            e.Painter.DrawObject(e.Info);

            Rectangle r = info.ButtonBounds;

            r.Offset(r.Width * 2, 0);

            int g = GroupRowSelectionStatus(e.RowHandle);

            DrawCheckBox(e.Graphics, r, g > 0, g < 0);
            e.Handled = true;
        }
Esempio n. 12
0
        private void View_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e)
        {
            var info = e.Info as GridGroupRowInfo;

            if (info != null)
            {
                info.GroupText = "         " + info.GroupText.TrimStart();
            }
            e.Info.Paint.FillRectangle(e.Graphics, e.Appearance.GetBackBrush(e.Cache), e.Bounds);
            e.Painter.DrawObject(e.Info);

            if (info != null)
            {
                Rectangle r = info.ButtonBounds;
                r.Offset(r.Width * 2, 0);
                DrawCheckBox(e.Graphics, r, IsGroupRowSelected(e.RowHandle));
            }
            e.Handled = true;
        }
        private void gridViewProducts_CustomDrawRowPreview(object sender, RowObjectCustomDrawEventArgs e)
        {
            const int dx = 8;
            var       r  = e.Bounds;

            r.X     += e.Bounds.Height + dx + 2;
            r.Width -= (e.Bounds.Height + dx + 3);
            string originalPath = @"images\" + gridViewProducts.GetRowCellValue(e.RowHandle, "Image");
            var    tempImage    = Image.FromFile(originalPath);

            e.Graphics.DrawImage(tempImage, e.Bounds.X + dx,
                                 e.Bounds.Y, e.Bounds.Height, e.Bounds.Height);
            string draw = String.Format("{0}\n{1}\n{2}\n{3}\n{4}\n{5}", (string)gridViewProducts.GetRowCellValue(e.RowHandle, "Name"), (bool)gridViewProducts.GetRowCellValue(e.RowHandle, "Type") ? "Type: Phone" : "Type: Other",
                                        (string)gridViewProducts.GetRowCellValue(e.RowHandle, "UnitPrice"), "Price: " + ((Decimal)gridViewProducts.GetRowCellValue(e.RowHandle, "Price")),
                                        "Quantity: " + (int)gridViewProducts.GetRowCellValue(e.RowHandle, "Quantity"), "Description: " + (string)gridViewProducts.GetRowCellValue(e.RowHandle, "Description")
                                        );

            e.Appearance.DrawString(e.Cache, draw, r);
            e.Handled = true;
        }
Esempio n. 14
0
        void view_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e)
        {
            GridGroupRowInfo info   = (GridGroupRowInfo)(((CustomDrawObjectEventArgs)e).Info);
            Rectangle        bounds = info.DataBounds;

            bounds.Offset(2, 0);
            string text = (bool)info.EditValue ? "Pinned" : "Recent";

            e.Appearance.DrawString(e.Cache, text, bounds);
            SizeF size = e.Appearance.CalcTextSize(e.Cache, text, bounds.Width);

            bounds.Offset(size.ToSize().Width, 0);
            bounds.Width -= size.ToSize().Width;
            bounds.Inflate(-2, 0);
            Point point1 = new Point(bounds.X, bounds.Y + bounds.Height / 2);
            Point point2 = new Point(bounds.Right, bounds.Y + bounds.Height / 2);

            e.Cache.DrawLine(e.Cache.GetPen(e.Appearance.GetForeColor()), point1, point2);
            e.Handled = true;
        }
Esempio n. 15
0
        private Rectangle PreventSummaryTextOverlapping(RowObjectCustomDrawEventArgs e, Rectangle rect)
        {
            GridGroupRowInfo gInfo      = (GridGroupRowInfo)e.Info;
            int       groupTextLocation = gInfo.ButtonBounds.Right + 10;
            int       groupTextWidth    = TextUtils.GetStringSize(e.Cache.Graphics, gInfo.GroupText, e.Appearance.Font).Width;
            Rectangle r = new Rectangle(groupTextLocation, 0, groupTextWidth, e.Info.Bounds.Height);

            if (r.Right > rect.X)
            {
                if (r.Right > rect.Right)
                {
                    rect.Width = 0;
                }
                else
                {
                    rect.Width -= r.Right - rect.X;
                    rect.X      = r.Right;
                }
            }
            return(rect);
        }
Esempio n. 16
0
        void gridView1_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e)
        {
            GridGroupRowInfo rowInfo = e.Info as GridGroupRowInfo;

            if (rowInfo != null && rowInfo.Column.FieldName == "Rating")
            {
                MyGridView            view      = sender as MyGridView;
                MyGridViewInfo        viewInfo  = view.GetViewInfo() as MyGridViewInfo;
                int                   textWidth = viewInfo.CalcGroupRowTextWidth(e);
                RatingControlViewInfo info      = rowInfo.Column.ColumnEdit.CreateViewInfo() as RatingControlViewInfo;
                RatingControlPainter  painter   = rowInfo.Column.ColumnEdit.CreatePainter() as RatingControlPainter;
                info.EditValue = view.GetGroupRowValue(e.RowHandle);
                info.CalcViewInfo(e.Graphics);
                info.Bounds = new Rectangle(textWidth, rowInfo.DataBounds.Y, info.RatingSize.Width, rowInfo.DataBounds.Height);
                info.CalcViewInfo(e.Graphics);

                ControlGraphicsInfoArgs args = new ControlGraphicsInfoArgs(info, e.Cache, rowInfo.DataBounds);
                e.DefaultDraw();
                painter.Draw(args);
                e.Handled = true;
            }
        }
		private void OnGridViewCustomDrawFooter(object sender, RowObjectCustomDrawEventArgs e)
		{
			e.Painter.DrawObject(e.Info);
			var viewInfo = (AdvBandedGridViewInfo)((AdvBandedGridView)sender).GetViewInfo();
			var column = bandedGridColumnIndex;
			var title = "Totals: ";
			if (_data.ShowRate)
				column = bandedGridColumnRate;
			else if (_data.ShowLenght)
				column = bandedGridColumnLength;
			else if (_data.ShowTime)
				column = bandedGridColumnTime;
			else if (_data.ShowProgram)
				column = bandedGridColumnName;
			else if (_data.ShowStation)
				column = bandedGridColumnStation;
			else if (_data.ShowDaypart)
				column = bandedGridColumnDaypart;
			else if (_data.ShowLogo)
				column = bandedGridColumnLogo;
			else
				title = String.Empty;
			if (String.IsNullOrEmpty(title)) return;
			var x = viewInfo.ColumnsInfo[column].Bounds.X;
			var width = viewInfo.ColumnsInfo[column].Bounds.Width;
			var size = e.Appearance.CalcTextSize(e.Cache, title, 50);
			var textWidth = Convert.ToInt32(size.Width) + 1;
			var textRect = new Rectangle(x + width - 50, e.Bounds.Y, textWidth, e.Bounds.Height);
			e.Appearance.DrawString(e.Cache, title, textRect);
			e.Handled = true;
		}
Esempio n. 18
0
 private void gvFolder_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e)
 {
 }
        void View_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e)
        {
            DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo info;
            info = e.Info as DevExpress.XtraGrid.Views.Grid.ViewInfo.GridGroupRowInfo;

            info.GroupText = "         " + info.GroupText.TrimStart();
            e.Info.Paint.FillRectangle(e.Graphics, e.Appearance.GetBackBrush(e.Cache), e.Bounds);
            e.Painter.DrawObject(e.Info);

            Rectangle r = info.ButtonBounds;
            r.Offset(r.Width + CheckboxIndent * 2 - 1, 0);
            DrawCheckBox(e.Graphics, r, IsGroupRowSelected(e.RowHandle));
            e.Handled = true;
        }
 private static Point CalcImgPosition(RowObjectCustomDrawEventArgs e, GridGroupRowInfo info)
 {
     return(new Point(info.ButtonBounds.Right, info.ButtonBounds.Y));
 }
 private void gridView1_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e)
 {
     DrawGroupRow(e);
 }
Esempio n. 22
0
        private void DrawSummaryValues(RowObjectCustomDrawEventArgs e, GridView view, ArrayList items)
        {
            Hashtable values = view.GetGroupSummaryValues(e.RowHandle);

            foreach (GridGroupSummaryItem item in items)
            {
                GridColumn cl=view.Columns[item.FieldName];

                Rectangle rect = GetColumnBounds(view, item);
                if (rect.IsEmpty) continue;
                string text = item.GetDisplayText(values[item], false);
                rect = CalcSummaryRect(text, e,cl );
                // rect.X = rect.X - gridView1.Columns[item.FieldName].Width / 2+5;
                e.Appearance.DrawString(e.Cache, text, rect);
            }
        }
Esempio n. 23
0
 private Rectangle CalcSummaryRect(string text, RowObjectCustomDrawEventArgs e, GridColumn column)
 {
     SizeF sz = TextUtils.GetStringSize(e.Graphics, text, e.Appearance.Font);
     int width = Convert.ToInt32(sz.Width) + 1;
     Rectangle result = GetColumnBounds(column);
     result = FixLeftEdge(width, result);
     result.Width = result.Width;
     result.Y = e.Bounds.Y;
     result.Height = e.Bounds.Height - 2;
     return PreventSummaryTextOverlapping(e, result);
 }
Esempio n. 24
0
		private void OnGridViewCustomDrawFooter(object sender, RowObjectCustomDrawEventArgs e)
		{
			if (_spotColumns.Count > 0)
			{
				e.Painter.DrawObject(e.Info);
				var view = sender as AdvBandedGridView;
				var viewInfo = view.GetViewInfo() as AdvBandedGridViewInfo;

				var column = bandedGridColumnName;
				if (_sectionContainer.SectionData.ShowRate)
					column = bandedGridColumnRate;
				else if (_sectionContainer.SectionData.ShowRating)
					column = bandedGridColumnRating;
				else if (_sectionContainer.SectionData.ShowLenght)
					column = bandedGridColumnLength;
				else if (_sectionContainer.SectionData.ShowDay)
					column = bandedGridColumnDay;
				else if (_sectionContainer.SectionData.ShowTime)
					column = bandedGridColumnTime;

				var x = viewInfo.ColumnsInfo[column].Bounds.X;
				var width = viewInfo.ColumnsInfo[column].Bounds.Width;
				const string spotTotalTitle = "Totals: ";
				var size = e.Appearance.CalcTextSize(e.Cache, spotTotalTitle, 50);
				var textWidth = Convert.ToInt32(size.Width) + 1;
				var textRect = new Rectangle(x + width - 50, e.Bounds.Y, textWidth, e.Bounds.Height);
				e.Appearance.DrawString(e.Cache, spotTotalTitle, textRect);
				e.Handled = true;
			}
		}
Esempio n. 25
0
        private void gridViewNgayPhatDauTien_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e)
        {
            var info = e.Info as GridGroupRowInfo;
            var groupRow = gridViewNgayPhatDauTien.GetDataRow(e.RowHandle);
            if (groupRow == null) return;
            if (groupRow["DAI_TRUYEN_HINH"].ToString() == "") return;
            var childRows = groupRow.Table.Select(string.Format("DAI_TRUYEN_HINH = {0}", groupRow["DAI_TRUYEN_HINH"]));
            var ngayPhatDauTien = "";

            if (childRows != null)
            {
                ngayPhatDauTien = childRows.Aggregate(ngayPhatDauTien,
                                                      (current, row) =>
                                                      current +
                                                      (gridViewNgayPhatDauTien.GetDisplayTextByColumnValue(
                                                          ColNgayPhatStart, row[ColNgayPhatStart.FieldName]) + ";"));
                ngayPhatDauTien = ngayPhatDauTien.TrimEnd(';');
            }
            info.GroupText =
                gridViewNgayPhatDauTien.GetDisplayTextByColumnValue(ColKenhPhatSong, groupRow[ColKenhPhatSong.FieldName]) +
                ": " +
                "Số lần đã phát " + childRows.Length + " (" + ngayPhatDauTien + ")";
        }
Esempio n. 26
0
        private void gridViewThongTinBan_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e)
        {
            var info = e.Info as GridGroupRowInfo;
            DataRow groupRow = gridViewThongTinBan.GetDataRow(e.RowHandle);
            if (groupRow == null) return;
            if (groupRow["DAI_TRUYEN_HINH"].ToString() == "") return;
            DataRow[] childRows =
                groupRow.Table.Select(string.Format("DAI_TRUYEN_HINH = {0}", groupRow["DAI_TRUYEN_HINH"]));
            string ngayBan = "";

            if (childRows != null)
            {
                //foreach (DataRow row in childRows)
                //{
                //    ngayBan += gridViewThongTinBan.GetDisplayTextByColumnValue(ColNgayBanTu, row[ColNgayBanTu.FieldName]) + ";";
                //}

                ngayBan = childRows.Aggregate(ngayBan,
                                              (current, row) =>
                                              current +
                                              (gridViewThongTinBan.GetDisplayTextByColumnValue(ColNgayBanTu,
                                                                                               row[
                                                                                                   ColNgayBanTu.
                                                                                                       FieldName]) + ";"));
                ngayBan = ngayBan.TrimEnd(';');
            }
            info.GroupText =
                gridViewThongTinBan.GetDisplayTextByColumnValue(ColKenhBan, groupRow[ColKenhBan.FieldName]) + ": " +
                "Số lần đã bán " + childRows.Length + " (" + ngayBan + ")";
        }
 private void gridView1_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e)
 {
     if (gridView1.GetRowLevel(e.RowHandle) < 2)
         return;
     var stat = (t_detailed_municipality_form_statistics)gridView1.GetRow(e.RowHandle);
     var color = Color.FromArgb(60, TileResources.FormDataColors[(Status)stat.upload_status]);
     e.Appearance.BackColor = color;
 }
Esempio n. 28
0
 private Rectangle PreventSummaryTextOverlapping(RowObjectCustomDrawEventArgs e, Rectangle rect)
 {
     GridGroupRowInfo gInfo = (GridGroupRowInfo)e.Info;
     int groupTextLocation = gInfo.ButtonBounds.Right + 10;
     int groupTextWidth = TextUtils.GetStringSize(e.Graphics, gInfo.GroupText, e.Appearance.Font).Width;
     Rectangle r = new Rectangle(groupTextLocation, 0, groupTextWidth, e.Info.Bounds.Height);
     if (r.Right > rect.X)
     {
         if (r.Right > rect.Right)
             rect.Width = 0;
         else
         {
             rect.Width -= r.Right - rect.X;
             rect.X = r.Right;
         }
     }
     return rect;
 }
Esempio n. 29
0
 private void logView_CustomDrawRowPreview(object sender, RowObjectCustomDrawEventArgs e)
 {
     using (RichTextEditViewInfo vi = new RichTextEditViewInfo(emailLogRenderer.Value)) {
         var view = ((GridView)sender);
         var email = (AdReminderEmail)view.GetRow(e.RowHandle);
         vi.LoadText(email.EmailSource);
         vi.UpdatePaintAppearance();
         vi.CalcViewInfo(e.Graphics, MouseButtons.None, Point.Empty, e.Bounds);
         RichTextEditPainter.DrawRTF(vi, e.Cache);
     }
     e.Handled = true;
 }
Esempio n. 30
0
        private void gridViewNgayPhatDauTien_CustomDrawGroupRow(object sender, RowObjectCustomDrawEventArgs e)
        {
            GridGroupRowInfo info = e.Info as GridGroupRowInfo;
            DataRow groupRow = gridViewNgayPhatDauTien.GetDataRow(e.RowHandle);
            if (groupRow == null) return;
            if (groupRow["DAI_TRUYEN_HINH"].ToString() == "") return;
            DataRow[] childRows = groupRow.Table.Select(string.Format("DAI_TRUYEN_HINH = {0}", groupRow["DAI_TRUYEN_HINH"]));
            string NgayPhatDauTien = "";

            if (childRows != null)
            {
                foreach (DataRow row in childRows)
                {
                    NgayPhatDauTien += gridViewNgayPhatDauTien.GetDisplayTextByColumnValue(CotNgayPhat, row[CotNgayPhat.FieldName]) + ";";
                }
                NgayPhatDauTien = NgayPhatDauTien.TrimEnd(';');
            }
            info.GroupText = gridViewNgayPhatDauTien.GetDisplayTextByColumnValue(CotDaiTruyenHinh, groupRow[CotDaiTruyenHinh.FieldName]) + ": " +
                "Số lần đã phát " + childRows.Length + " (" + NgayPhatDauTien + ")";
        }