public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { // draw after the element theme as been drawn if (DrawPhase.AfterDrawTheme == drawPhase) { // get the button element var buttonElement = drawParams.Element as ButtonUIElementBase; if (buttonElement != null) { // get the button control and current button state var dropDown = drawParams.ControlElement.Control as UltraDropDownButton; //var buttonState = buttonElement.ButtonState; var buttonState = UIElementButtonState.MouseOver; if (!dropDown.IsDroppedDown && !buttonElement.IsMouseOver) { XPThemes.ToolBar.DrawToolbarButton( false, drawParams.Element is SplitButtonDropDownUIElement, buttonState, ref drawParams, drawParams.Element.Rect, drawParams.InvalidRect); } } } return false; }
public DrawPhase GetPhasesToFilter(ref UIElementDrawParams drawParams) { if (drawParams.Element is SplitButtonUIElement || drawParams.Element is SplitButtonDropDownUIElement) { return DrawPhase.AfterDrawTheme; } return DrawPhase.None; }
public DrawPhase GetPhasesToFilter(ref UIElementDrawParams drawParams) { if (drawParams.Element is TabPageAreaUIElement) return DrawPhase.BeforeDrawBorders; if (drawParams.Element is TabItemUIElement) return DrawPhase.BeforeDrawFocus; return DrawPhase.None; }
public DrawPhase GetPhasesToFilter(ref UIElementDrawParams drawParams) { if (!(drawParams.Element is EmbeddableUIElementBase)) { return(Infragistics.Win.DrawPhase.None); } else { return(Infragistics.Win.DrawPhase.AfterDrawBackColor); } }
/// <summary> /// Called before each element is about to be drawn. /// </summary> /// <param name="drawParams">The <see cref="T:Infragistics.Win.UIElementDrawParams" /> used to provide rendering information.</param> /// <returns> /// Bit flags indicating which phases of the drawing operation to filter. The DrawElement method will be called only for those phases. /// </returns> public DrawPhase GetPhasesToFilter(ref UIElementDrawParams drawParams) { if (drawParams.Element is Infragistics.Win.UltraWinTabControl.TabPageAreaUIElement) { return(DrawPhase.BeforeDrawBorders); } else if (drawParams.Element is Infragistics.Win.UltraWinTabs.TabItemUIElement) { return(DrawPhase.BeforeDrawFocus); } return(DrawPhase.None); }
public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { // Draw a custom border around ButtonToolUIElements ButtonToolUIElement buttonToolUiElement = drawParams.Element as ButtonToolUIElement; if (buttonToolUiElement != null && drawPhase == DrawPhase.BeforeDrawBorders) { drawParams.DrawBorders(UIElementBorderStyle.Solid, Border3DSide.All); return(true); } return(false); }
/// <summary> /// Called during the drawing operation of a UIElement for a specific phase /// of the operation. This will only be called for the phases returned /// from the GetPhasesToFilter method. /// </summary> /// <param name="drawPhase">Contains a single bit which identifies the current draw phase.</param> /// <param name="drawParams">Exposes properties required for drawing an element (e.g. Element, Graphics, InvalidRect etc.)</param> /// <returns> /// Returning true from this method indicates that this phase has been handled and the default processing should be skipped. /// </returns> bool IUIElementDrawFilter.DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { UltraTreeNode treeNode = drawParams.Element.GetContext(typeof(UltraTreeNode), true) as UltraTreeNode; if (treeNode != null) { var scale = (float)drawParams.ControlElement.Control.DeviceDpi / 96; var sz300 = (int)(300 * scale); TreeFeedsNodeBase feedsNode = treeNode as TreeFeedsNodeBase; if (drawPhase == DrawPhase.AfterDrawElement && feedsNode != null && feedsNode.Control != null) { int unread = feedsNode.UnreadCount; if (unread > 0) { // this image width is a workaround to extend the nods's clickable // area to include the unread count visual representation... int clickableAreaExtenderImageWidth = feedsNode.Control.RightImagesSize.Width; string st = String.Format("({0})", unread); Rectangle ur = drawParams.Element.RectInsideBorders; using (Brush unreadColorBrush = new SolidBrush(FontColorHelper.UnreadCounterColor)) { drawParams.Graphics.DrawString(st, FontColorHelper.UnreadCounterFont, unreadColorBrush, ur.X + ur.Width - clickableAreaExtenderImageWidth, ur.Y, StringFormat.GenericDefault); } return(true); } return(false); } if (treeNode.Level == 0) { RectangleF initialRect = drawParams.Element.RectInsideBorders; RectangleF r = new RectangleF(initialRect.Left, initialRect.Top, 0, 0); // this SHOULD be the horizontal scrolling area, but how do we get this (?): r.Width = treeNode.Control.DisplayRectangle.Width + sz300; r.Height = treeNode.ItemHeightResolved; TreeFeedsNodeGroupHeaderPainter.PaintOutlook2003Header(drawParams.Graphics, r); return(true); } } // To return FALSE from this method indicates that the element should draw itself as normal. // To return TRUE from this method indicates that the element should not draw itself. // Return true to prevent further drawing by the element return(false); }
bool IUIElementDrawFilter.DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { if (drawParams.Element is EditorWithTextDisplayTextUIElement && this.image != null) { int offset = drawParams.Element.Rect.Y + (drawParams.Element.Rect.Height - this.image.Height) / 2; Point p = new Point(drawParams.Element.Rect.X + drawParams.Element.Rect.Width - offset - this.image.Width, offset); Rectangle r = new Rectangle(p, new Size(this.image.Width, this.image.Height)); drawParams.Graphics.CompositingMode = CompositingMode.SourceOver; drawParams.Graphics.CompositingQuality = CompositingQuality.HighQuality; drawParams.Graphics.DrawImage(this.image, r, new Rectangle(new Point(0, 0), this.image.Size), GraphicsUnit.Pixel); } return(false); }
public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { GroupByRowDescriptionUIElement element = (GroupByRowDescriptionUIElement)drawParams.Element; if (element.GroupByRow.Value is int) { int value = (int)element.GroupByRow.Value; if (value % 2 == 0) { drawParams.AppearanceData.ForeColor = Color.Orange; } } return(false); }
private void DrawElement_SortIndicatorUIElement(ref UIElementDrawParams drawParams) { SortIndicatorUIElement e = (SortIndicatorUIElement)drawParams.Element; global::Infragistics.Win.UltraWinGrid.ColumnHeader header = (global::Infragistics.Win.UltraWinGrid.ColumnHeader)e.GetContext(typeof(global::Infragistics.Win.UltraWinGrid.ColumnHeader)); if (header.Column.SortIndicator == SortIndicator.Ascending) { drawParams.DrawImage(Properties.Resources.arrow_up_9, drawParams.Element.Rect, false, new ImageAttributes()); } else if (header.Column.SortIndicator == SortIndicator.Descending) { drawParams.DrawImage(Properties.Resources.arrow_down_9, drawParams.Element.Rect, false, new ImageAttributes()); } }
/// <summary> /// Called before each element is about to be drawn. /// </summary> /// <param name="drawParams">The <see cref="T:Infragistics.Win.UIElementDrawParams" /> used to provide rendering information.</param> /// <returns> /// Bit flags indicating which phases of the drawing operation to filter. The DrawElement method will be called only for those phases. /// </returns> public DrawPhase GetPhasesToFilter(ref UIElementDrawParams drawParams) { UIElement element = drawParams.Element; if (element is DayOfWeekHeaderUIElement) { return(DrawPhase.BeforeDrawBorders); } if (element is DayNumberUIElement) { return(DrawPhase.BeforeDrawFocus); } return(DrawPhase.None); }
private Rectangle GetDropDownButtonRect(UIElementDrawParams drawParams) { Rectangle originalRect = drawParams.Element.Rect; if (originalRect.Width <= 16 || originalRect.Height <= 16) { return(originalRect); } int adjustX = (originalRect.Width - 16) / 2; int adjustY = (originalRect.Height - 16) / 2; Rectangle rect = new Rectangle(originalRect.X + adjustX, originalRect.Y + adjustY, 16, 16); return(rect); }
/// <summary> /// Called during the drawing operation of a UIElement for a specific phase /// of the operation. This will only be called for the phases returned /// from the GetPhasesToFilter method. /// </summary> /// <param name="drawPhase">Contains a single bit which identifies the current draw phase.</param> /// <param name="drawParams">The <see cref="T:Infragistics.Win.UIElementDrawParams" /> used to provide rendering information.</param> /// <returns> /// Returning true from this method indicates that this phase has been handled and the default processing should be skipped. /// </returns> /// <exception cref="System.NotImplementedException"></exception> public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { switch (drawPhase) { case DrawPhase.BeforeDrawBorders: if (drawParams.Element is HeaderUIElement) { drawParams.DrawBorders(UIElementBorderStyle.TwoColor, System.Windows.Forms.Border3DSide.Bottom); return(true); } break; } return(false); }
/// <summary> /// This method is passed the same UIElementDrawParams structure as GetPhasesToFilter() and a bit flag indicating /// which single draw phase is being performed. The method returns a boolean. If false is returned then the default /// drawing for that phase will be performed. If true is returned for a 'Before' phase then the default drawing /// for that phase will be skipped. Note: returning true for the BeforeDrawElement phase will cause all the other /// phases to be skipped (even if bits for those phases were returned by the call to GetPhasesToFilter). /// Also, if themes are active, returning true for the BeforeDrawTheme phase will skip all phases up to but not /// including the BeforeDrawChildElements phase. The BeforeDrawFocus phase is only called if the control has focus /// (or the forceDrawAsFocused parameter was set to true on the call to the Draw method) and the element's virtual /// DrawsFocusRect property returns true. /// </summary> public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { // The TextHAlign set on the label must be honored, so we setup a StringFormat // to use when drawing the text. HAlign align = drawParams.AppearanceData.TextHAlign; StringFormat frmt = new StringFormat(); if (align == HAlign.Left) { frmt.Alignment = StringAlignment.Near; } else if (align == HAlign.Center) { frmt.Alignment = StringAlignment.Center; } else if (align == HAlign.Right) { frmt.Alignment = StringAlignment.Far; } // Draw the text. drawParams.Graphics.DrawString( _text.ToString(), drawParams.Font, drawParams.TextBrush, drawParams.Element.RectInsideBorders, frmt ); if (!_hasScrolled) { // Rearrange the characters in our private copy of the label's Text so that the next // time we draw the string it will be "scrolled" by one character. UpdateText(); // Since we only want to scroll the text once per tick of the timer, // set this flag now to prevent this block of code from executing until the next tick. _hasScrolled = true; } // Returning true prevents the text we just drew from being drawn over. return(true); }
/// <summary> /// Called during the drawing operation of a UIElement for a specific phase /// of the operation. This will only be called for the phases returned /// from the GetPhasesToFilter method. /// </summary> /// <param name="drawPhase">Contains a single bit which identifies the current draw phase.</param> /// <param name="drawParams">The <see cref="T:Infragistics.Win.UIElementDrawParams" /> used to provide rendering information.</param> /// <returns> /// Returning true from this method indicates that this phase has been handled and the default processing should be skipped. /// </returns> /// <exception cref="System.NotImplementedException"></exception> public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { switch (drawPhase) { case DrawPhase.BeforeDrawBackColor: EditorButtonUIElement editorButtonUIElement = drawParams.Element as EditorButtonUIElement; if (editorButtonUIElement != null && editorButtonUIElement.IsMouseOver && !editorButtonUIElement.IsMouseDown) { drawParams.AppearanceData.BackColor = System.Drawing.Color.FromArgb(211, 211, 211); } break; } return(false); }
public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { var marqueeElement = drawParams.Element as MarqueeIndicatorUIElement; if (marqueeElement != null && text != String.Empty) { if (textSize.IsEmpty) { textSize = drawParams.Graphics.MeasureString(text, font); } Rectangle workRect = marqueeElement.RectInsideBorders; drawParams.Graphics.DrawString(text, font, drawParams.TextBrush, new PointF(workRect.Right - (workRect.Width + textSize.Width) / 2, workRect.Bottom - (workRect.Height + textSize.Height) / 2)); } return(false); }
public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { // Custom draw borders around the column headers. HeaderUIElement headerUiElement = drawParams.Element as HeaderUIElement; if (headerUiElement != null && drawPhase == DrawPhase.BeforeDrawBorders) { drawParams.DrawBorders(headerUiElement.BorderStyle, Border3DSide.Bottom); return(true); } // Remove the focus rectangle. if (drawPhase == DrawPhase.BeforeDrawFocus) { return(true); } return(false); }
private void DrawElement_RowSelectorUIElement(ref UIElementDrawParams drawParams) { Rectangle rect = drawParams.Element.Rect; rect.X += 1; UltraGridRow ultraGridRow = (UltraGridRow)drawParams.Element.GetContext(typeof(UltraGridRow)); // active row header color if (ultraGridRow.IsActiveRow == true) { drawParams.AppearanceData.BackColor = CommonColorSet.ActiveCellHeaderColor; } drawParams.DrawBackColor(rect); drawParams.DrawBorders(UIElementBorderStyle.Solid, Border3DSide.Top | Border3DSide.Bottom | Border3DSide.Right, rect); // draw row number drawParams.DrawString(drawParams.Element.Rect, (ultraGridRow.VisibleIndex + 1).ToString(), false, false); // draw CRUD image. (DataRow Only) Rectangle imageRect = new Rectangle(rect.Left + 3, rect.Top + (ultraGridRow.Height - Properties.Resources.new_16.Height) / 2, Properties.Resources.new_16.Width, Properties.Resources.new_16.Height); // DataRowView 얻기 DataRowView dataRowView = (DataRowView)ultraGridRow.ListObject; DataRow dataRow = dataRowView.Row; switch (dataRow.RowState) { case DataRowState.Added: drawParams.DrawImage(Properties.Resources.new_16, imageRect, false, null); break; case DataRowState.Modified: drawParams.DrawImage(Properties.Resources.edit_16, imageRect, false, null); break; case DataRowState.Deleted: drawParams.DrawImage(Properties.Resources.delete_16, imageRect, false, null); break; } }
public DrawPhase GetPhasesToFilter(ref UIElementDrawParams drawParams) { bool handling = false; if (drawParams.Element is RowSelectorUIElement) { handling = true; } if (drawParams.Element is RowSelectorHeaderUIElement) { handling = true; } if (drawParams.Element is EditorWithComboDropDownButtonUIElement) { handling = true; } if (drawParams.Element is SortIndicatorUIElement) { handling = true; } if (drawParams.Element is FilterDropDownButtonUIElement) { handling = true; } if (drawParams.Element is CaptionAreaUIElement) { handling = true; } if (drawParams.Element is TabItemUIElement) { handling = true; } if (handling == true) { return(drawParams.DrawPhase); } return(DrawPhase.BeforeDrawFocus); }
/// <summary> /// Called before each element is about to be drawn. /// </summary> /// <param name="drawParams">Exposes properties required for drawing an element (e.g. Element, Graphics, InvalidRect etc.)</param> /// <returns> /// Bit flags indicating which phases of the drawing operation to filter. The DrawElement method will be called only for those phases. /// </returns> DrawPhase IUIElementDrawFilter.GetPhasesToFilter(ref UIElementDrawParams drawParams) { UltraTreeNode treeNode = drawParams.Element.GetContext(typeof(UltraTreeNode), true) as UltraTreeNode; if (treeNode != null) { if (drawParams.Element is NodeSelectableAreaUIElement) { return(DrawPhase.AfterDrawElement); } if (treeNode.Level == 0) { // draw background area (Group Headers): if (drawParams.Element is TreeNodeUIElement) { return(DrawPhase.BeforeDrawBorders); //Middle side } } } return(DrawPhase.None); }
DrawPhase IUIElementDrawFilter.GetPhasesToFilter(ref UIElementDrawParams drawParams) { UIElement element = drawParams.Element; // Look for an ImageUIElement if (element is ImageUIElement) { // Presumably, we only want to this images in cells // and not every image in the entire grid, so make sure it's in a cell. CellUIElement cellElement = element.GetAncestor(typeof(CellUIElement)) as CellUIElement; if (null != cellElement) { // We could also limit this to a particular column or columns. switch (cellElement.Cell.Column.Key) { case "Image": return(DrawPhase.BeforeDrawImage); } } } return(DrawPhase.None); }
/// <summary> /// Called during the drawing operation of a UIElement for a specific phase /// of the operation. This will only be called for the phases returned /// from the GetPhasesToFilter method. /// </summary> /// <param name="drawPhase">Contains a single bit which identifies the current draw phase.</param> /// <param name="drawParams">The <see cref="T:Infragistics.Win.UIElementDrawParams" /> used to provide rendering information.</param> /// <returns> /// Returning true from this method indicates that this phase has been handled and the default processing should be skipped. /// </returns> /// <exception cref="System.NotImplementedException"></exception> public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { UIElement element = drawParams.Element; switch (drawPhase) { case DrawPhase.BeforeDrawBorders: { Border3DSide sides = (Border3DSide)0; if (element is DayOfWeekHeaderUIElement) { sides = Border3DSide.Top | Border3DSide.Bottom; } if (sides != 0) { if ((sides & Border3DSide.Top) != 0) { drawParams.DrawBorders(UIElementBorderStyle.Solid, Border3DSide.Top); } if ((sides & Border3DSide.Bottom) != 0) { drawParams.DrawBorders(UIElementBorderStyle.TwoColor, Border3DSide.Bottom); } return(true); } break; } case DrawPhase.BeforeDrawFocus: return(true); } return(false); }
private void DrawElement_EditorWithComboDropDownButtonUIElement(ref UIElementDrawParams drawParams) { EditorWithComboDropDownButtonUIElement dropDownButtonElement = (EditorWithComboDropDownButtonUIElement)drawParams.Element; if (dropDownButtonElement.Parent is EditorWithComboUIElement) { EditorWithComboUIElement comboElement = (EditorWithComboUIElement)dropDownButtonElement.Parent; UltraGridCell cell = (UltraGridCell)comboElement.SelectableItem; UltraGridColumn column = cell.Column; if (this.grid.IsCellEditable(cell) == true) { if (dropDownButtonElement.IsHotTracked == true) { drawParams.AppearanceData.BackColor = Color.FromArgb(230, 230, 230); drawParams.DrawBackColor(drawParams.Element.Rect); drawParams.DrawImage(Properties.Resources.button_code_hover, this.GetDropDownButtonRect(drawParams), false, null); drawParams.DrawBorders(UIElementBorderStyle.Solid, Border3DSide.Left); } else { drawParams.AppearanceData.BackColor = Color.FromArgb(215, 215, 215); drawParams.DrawBackColor(drawParams.Element.Rect); drawParams.DrawImage(Properties.Resources.button_code_normal, this.GetDropDownButtonRect(drawParams), false, null); drawParams.DrawBorders(UIElementBorderStyle.Solid, Border3DSide.Left); } } else { drawParams.AppearanceData.BackColor = Color.FromArgb(180, 180, 180); drawParams.DrawBackColor(drawParams.Element.Rect); drawParams.DrawImage(Properties.Resources.button_code_normal, this.GetDropDownButtonRect(drawParams), false, null); drawParams.DrawBorders(UIElementBorderStyle.Solid, Border3DSide.Left); } } }
/// <summary> /// This method is passed a UIElementDrawParams structure and returns a bit-flag enumeration called DrawPhase. /// The passed in structure exposes a property that returns the element to be rendered as well as properties /// and methods to support rendering operations like Graphics, BackBrush, DrawBorders etc. The returned /// DrawPhase bit-flags specify which phase(s) of the drawing operation to filter for this element /// (the DrawElement method below will be called for each bit returned). /// The DrawPhase enumeration allows you to filter the drawing before or after each drawing operation of /// an element (e.g. theme, backcolor, image background, borders, foreground, image and/or child elements). /// </summary> public DrawPhase GetPhasesToFilter(ref UIElementDrawParams drawParams) { // Indicates that we want this filter's DrawElement method to be invoked prior to when the // foreground (text) of the control is drawn. return(drawParams.Element is TextUIElementBase ? DrawPhase.BeforeDrawForeground : DrawPhase.None); }
public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { // Only draw the top and bottom border drawParams.DrawBorders(UIElementBorderStyle.Solid, Border3DSide.Top | Border3DSide.Bottom); return(true); }
DrawPhase IUIElementDrawFilter.GetPhasesToFilter(ref UIElementDrawParams drawParams) { return(DrawPhase.BeforeDrawFocus); }
bool IUIElementDrawFilter.DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { return(drawPhase == DrawPhase.BeforeDrawFocus); }
bool IUIElementDrawFilter.DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { var scale = (float)owner.DeviceDpi / 96; var sz1 = (int)(1 * scale); var sz2 = (int)(2 * scale); var sz3 = (int)(3 * scale); var sz4 = (int)(4 * scale); var sz5 = (int)(5 * scale); var sz6 = (int)(6 * scale); var sz7 = (int)(7 * scale); var sz8 = (int)(8 * scale); var sz9 = (int)(9 * scale); var sz10 = (int)(10 * scale); var sz14 = (int)(14 * scale); var sz16 = (int)(16 * scale); var sz20 = (int)(20 * scale); var sz23 = (int)(23 * scale); var sz26 = (int)(26 * scale); var sz27 = (int)(27 * scale); var sz90 = (int)(90 * scale); var sz180 = (int)(180 * scale); int FLAG_WIDTH = sz23; UltraTreeNodeExtended treeNode = drawParams.Element.GetContext(typeof(UltraTreeNode), true) as UltraTreeNodeExtended; if (treeNode != null) { RectangleF initialRect = (RectangleF)drawParams.Element.RectInsideBorders; Rectangle r = new Rectangle((int)initialRect.Left, (int)initialRect.Top, (int)initialRect.Width, (int)initialRect.Height); r.X -= sz2; r.Width += sz2; r.Height = treeNode.ItemHeightResolved; Rectangle rO = r; // if (treeNode.Level == 0) { Image img = null; if (treeNode.Expanded) { img = Properties.Resources.Minus_16.GetImageStretchedDpi(scale); } else { img = Properties.Resources.Plus_16.GetImageStretchedDpi(scale); } if (!treeNode.Selected) { drawParams.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(220, 224, 227)), r); } //Image drawParams.Graphics.DrawImage(img, r.Left + sz4, r.Top + sz5); treeNode.CollapseRectangle = new Rectangle(r.Left + sz4, r.Top + sz5, img.Width, img.Height); //String Color c = Color.FromArgb(112, 111, 145); drawParams.Graphics.DrawString((string)treeNode.Cells[0].Value /*+ treeNode.DateTime.ToString()*/, new Font(drawParams.Font, FontStyle.Bold), new SolidBrush(c), r.Left + sz20, r.Top + sz4); //Bottom Lines Pen pen = new Pen(Color.FromArgb(165, 164, 189)); drawParams.Graphics.DrawLine(pen, r.Left, r.Bottom - sz1, r.Right, r.Bottom - sz1); drawParams.Graphics.DrawLine(pen, r.Left, r.Bottom, r.Right, r.Bottom); // return(true); } if (treeNode.Level == 1) { INewsItem item = treeNode.NewsItem; Brush bGray = new SolidBrush(Color.FromArgb(128, 128, 128)); if (treeNode.Selected) { bGray = Brushes.White; drawParams.Graphics.FillRectangle(new SolidBrush(Color.DarkBlue), r); } //Icon treeNode.NodeOwner.ListView.SmallImageList.Draw(drawParams.Graphics, r.Left + sz7, r.Top + sz3, treeNode.NodeOwner.ImageIndex); //Flag Rectangle rF = r; rF.X = rF.Right - FLAG_WIDTH; rF.Width = FLAG_WIDTH; int flagInd = GetFlagImageIndex(item.FlagStatus); treeNode.NodeOwner.ListView.SmallImageList.Draw(drawParams.Graphics, rF.Left + sz2 + (rF.Width - treeNode.NodeOwner.ListView.SmallImageList.ImageSize.Width) / 2, rF.Top + sz2 + (rF.Height - treeNode.NodeOwner.ListView.SmallImageList.ImageSize.Height) / 2, flagInd); treeNode.FlagRectangle = rF; //Date r.Width -= FLAG_WIDTH; r.Height = MeasureDisplayStringHeight(drawParams.Graphics, "W", treeNode.NodeOwner.Font); r.Y += sz3; Rectangle r2 = r; r.X += sz180; r.Width -= sz180; string dtS = item.Date.ToLocalTime().ToShortDateString() + " " + item.Date.ToLocalTime().ToShortTimeString(); if (((UltraTreeNodeExtended)treeNode.Parent).IsGroupOneDay) { dtS = item.Date.ToLocalTime().ToString("HH:mm"); } int ww = MeasureDisplayStringWidth(drawParams.Graphics, dtS, treeNode.NodeOwner.Font); r.X = r.Right - ww; r.Width = ww + sz10; drawParams.Graphics.DrawString(dtS, treeNode.NodeOwner.Font, bGray, r); //Author r2.X += sz26; r2.Width = r.X - r2.X; r = r2; string author = (string.IsNullOrEmpty(item.Author) ? item.Feed.title: item.Author); drawParams.Graphics.DrawString(author, treeNode.NodeOwner.Font, bGray, r); //Title r = rO; r.X += sz26; r.Width -= sz26 + FLAG_WIDTH; if (item.CommentCount > 0) { r.Width -= sz16; } if (item.Enclosures != null && item.Enclosures.Count > 0) { r.Width -= sz16; } r.Y += rO.Height / 2 + sz2; r.Height = MeasureDisplayStringHeight(drawParams.Graphics, item.Title, treeNode.NodeOwner.Font); Brush titleBrush = (treeNode.Selected ? bGray : new SolidBrush(treeNode.NodeOwner.ForeColor)); drawParams.Graphics.DrawString(item.Title, treeNode.NodeOwner.Font, titleBrush, r); //Comments int posAddons = 0; if (item.Enclosures != null && item.Enclosures.Count > 0) { Rectangle rC = r; rC.X = r.Right; rC.Width = sz16; rC.Height -= sz2; posAddons += sz16; treeNode.NodeOwner.ListView.SmallImageList.Draw(drawParams.Graphics, rC.Left, rC.Top, Resource.NewsItemRelatedImage.Attachment); treeNode.EnclosureRectangle = rC; } if (item.CommentCount > 0) { Rectangle rC = r; rC.X = r.Right + posAddons; rC.Width = sz16; posAddons += sz16; rC.Height -= sz2; var bmp = Properties.Resources.Comment_16.GetImageStretchedDpi(scale); drawParams.Graphics.DrawImage(bmp, rC.Left + sz2, rC.Top + sz1, bmp.Width, bmp.Height); treeNode.CommentsRectangle = rC; } //Bottom Line drawParams.Graphics.DrawLine(new Pen(Color.FromArgb(234, 233, 225)), rO.Left, rO.Bottom, rO.Right, rO.Bottom); // return(true); } if (treeNode.Level == 2) { //Comments if (treeNode.IsCommentUpdating) { if (treeNode.Cells.Count > 0 && treeNode.Cells[0].Value is string) { r.Y += sz2; r.Height -= sz2; //Text r.X += UltraTreeExtended.COMMENT_HEIGHT + sz3 + sz20; drawParams.Graphics.DrawString((string)treeNode.Cells[0].Value, treeNode.Control.Font, Brushes.Black, r); //Bottom Line drawParams.Graphics.DrawLine(new Pen(Color.FromArgb(234, 233, 225)), rO.Left, rO.Bottom, rO.Right, rO.Bottom); return(true); } return(false); } else { INewsItem ni = treeNode.NewsItem; r.X += sz27; r.Width -= sz27; r.Y += sz3; r.Height -= sz4; //Icon treeNode.NodeOwner.ListView.SmallImageList.Draw(drawParams.Graphics, r.Left, r.Top - sz1, treeNode.NodeOwner.ImageIndex); //Text r.X += UltraTreeExtended.COMMENT_HEIGHT + sz2; r.Width -= UltraTreeExtended.COMMENT_HEIGHT + sz2; string byAuthor = ""; if (!string.IsNullOrEmpty(ni.Author)) { byAuthor = "(by " + ni.Author + ") "; //TODO:I18N } drawParams.Graphics.DrawString(byAuthor + ni.Title, treeNode.NodeOwner.Font, Brushes.Black, r); //Bottom Line drawParams.Graphics.DrawLine(new Pen(Color.FromArgb(234, 233, 225)), rO.Left, rO.Bottom, rO.Right, rO.Bottom); // return(true); } } } // To return FALSE from this method indicates that the element should draw itself as normal. // To return TRUE from this method indicates that the element should not draw itself. // Return true to prevent further drawing by the element return(false); }
public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { if (drawParams.Element is EmbeddableUIElementBase) { CellUIElement oCellUIElement = (CellUIElement)drawParams.Element.GetAncestor(typeof(CellUIElement)); UltraGridCell oCell = oCellUIElement.Cell; if (oCell == null || oCell.Column.Key.ToLower() != "percent") { return(false); } Rectangle rect = new Rectangle(); if (oCell.Value == null) { return(false); } int nCellWidth = drawParams.Element.RectInsideBorders.Width; int cellValue = Convert.ToInt32(oCell.Value); float percent = (float)(cellValue); percent = percent / (float)100; int nFillWidth = (int)(nCellWidth * percent); rect = new Rectangle(drawParams.Element.RectInsideBorders.X, drawParams.Element.RectInsideBorders.Y, nFillWidth, drawParams.Element.RectInsideBorders.Height); if (drawParams.DrawPhase == Infragistics.Win.DrawPhase.AfterDrawBackColor) { Brush brush = new SolidBrush(Color.DarkOrange); drawParams.Graphics.FillRectangle(brush, rect); Font font = drawParams.Font;//new Font("Arial", 9); string text = oCell.Value.ToString() + "%"; int nStringWidth = (int)drawParams.Graphics.MeasureString(text, font).Width; int left = oCellUIElement.RectInsideBorders.X + oCellUIElement.RectInsideBorders.Width / 2; left = left - nStringWidth / 2; int top = oCellUIElement.RectInsideBorders.Y; // If the text is going to be drawn over the flood filled area then make sure // the color is different from the flood color otherwise it won't show up. if (left < rect.Right) { brush.Dispose(); brush = new SolidBrush(Color.Black); } Brush brushFont = new SolidBrush(Color.Black); drawParams.Graphics.DrawString(text, font, brushFont, left, top); brush.Dispose(); return(true); } } return(false); }
private void DrawElement_FilterDropDownButtonUIElement(ref UIElementDrawParams drawParams) { drawParams.DrawImage(Properties.Resources.filter_12, drawParams.Element.Rect, false, new ImageAttributes()); }
bool IUIElementDrawFilter.DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { // Return tru to tell the control that all of the drawing for this phase is complete // and the control should not draw anything. return(true); }
DrawPhase IUIElementDrawFilter.GetPhasesToFilter(ref UIElementDrawParams drawParams) { return(DrawPhase.AfterDrawElement | DrawPhase.BeforeDrawElement); }
//The actual drawing code bool IUIElementDrawFilter.DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { UIElement aUIElement; Graphics g; UltraTreeNode aNode; //If there//s no DropHighlight node or no position //specified, then we don//t need to draw anything special. //Just exit Function if ((mvarDropHighLightNode == null) || (mvarDropLinePosition == DropLinePositionEnum.None)) { return(false); } //Create a new QueryStateAllowedForNodeEventArgs object //to pass to the event var eArgs = new QueryStateAllowedForNodeEventArgs(); //Initialize the object with the correct info eArgs.Node = mvarDropHighLightNode; eArgs.DropLinePosition = mvarDropLinePosition; //Default to all states allowed. eArgs.StatesAllowed = DropLinePositionEnum.All; //Raise the event QueryStateAllowedForNode(this, eArgs); //Check to see if the user allowed the current state //for this node. If not, exit function if ((eArgs.StatesAllowed & mvarDropLinePosition) != mvarDropLinePosition) { return(false); } //Get the element being drawn aUIElement = drawParams.Element; //Determine which drawing phase we are in. switch (drawPhase) { case DrawPhase.BeforeDrawElement: { //We are in BeforeDrawElement, so we are only concerned with //drawing the OnNode state. if ((mvarDropLinePosition & DropLinePositionEnum.OnNode) == DropLinePositionEnum.OnNode) { //Check to see if we are drawing a NodeTextUIElement if (aUIElement.GetType() == typeof(NodeTextUIElement)) { //Get a reference to the node that this //NodeTextUIElement is associated with aNode = (UltraTreeNode)aUIElement.GetContext(typeof(UltraTreeNode)); //See if this is the DropHighlightNode if (aNode.Equals(mvarDropHighLightNode)) { //Set the ForeColor and Backcolor of the node //to the DropHighlight colors //Note that AppearanceData only affects the //node for this one paint. It will not //change any properties of the node drawParams.AppearanceData.BackColor = mvarDropHighLightBackColor; drawParams.AppearanceData.ForeColor = mvarDropHighLightForeColor; } } } break; } case DrawPhase.AfterDrawElement: { //We're in AfterDrawElement //So the only states we are conderned with are //Below and Above //Check to see if we are drawing the Tree Element if (aUIElement.GetType() == typeof(UltraTreeUIElement)) { //Declare a pen to us for drawing Droplines var p = new Pen(mvarDropLineColor, mvarDropLineWidth); //Get a reference to the Graphics object //we are drawing to. g = drawParams.Graphics; //Get the NodeSelectableAreaUIElement for the //current DropNode. We will use this for //positioning and sizing the DropLine NodeSelectableAreaUIElement tElement; tElement = (NodeSelectableAreaUIElement) drawParams.Element.GetDescendant(typeof(NodeSelectableAreaUIElement), mvarDropHighLightNode); //The left edge of the DropLine int LeftEdge = tElement.Rect.Left - 4; //We need a reference to the control to //determine the right edge of the line UltraTree aTree; aTree = (UltraTree)tElement.GetContext(typeof(UltraTree)); int RightEdge = aTree.DisplayRectangle.Right - 4; //Used to store the Vertical position of the //DropLine int LineVPosition; if ((mvarDropLinePosition & DropLinePositionEnum.AboveNode) == DropLinePositionEnum.AboveNode) { //Draw line above node LineVPosition = mvarDropHighLightNode.Bounds.Top; g.DrawLine(p, LeftEdge, LineVPosition, RightEdge, LineVPosition); p.Width = 1; g.DrawLine(p, LeftEdge, LineVPosition - 3, LeftEdge, LineVPosition + 2); g.DrawLine(p, LeftEdge + 1, LineVPosition - 2, LeftEdge + 1, LineVPosition + 1); g.DrawLine(p, RightEdge, LineVPosition - 3, RightEdge, LineVPosition + 2); g.DrawLine(p, RightEdge - 1, LineVPosition - 2, RightEdge - 1, LineVPosition + 1); } if ((mvarDropLinePosition & DropLinePositionEnum.BelowNode) == DropLinePositionEnum.BelowNode) { //Draw Line below node LineVPosition = mvarDropHighLightNode.Bounds.Bottom; g.DrawLine(p, LeftEdge, LineVPosition, RightEdge, LineVPosition); p.Width = 1; g.DrawLine(p, LeftEdge, LineVPosition - 3, LeftEdge, LineVPosition + 2); g.DrawLine(p, LeftEdge + 1, LineVPosition - 2, LeftEdge + 1, LineVPosition + 1); g.DrawLine(p, RightEdge, LineVPosition - 3, RightEdge, LineVPosition + 2); g.DrawLine(p, RightEdge - 1, LineVPosition - 2, RightEdge - 1, LineVPosition + 1); } } break; } } return(false); }
public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { return true; }
public DrawPhase GetPhasesToFilter(ref UIElementDrawParams drawParams) { return DrawPhase.None; }
public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams) { return drawPhase == DrawPhase.BeforeDrawBorders || drawPhase == DrawPhase.BeforeDrawFocus; }