private void WmMouseUp(Message m) { Point point = GISShare.Win32.NativeMethods.LParamToMouseLocation((int)m.LParam); // if (this.DisplayRectangle.Contains(point)) { if (this.UpButtonRectangle.Contains(point)) { this.m_eUpButtonState = GISShare.Controls.WinForm.WFNew.BaseItemState.eHot; this.m_eDownButtonState = GISShare.Controls.WinForm.WFNew.BaseItemState.eNormal; } else if (this.DownButtonRectangle.Contains(point)) { this.m_eUpButtonState = GISShare.Controls.WinForm.WFNew.BaseItemState.eNormal; this.m_eDownButtonState = GISShare.Controls.WinForm.WFNew.BaseItemState.eHot; } // this.SetBaseItemStateEx(WFNew.BaseItemState.eHot); } else { this.m_eUpButtonState = GISShare.Controls.WinForm.WFNew.BaseItemState.eNormal; this.m_eDownButtonState = GISShare.Controls.WinForm.WFNew.BaseItemState.eNormal; this.SetBaseItemStateEx(WFNew.BaseItemState.eNormal); } }
protected virtual bool SetCaptionState(BaseItemState baseItemState) { if (this.m_eCaptionState == baseItemState) { return(false); } this.m_eCaptionState = baseItemState; return(true); }
protected virtual bool SetDownButtonState(WFNew.BaseItemState baseItemState) { if (this.m_eDownButtonState == baseItemState) { return(false); } this.m_eDownButtonState = baseItemState; return(true); }
protected virtual void SetCollapseButtonState(WFNew.BaseItemState collapseButtonState) { if (m_eCollapseButtonState == collapseButtonState) { return; } // m_eCollapseButtonState = collapseButtonState; }
protected virtual void SetCollapseButtonStateEx(WFNew.BaseItemState collapseButtonState) { if (m_eCollapseButtonState == collapseButtonState) { return; } // m_eCollapseButtonState = collapseButtonState; this.Invalidate(this.CollapseButtonRectangle); }
protected virtual bool SetCaptionStateEx(BaseItemState baseItemState) { if (this.m_eCaptionState == baseItemState) { return(false); } this.m_eCaptionState = baseItemState; this.Invalidate(this.CaptionRectangle); return(true); }
protected virtual bool SetBaseItemStateEx(WFNew.BaseItemState baseItemState) { if (this.m_eBaseItemState == baseItemState) { return(false); } this.m_eBaseItemState = baseItemState; this.Refresh(); return(true); }
protected virtual bool SetDownButtonStateEx(WFNew.BaseItemState baseItemState) { if (this.m_eDownButtonState == baseItemState) { return(false); } // this.m_eDownButtonState = baseItemState; this.Invalidate(this.DownButtonRectangle); // return(true); }
void m_HostTreeView_DrawNode(object sender, DrawTreeNodeEventArgs e) { if (this.Nodes == null || this.Nodes.Count <= 0) { return; } // WFNew.BaseItemState eBaseItemState = GISShare.Controls.WinForm.WFNew.BaseItemState.eNormal; if (this.AutoMouseMoveSeleced && e.Node == this.GetNodeAt(this.PointToClient(Form.MousePosition))) { eBaseItemState = this.m_IsMouseDown || e.Node.IsEditing ? WFNew.BaseItemState.ePressed : GISShare.Controls.WinForm.WFNew.BaseItemState.eHot; } // this.DrawItem_TreeNodeItem(e, eBaseItemState); }
protected override void OnDrawSubItem(DrawListViewSubItemEventArgs e) { if (e.Item.SubItems.IndexOf(e.SubItem) > 0) { if (this.AutoDrawSubItem) { WFNew.BaseItemState eBaseItemState = GISShare.Controls.WinForm.WFNew.BaseItemState.eNormal; if (this.AutoMouseMoveSeleced && e.SubItem.Bounds.Contains(this.PointToClient(Form.MousePosition))) { eBaseItemState = this.m_IsMouseDown ? GISShare.Controls.WinForm.WFNew.BaseItemState.ePressed : GISShare.Controls.WinForm.WFNew.BaseItemState.eHot; } // GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderListViewSubItem ( new ItemRenderEventArgs ( e.Graphics, e.SubItem, this, CheckState.Unchecked, eBaseItemState, e.SubItem.Bounds, e.SubItem.Bounds, e.SubItem.Bounds, e.SubItem.Bounds ) ); } // int iH = (int)e.Graphics.MeasureString(e.SubItem.Text, e.SubItem.Font == null ? this.Font : e.SubItem.Font).Height; GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderText ( new GISShare.Controls.WinForm.TextRenderEventArgs ( e.Graphics, this, this.Enabled, false, e.SubItem.Text, e.SubItem.ForeColor.IsEmpty ? this.ForeColor : e.SubItem.ForeColor, e.SubItem.Font == null ? this.Font : e.SubItem.Font, new Rectangle(e.SubItem.Bounds.Left, (e.SubItem.Bounds.Top + e.SubItem.Bounds.Bottom - iH) / 2 + 2, e.SubItem.Bounds.Width, iH) ) ); } // base.OnDrawSubItem(e); }
protected override void OnDrawNode(DrawTreeNodeEventArgs e) { if (this.Nodes.Count > 0) { // WFNew.BaseItemState eBaseItemState = GISShare.Controls.WinForm.WFNew.BaseItemState.eNormal; if (this.AutoMouseMoveSeleced && e.Node == this.GetNodeAt(this.PointToClient(Form.MousePosition))) { eBaseItemState = this.m_IsMouseDown || e.Node.IsEditing ? WFNew.BaseItemState.ePressed : GISShare.Controls.WinForm.WFNew.BaseItemState.eHot; } // this.DrawItem_TreeNodeItem(e, eBaseItemState); } // base.OnDrawNode(e); }
protected override void OnDrawItem(DrawItemEventArgs e) { if (this.Items.Count > 0) { if (e.Index < 0 || e.Index >= this.Items.Count) { return; } // WFNew.BaseItemState eBaseItemState = GISShare.Controls.WinForm.WFNew.BaseItemState.eNormal; if (this.AutoMouseMoveSeleced && e.Index == this.IndexFromPoint(this.PointToClient(Form.MousePosition))) { eBaseItemState = this.m_IsMouseDown ? WFNew.BaseItemState.ePressed : GISShare.Controls.WinForm.WFNew.BaseItemState.eHot; } // if (!this.DrawItemEx(e, eBaseItemState, this.Items[e.Index])) { if (!this.DrawItem_ImageItem(e, eBaseItemState, this.Items[e.Index] as WinForm.IImageItem)) { if (!this.DrawItem_ColorItem(e, eBaseItemState, this.Items[e.Index] as WinForm.IColorItem)) { if (!this.DrawItem_FontItem(e, eBaseItemState, this.Items[e.Index] as WinForm.IFontItem)) { if (!this.DrawItem_Item(e, eBaseItemState, this.Items[e.Index] as WinForm.IItem)) { object obj = this.Items[e.Index]; string str = "null"; if (obj != null) { str = obj.ToString(); } this.DrawItem_Item(e, eBaseItemState, new WinForm.Item(str, str)); } } } } } } // base.OnDrawItem(e); }
protected override void OnDrawItem(DrawListViewItemEventArgs e) { if (this.Items.Count > 0) { WFNew.BaseItemState eBaseItemState = GISShare.Controls.WinForm.WFNew.BaseItemState.eNormal; if (this.AutoMouseMoveSeleced && this.ItemBoundsContains(e.Item)) { eBaseItemState = this.m_IsMouseDown ? GISShare.Controls.WinForm.WFNew.BaseItemState.ePressed : GISShare.Controls.WinForm.WFNew.BaseItemState.eHot; } // switch (this.View) { case View.LargeIcon: this.DrawItem_ListViewItem_LI(e, eBaseItemState); break; case View.Tile: this.DrawItem_ListViewItem_T(e, eBaseItemState); break; case View.Details: this.DrawItem_ListViewItem_D(e, eBaseItemState); break; case View.SmallIcon: this.DrawItem_ListViewItem_S(e, eBaseItemState); break; case View.List: default: this.DrawItem_ListViewItem_L(e, eBaseItemState); break; } } // base.OnDrawItem(e); }
private void DrawTabPage(TabPage tabPage, CheckState eCheckState, Rectangle rectangle, Graphics g) { WFNew.BaseItemState eBaseItemState = GISShare.Controls.WinForm.WFNew.BaseItemState.eNormal; if (rectangle.Contains(this.PointToClient(Form.MousePosition))) { eBaseItemState = this.m_IsMouseDown ? WFNew.BaseItemState.ePressed : GISShare.Controls.WinForm.WFNew.BaseItemState.eHot; } // Image image = this.GetTabItemImage(tabPage); // Size size = g.MeasureString(tabPage.Text, tabPage.Font == null ? this.Font : tabPage.Font).ToSize(); size = new Size(size.Width + 1, size.Height + 1); // Size imageSize = image == null ? new Size(0, 0) : this.ImageList.ImageSize; // Rectangle rectangleIT = new Rectangle ( (rectangle.Left + rectangle.Right - imageSize.Width - CTR_IMAGEGRIPSEPARATORWIDTH - size.Width) / 2, (rectangle.Top + rectangle.Bottom - size.Height) / 2 + 2, imageSize.Width + CTR_IMAGEGRIPSEPARATORWIDTH + size.Width, size.Height ); Rectangle rectangleI = new Rectangle(rectangleIT.Left, (rectangle.Top + rectangle.Bottom - imageSize.Height) / 2, imageSize.Width, imageSize.Height); Rectangle rectangleT = Rectangle.FromLTRB(rectangleIT.Right - size.Width, rectangleIT.Top, rectangleIT.Right, rectangleIT.Bottom); StringFormat stringFormat = new StringFormat(); stringFormat.Trimming = StringTrimming.EllipsisCharacter; switch (this.Alignment) { case TabAlignment.Bottom: rectangleIT = new Rectangle ( (rectangle.Left + rectangle.Right - imageSize.Width - CTR_IMAGEGRIPSEPARATORWIDTH - size.Width) / 2, (rectangle.Top + rectangle.Bottom - size.Height) / 2 + 1, imageSize.Width + CTR_IMAGEGRIPSEPARATORWIDTH + size.Width, size.Height ); rectangleI = new Rectangle(rectangleIT.Left, (rectangle.Top + rectangle.Bottom - imageSize.Height) / 2, imageSize.Width, imageSize.Height); rectangleT = Rectangle.FromLTRB(rectangleIT.Right - size.Width, rectangleIT.Top, rectangleIT.Right, rectangleIT.Bottom); break; // case TabAlignment.Left: rectangleIT = new Rectangle ( (rectangle.Left + rectangle.Right - size.Height) / 2 + 1, (rectangle.Top + rectangle.Bottom - imageSize.Height - CTR_IMAGEGRIPSEPARATORWIDTH - size.Width) / 2, size.Height, imageSize.Height + CTR_IMAGEGRIPSEPARATORWIDTH + size.Width ); rectangleI = new Rectangle((rectangle.Left + rectangle.Right - imageSize.Width) / 2, rectangleIT.Top, imageSize.Width, imageSize.Height); rectangleT = Rectangle.FromLTRB(rectangleIT.Left, rectangleIT.Bottom - size.Width, rectangleIT.Right, rectangleIT.Bottom); stringFormat.FormatFlags = StringFormatFlags.DirectionVertical; break; case TabAlignment.Right: rectangleIT = new Rectangle ( (rectangle.Left + rectangle.Right - size.Height) / 2 - 1, (rectangle.Top + rectangle.Bottom - imageSize.Height - CTR_IMAGEGRIPSEPARATORWIDTH - size.Width) / 2, size.Height, imageSize.Height + CTR_IMAGEGRIPSEPARATORWIDTH + size.Width ); rectangleI = new Rectangle((rectangle.Left + rectangle.Right - imageSize.Width) / 2, rectangleIT.Top, imageSize.Width, imageSize.Width); rectangleT = Rectangle.FromLTRB(rectangleIT.Left, rectangleIT.Bottom - size.Width, rectangleIT.Right, rectangleIT.Bottom); stringFormat.FormatFlags = StringFormatFlags.DirectionVertical; break; } // // // GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderTabItem ( new ItemRenderEventArgs ( g, tabPage, this, eCheckState, eBaseItemState, rectangle, rectangle, rectangle, rectangle ) ); // // // if (image != null) { GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderImage ( new GISShare.Controls.WinForm.ImageRenderEventArgs ( g, this, this.Enabled, image, Rectangle.FromLTRB(rectangleI.Left + this.ImageSpace, rectangleI.Top + this.ImageSpace, rectangleI.Right - this.ImageSpace, rectangleI.Bottom - this.ImageSpace) ) ); } // // // GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderTabText ( new GISShare.Controls.WinForm.TextRenderEventArgs ( g, this, this.Enabled, false, tabPage.Text, tabPage.ForeColor, tabPage.Font, rectangleT, stringFormat ) ); }
private bool DrawItem_Item(DrawItemEventArgs e, WFNew.BaseItemState eBaseItemState, WinForm.IItem item) { if (item == null) { return(false); } // if (this.ShowGripRegion) { #region ShowGripRegionT GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderItem ( new ItemRenderEventArgs ( e.Graphics, item, this, this.SelectedIndices.Contains(e.Index) ? CheckState.Checked : CheckState.Unchecked, eBaseItemState, new Rectangle(e.Bounds.X, e.Bounds.Y, this.LeftGripRegionWidth, e.Bounds.Height), new Rectangle(e.Bounds.X, e.Bounds.Y, this.LeftGripRegionWidth + this.ItemHeight + CTR_IMAGEGRIPSEPARATORWIDTH, e.Bounds.Height), Rectangle.FromLTRB(e.Bounds.Left + this.LeftGripRegionWidth + this.ItemHeight + CTR_IMAGEGRIPSEPARATORWIDTH, e.Bounds.Top, e.Bounds.Right, e.Bounds.Bottom), e.Bounds ) ); // int iH = (int)e.Graphics.MeasureString(item.Text, e.Font).Height;// (int)(e.Graphics.MeasureString(item.Text, item.Font).Height + 1); Rectangle rectangle = new Rectangle ( e.Bounds.Left + this.LeftGripRegionWidth + this.ItemHeight + CTR_IMAGEGRIPSEPARATORWIDTH + this.ITSpace, (e.Bounds.Top + e.Bounds.Bottom - iH) / 2 + 2, e.Bounds.Width - this.LeftGripRegionWidth - this.ItemHeight - CTR_IMAGEGRIPSEPARATORWIDTH - this.ITSpace, iH ); GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderText ( new GISShare.Controls.WinForm.TextRenderEventArgs(e.Graphics, this, this.Enabled, false, item.Text, e.ForeColor, e.Font, rectangle) ); #endregion } else { #region ShowGripRegionF GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderItem ( new ItemRenderEventArgs (e.Graphics, item, this, this.SelectedIndices.Contains(e.Index) ? CheckState.Checked : CheckState.Unchecked, eBaseItemState, new Rectangle(e.Bounds.X, e.Bounds.Y, this.LeftGripRegionWidth, e.Bounds.Height), new Rectangle(e.Bounds.X, e.Bounds.Y, this.LeftGripRegionWidth, e.Bounds.Height), Rectangle.FromLTRB(e.Bounds.Left + this.LeftGripRegionWidth, e.Bounds.Top, e.Bounds.Right, e.Bounds.Bottom), e.Bounds ) ); // int iH = (int)e.Graphics.MeasureString(item.Text, e.Font).Height;// (int)(e.Graphics.MeasureString(item.Text, item.Font).Height + 1); Rectangle rectangle = new Rectangle ( e.Bounds.Left + this.LeftGripRegionWidth, (e.Bounds.Top + e.Bounds.Bottom - iH) / 2 + 2, e.Bounds.Width - this.LeftGripRegionWidth, iH ); GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderText ( new GISShare.Controls.WinForm.TextRenderEventArgs(e.Graphics, this, this.Enabled, false, item.Text, e.ForeColor, e.Font, rectangle) ); #endregion } // return(true); }
private bool DrawItem_ColorItem(DrawItemEventArgs e, WFNew.BaseItemState eBaseItemState, WinForm.IColorItem item) { if (item == null) { return(false); } // int iW; if (this.ShowGripRegion) { iW = this.LeftGripRegionWidth + this.ItemHeight; GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderItem ( new ItemRenderEventArgs ( e.Graphics, item, this, this.GetItemCheckState(e.Index), eBaseItemState, new Rectangle(e.Bounds.X, e.Bounds.Y, this.LeftGripRegionWidth, e.Bounds.Height), new Rectangle(e.Bounds.X, e.Bounds.Y, iW + CTR_IMAGEGRIPSEPARATORWIDTH, e.Bounds.Height), Rectangle.FromLTRB(e.Bounds.Left + iW + CTR_IMAGEGRIPSEPARATORWIDTH, e.Bounds.Top, e.Bounds.Right, e.Bounds.Bottom), e.Bounds ) ); } else { iW = this.LeftGripRegionWidth + CTR_COLORREGIONWIDTH; GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderItem ( new ItemRenderEventArgs ( e.Graphics, item, this, this.GetItemCheckState(e.Index), eBaseItemState, new Rectangle(e.Bounds.X, e.Bounds.Y, this.LeftGripRegionWidth, e.Bounds.Height), new Rectangle(e.Bounds.X, e.Bounds.Y, iW + CTR_IMAGEGRIPSEPARATORWIDTH, e.Bounds.Height), e.Bounds, e.Bounds ) ); } int iH = (int)e.Graphics.MeasureString(item.Text, item.Font).Height;// (int)(e.Graphics.MeasureString(item.Text, item.Font).Height + 1); Rectangle rectangle = new Rectangle ( e.Bounds.Left + iW + CTR_IMAGEGRIPSEPARATORWIDTH + this.ITSpace, (e.Bounds.Top + e.Bounds.Bottom - iH) / 2 + 2, e.Bounds.Width - iW - CTR_IMAGEGRIPSEPARATORWIDTH - this.ITSpace, iH ); GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderText ( new GISShare.Controls.WinForm.TextRenderEventArgs(e.Graphics, this, this.Enabled, false, item.Text, item.ForeColor, item.Font, rectangle) ); // return(true); }
protected virtual bool DrawItemEx(DrawItemEventArgs e, WFNew.BaseItemState eBaseItemState, object item) { return(false); }
private void WmMouseLeave() { this.m_eUpButtonState = GISShare.Controls.WinForm.WFNew.BaseItemState.eNormal; this.m_eDownButtonState = GISShare.Controls.WinForm.WFNew.BaseItemState.eNormal; this.SetBaseItemStateEx(WFNew.BaseItemState.eNormal); }
private bool DrawItem_TreeNodeItem(DrawTreeNodeEventArgs e, WFNew.BaseItemState eBaseItemState) { Size size = e.Graphics.MeasureString(e.Node.Text, e.Node.NodeFont == null ? this.Font : e.Node.NodeFont).ToSize(); size = new Size(size.Width + 1, size.Height + 1); // Rectangle rectangleDispaly = this.DisplayRectangle; Rectangle rectangleImageGrip = Rectangle.FromLTRB(e.Node.Bounds.Left - this.ImageGripRegionWidth, e.Node.Bounds.Top, e.Node.Bounds.Left, e.Node.Bounds.Bottom); Rectangle rectangleLeftGrip = Rectangle.FromLTRB(rectangleImageGrip.Left - LeftGripRegionWidth - CTR_IMAGEGRIPSEPARATORWIDTH, e.Bounds.Top, rectangleImageGrip.Left - CTR_IMAGEGRIPSEPARATORWIDTH, e.Bounds.Bottom); Rectangle rectangleNodeBounds = Rectangle.FromLTRB(e.Node.Bounds.Left, e.Bounds.Top, rectangleDispaly.Right, e.Bounds.Bottom); switch (this.eNodeRegionStyle) { case NodeRegionStyle.eRow: rectangleNodeBounds = Rectangle.FromLTRB(rectangleDispaly.Left, e.Bounds.Top, rectangleDispaly.Right, e.Bounds.Bottom); break; case NodeRegionStyle.ePlusMinusToRight: int iL = rectangleLeftGrip.Left - this.PlusMinusRegionWidth; rectangleNodeBounds = Rectangle.FromLTRB(iL < 0 ? rectangleDispaly.Left : iL, e.Bounds.Top, rectangleDispaly.Right, e.Bounds.Bottom); break; case NodeRegionStyle.eGripToRight: rectangleNodeBounds = Rectangle.FromLTRB(rectangleLeftGrip.Left < 0 ? rectangleDispaly.Left : rectangleLeftGrip.Left, e.Bounds.Top, rectangleDispaly.Right, e.Bounds.Bottom); break; case NodeRegionStyle.eTextToRight: rectangleNodeBounds = Rectangle.FromLTRB(e.Node.Bounds.Left, e.Bounds.Top, rectangleDispaly.Right, e.Bounds.Bottom); break; case NodeRegionStyle.eText: rectangleNodeBounds = new Rectangle(e.Node.Bounds.Left, e.Bounds.Top, size.Width, e.Bounds.Height); //e.Node.Bounds; break; default: rectangleNodeBounds = Rectangle.FromLTRB(e.Node.Bounds.Left, e.Bounds.Top, rectangleDispaly.Right, e.Bounds.Bottom); break; } GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderTreeNodeItem ( new TreeNodeItemRenderEventArgs ( e.Graphics, e.Node, this, e.Node.Checked ? CheckState.Checked : CheckState.Unchecked, eBaseItemState, Rectangle.FromLTRB(rectangleLeftGrip.Left - this.PlusMinusRegionWidth, e.Bounds.Top, rectangleLeftGrip.Left, e.Bounds.Bottom), rectangleLeftGrip, Rectangle.FromLTRB(rectangleDispaly.Left, e.Bounds.Top, rectangleImageGrip.Right, e.Bounds.Bottom), rectangleNodeBounds, Rectangle.FromLTRB(rectangleDispaly.Left, e.Bounds.Top, rectangleDispaly.Right, e.Bounds.Bottom) ) ); // if (this.ImageList != null && this.ImageGripRegionWidth > 1) { Image image = null; if (this.SelectedNode == e.Node) { image = this.GetNodeSelectedImage(e.Node); } else { image = this.GetNodeImage(e.Node); } if (image != null) { GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderImage ( new GISShare.Controls.WinForm.ImageRenderEventArgs ( e.Graphics, this, this.Enabled, image, Util.UtilTX.CreateSquareRectangle(Rectangle.FromLTRB(rectangleImageGrip.Left + this.ImageSpace, rectangleImageGrip.Top + this.ImageSpace, rectangleImageGrip.Right - this.ImageSpace - CTR_IMAGEGRIPSEPARATORWIDTH, rectangleImageGrip.Bottom - this.ImageSpace)) ) ); } } // if (this.StateImageList != null && this.LeftGripRegionWidth > 1) { Image image = this.GetNodeStateImage(e.Node); if (image != null) { GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderImage ( new GISShare.Controls.WinForm.ImageRenderEventArgs ( e.Graphics, this, this.Enabled, image, Util.UtilTX.CreateSquareRectangle(Rectangle.FromLTRB(rectangleLeftGrip.Left + this.ImageSpace, rectangleLeftGrip.Top + this.ImageSpace, rectangleLeftGrip.Right - this.ImageSpace, rectangleLeftGrip.Bottom - this.ImageSpace)) ) ); } } // //int iH = (int)e.Graphics.MeasureString(e.Node.Text, e.Node.NodeFont == null ? this.Font : e.Node.NodeFont).Height; GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderText ( new GISShare.Controls.WinForm.TextRenderEventArgs ( e.Graphics, this, this.Enabled, false, e.Node.Text, e.Node.ForeColor.IsEmpty ? this.ForeColor : e.Node.ForeColor, e.Node.NodeFont == null ? this.Font : e.Node.NodeFont, new Rectangle(e.Node.Bounds.Left, (e.Bounds.Top + e.Bounds.Bottom - size.Height) / 2 + 2, size.Width, size.Height) ) ); // return(true); }
private void DrawItem_ListViewItem_D(DrawListViewItemEventArgs e, WFNew.BaseItemState eBaseItemState) { Rectangle rectangleBounds = e.Bounds; if (this.Columns.Count > 0) { rectangleBounds = new Rectangle(rectangleBounds.Left, rectangleBounds.Top, this.Columns[0].Width, rectangleBounds.Height); } // Rectangle rectangleLeftGrip = new Rectangle(rectangleBounds.X + CTR_IMAGEGRIPSEPARATORWIDTH, rectangleBounds.Y, this.LeftGripRegionWidth + CTR_IMAGEGRIPSEPARATORWIDTH, rectangleBounds.Height); Rectangle rectangleImageGrip = new Rectangle(rectangleLeftGrip.Right, rectangleBounds.Y, this.ImageGripRegionWidth + CTR_IMAGEGRIPSEPARATORWIDTH, rectangleBounds.Height); Rectangle rectangleGrip = Rectangle.FromLTRB(rectangleLeftGrip.Left, rectangleBounds.Top, rectangleImageGrip.Right, rectangleBounds.Bottom); // GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderListViewItem ( new ItemRenderEventArgs ( e.Graphics, e.Item, this, e.Item.Checked ? CheckState.Checked : CheckState.Unchecked, eBaseItemState, rectangleLeftGrip, rectangleGrip, this.AutoDrawSubItem ? rectangleBounds : e.Bounds, this.AutoDrawSubItem ? rectangleBounds : e.Bounds ) ); // if (this.SmallImageList != null && this.ImageGripRegionWidth > 1) { Image image = this.GetItemSmallImage(e.Item); if (image != null) { GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderImage ( new GISShare.Controls.WinForm.ImageRenderEventArgs ( e.Graphics, this, this.Enabled, image, Util.UtilTX.CreateSquareRectangle(Rectangle.FromLTRB(rectangleImageGrip.Left + this.ImageSpace, rectangleImageGrip.Top + this.ImageSpace, rectangleImageGrip.Right - this.ImageSpace - CTR_IMAGEGRIPSEPARATORWIDTH, rectangleImageGrip.Bottom - this.ImageSpace)) ) ); } } // if (this.StateImageList != null && this.LeftGripRegionWidth > 1) { Image image = this.GetItemStateImage(e.Item); if (image != null) { GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderImage ( new GISShare.Controls.WinForm.ImageRenderEventArgs ( e.Graphics, this, this.Enabled, image, Util.UtilTX.CreateSquareRectangle(Rectangle.FromLTRB(rectangleLeftGrip.Left + this.ImageSpace, rectangleLeftGrip.Top + this.ImageSpace, rectangleLeftGrip.Right - this.ImageSpace, rectangleLeftGrip.Bottom - this.ImageSpace)) ) ); } } // Size size = e.Graphics.MeasureString(e.Item.Text, e.Item.Font == null ? this.Font : e.Item.Font).ToSize(); size = new Size(size.Width + 1, size.Height + 1); Rectangle rectangleText = new Rectangle(rectangleImageGrip.Right, (rectangleBounds.Top + rectangleBounds.Bottom - size.Height) / 2 + 2, size.Width, size.Height); int iLeft = rectangleText.Left < rectangleBounds.Left ? rectangleBounds.Left : rectangleText.Left; int iTop = rectangleText.Top < rectangleBounds.Top ? rectangleBounds.Top : rectangleText.Top; int iRight = rectangleText.Right > rectangleBounds.Right ? rectangleBounds.Right : rectangleText.Right; int iBottom = rectangleText.Bottom > rectangleBounds.Bottom ? rectangleBounds.Bottom : rectangleText.Bottom; GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderText ( new GISShare.Controls.WinForm.TextRenderEventArgs ( e.Graphics, this, this.Enabled, false, e.Item.Text, e.Item.ForeColor.IsEmpty ? this.ForeColor : e.Item.ForeColor, e.Item.Font == null ? this.Font : e.Item.Font, Rectangle.FromLTRB(iLeft, iTop, iRight, iBottom) ) ); }
private void DrawItem_ListViewItem_L(DrawListViewItemEventArgs e, WFNew.BaseItemState eBaseItemState) { Rectangle rectangleLeftGrip = new Rectangle(e.Bounds.X, e.Bounds.Y, this.LeftGripRegionWidth, e.Bounds.Height); Rectangle rectangleImageGrip = new Rectangle(rectangleLeftGrip.Right, e.Bounds.Y, this.ImageGripRegionWidth + CTR_IMAGEGRIPSEPARATORWIDTH, e.Bounds.Height); Rectangle rectangleGrip = Rectangle.FromLTRB(rectangleLeftGrip.Left, e.Bounds.Top, rectangleImageGrip.Right, e.Bounds.Bottom); // GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderListViewItem ( new ItemRenderEventArgs ( e.Graphics, e.Item, this, e.Item.Checked ? CheckState.Checked : CheckState.Unchecked, eBaseItemState, rectangleLeftGrip, rectangleGrip, e.Bounds, e.Bounds ) ); // if (this.SmallImageList != null && this.ImageGripRegionWidth > 1) { Image image = this.GetItemSmallImage(e.Item); if (image != null) { GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderImage ( new GISShare.Controls.WinForm.ImageRenderEventArgs ( e.Graphics, this, this.Enabled, image, Util.UtilTX.CreateSquareRectangle(Rectangle.FromLTRB(rectangleImageGrip.Left + this.ImageSpace, rectangleImageGrip.Top + this.ImageSpace, rectangleImageGrip.Right - this.ImageSpace - CTR_IMAGEGRIPSEPARATORWIDTH, rectangleImageGrip.Bottom - this.ImageSpace)) ) ); } } // if (this.StateImageList != null && this.LeftGripRegionWidth > 1) { Image image = this.GetItemStateImage(e.Item); if (image != null) { GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderImage ( new GISShare.Controls.WinForm.ImageRenderEventArgs ( e.Graphics, this, this.Enabled, image, Util.UtilTX.CreateSquareRectangle(Rectangle.FromLTRB(rectangleLeftGrip.Left + this.ImageSpace, rectangleLeftGrip.Top + this.ImageSpace, rectangleLeftGrip.Right - this.ImageSpace, rectangleLeftGrip.Bottom - this.ImageSpace)) ) ); } } // Size size = e.Graphics.MeasureString(e.Item.Text, e.Item.Font == null ? this.Font : e.Item.Font).ToSize(); size = new Size(size.Width + 1, size.Height + 1); GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderText ( new GISShare.Controls.WinForm.TextRenderEventArgs ( e.Graphics, this, this.Enabled, false, e.Item.Text, e.Item.ForeColor.IsEmpty ? this.ForeColor : e.Item.ForeColor, e.Item.Font == null ? this.Font : e.Item.Font, new Rectangle(rectangleImageGrip.Right, (e.Bounds.Top + e.Bounds.Bottom - size.Height) / 2 + 2, size.Width, size.Height) ) ); }
void HostDataGridView_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) { Point point = this.PointToClient(Form.MousePosition); // WFNew.BaseItemState eBaseItemState = (this.AutoMouseMoveSeleced && e.CellBounds.Contains(point)) ? GISShare.Controls.WinForm.WFNew.BaseItemState.eHot : GISShare.Controls.WinForm.WFNew.BaseItemState.eNormal; // Rectangle rectangle = Rectangle.FromLTRB(e.CellBounds.Left + 1, e.CellBounds.Top + 1, e.CellBounds.Right - 1, e.CellBounds.Bottom - 1); Rectangle rectangle2 = Rectangle.FromLTRB(rectangle.Left + 1, rectangle.Top + 1, rectangle.Right - 1, rectangle.Bottom - 1); Rectangle rectangle3 = Rectangle.FromLTRB(rectangle2.Left + 1, rectangle2.Top + 1, rectangle2.Right - 1, rectangle2.Bottom - 1); if (e.ColumnIndex == -1 && e.RowIndex == -1) { GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderDataGridViewCellItem ( new ItemRenderEventArgs ( e.Graphics, e, this, CheckState.Unchecked, eBaseItemState, rectangle3, rectangle2, rectangle, e.CellBounds ) ); } else if (e.RowIndex == -1) { GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderDataGridViewCellItem ( new ItemRenderEventArgs ( e.Graphics, e, this, this.ContainsColumnIndex(e.ColumnIndex) ? CheckState.Checked : CheckState.Unchecked, eBaseItemState, rectangle3, rectangle2, rectangle, e.CellBounds ) ); } else if (e.ColumnIndex == -1) { GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderDataGridViewCellItem ( new ItemRenderEventArgs ( e.Graphics, e, this, (this.CurrentRow != null && e.RowIndex == this.CurrentRow.Index) ? CheckState.Checked : CheckState.Unchecked, eBaseItemState, rectangle3, rectangle2, rectangle, e.CellBounds ) ); } else { GISShare.Controls.WinForm.WinFormRenderer.WinFormRendererStrategy.OnRenderDataGridViewCellItem ( new ItemRenderEventArgs ( e.Graphics, e, this, (e.State == (DataGridViewElementStates.Displayed | DataGridViewElementStates.Selected | DataGridViewElementStates.Visible)) ? CheckState.Checked : CheckState.Unchecked, eBaseItemState, rectangle3, rectangle2, rectangle, e.CellBounds ) ); } }