/// <summary> /// paint header background /// </summary> /// <param name="pcust"></param> /// <param name="rect"></param> internal virtual void PaintBackGround(NativeCustomDraw.NMCUSTOMDRAW pcust, NativeWindowCommon.RECT rect) { if (TitleBrush != IntPtr.Zero) { NativeWindowCommon.FillRect(pcust.hdc, ref rect, TitleBrush); } }
internal override void PaintItemBackGround(NativeCustomDraw.NMCUSTOMDRAW pcust, NativeWindowCommon.RECT rect) { if (header.TitleColor != Color.Empty) { PaintDividers(pcust, ref rect, 0); if (header.ShowBottomBorder) { PaintBottomBorderOnColoredHeader(pcust, ref rect); } if (rect.left < rect.right) { base.PaintBackGround(pcust, rect); } } else if (header.DividerColor != Color.Empty) { PaintDividers(pcust, ref rect, 0); if (header.ShowBottomBorder) { PaintBottomBorderOnSystemHeader(pcust, ref rect, 1); } } }
internal virtual void PaintItemBackGround(NativeCustomDraw.NMCUSTOMDRAW pcust, NativeWindowCommon.RECT rect) { if (rect.left < rect.right) { PaintBackGround(pcust, rect); } PaintDividers(pcust, ref rect, 0); }
/// <summary> /// paint background of header /// </summary> /// <param name="pcust"></param> /// <param name="rect"></param> internal override void PaintBackGround(NativeCustomDraw.NMCUSTOMDRAW pcust, NativeWindowCommon.RECT rect) { // Fill bg color base.PaintBackGround(pcust, rect); // draw bottom line rect.bottom--; DrawLine(pcust.hdc, new Point(rect.left, rect.bottom), new Point(rect.right, rect.bottom)); }
private void PaintBottomBorderOnSystemHeader(NativeCustomDraw.NMCUSTOMDRAW pcust, ref NativeWindowCommon.RECT rect, int diff) { if (rect.bottom == header.Height) { rect.bottom--; if ((header.TableLineDivider) || (!header.TableLineDivider && (header.DividerColor != Color.Empty))) { DrawLine(pcust.hdc, new Point(rect.left, rect.bottom), new Point(rect.right + diff, rect.bottom), HeaderDividerPen); } } }
private void PaintBottomBorderOnColoredHeader(NativeCustomDraw.NMCUSTOMDRAW pcust, ref NativeWindowCommon.RECT rect) { if (rect.bottom == header.Height) { rect.bottom--; IntPtr pen = header.DividerColor != Color.Empty ? HeaderDividerPen : HeaderItemBorderPen; DrawLine(pcust.hdc, new Point(rect.left, rect.bottom), new Point(rect.right, rect.bottom), pen); } }
protected void PaintDividers(NativeCustomDraw.NMCUSTOMDRAW pcust, ref NativeWindowCommon.RECT rect, int difference) { // paint divider for last header only when "Show Last Divider " of table control is true if (header.ShowDividers) { // Check if last divider is to be painted . // For last section , last divider should be painted when 'ShowLastDivider' property is set to true bool showlastDivider = (pcust.dwItemSpec.ToInt32() == header.Sections.Count - 1 ? header.ShowLastDivider : true); if (showlastDivider) { DrawDivider(pcust.hdc, pcust.dwItemSpec.ToInt32(), ref rect, header.DividerHeight); } } }
internal override void PaintBackGround(NativeCustomDraw.NMCUSTOMDRAW pcust, NativeWindowCommon.RECT rect) { base.PaintBackGround(pcust, rect); // draw top lines //SetRect(&TitleRect, Rect.left, Rect.top, Rect.right, Rect.top); //Gui->ctx->gui_.dc_->line_to(&TitleRect, TitleTopLeftColor, factor, 0L); DrawLine(pcust.hdc, new Point(rect.left, rect.top), new Point(rect.right, rect.top), WhitePen); // dark //SetRect(&TitleRect, Rect.left + factor, Rect.top + factor, Rect.right - factor, Rect.top + factor); //Gui->ctx->gui_.dc_->line_to(&TitleRect, FIX_SYS_COLOR_3DLIGHT, factor, 0L); DrawLine(pcust.hdc, new Point(rect.left + TableControl.Factor, rect.top + 1), new Point(rect.right, rect.top + TableControl.Factor), lightPen); // dark // draw bottom lines //SetRect(&TitleRect, Rect.left, Rect.top + Ctrl->TitleHeight - 2 * factor, Rect.right, Rect.top + Ctrl->TitleHeight - 2 * factor); //Gui->ctx->gui_.dc_->line_to(&TitleRect, TitleBottomBorder, factor, 0L); rect.bottom--; DrawLine(pcust.hdc, new Point(rect.left, rect.bottom), new Point(rect.right, rect.bottom)); // dark //SetRect(&TitleRect, Rect.left + factor, Rect.top + Ctrl->TitleHeight - 3 * factor, Rect.right - factor, Rect.top + Ctrl->TitleHeight - 3 * factor); //Gui->ctx->gui_.dc_->line_to(&TitleRect, FIX_SYS_COLOR_BTNSHADOW, factor, 0L); rect.bottom--; DrawLine(pcust.hdc, new Point(rect.left, rect.bottom), new Point(rect.right, rect.bottom), darkpen); // draw left lines if (!tableControl.RightToLeftLayout && rect.left == 0) // draw only for 1st section { // SetRect(&TitleRect, Rect.left, Rect.top, Rect.right, Rect.top); // Gui->ctx->gui_.dc_->line_to(&TitleRect, TitleTopLeftColor, factor, 0L); DrawLine(pcust.hdc, new Point(0, rect.top), new Point(0, rect.bottom), WhitePen); //SetRect(&TitleRect, Rect.left + factor, Rect.top + factor, Rect.left + factor, Rect.top + Ctrl->TitleHeight - 3 * factor); //Gui->ctx->gui_.dc_->line_to(&TitleRect, FIX_SYS_COLOR_3DLIGHT, factor, 0L); DrawLine(pcust.hdc, new Point(1, rect.top + 1), new Point(1, rect.bottom), lightPen); } else if (tableControl.RightToLeftLayout && rect.right == (tableControl.Bounds.Right - 2 * tableControl.BorderHeight)) { DrawLine(pcust.hdc, new Point(rect.right - 1, rect.top), new Point(rect.right - 1, rect.bottom), WhitePen); //SetRect(&TitleRect, Rect.left + factor, Rect.top + factor, Rect.left + factor, Rect.top + Ctrl->TitleHeight - 3 * factor); //Gui->ctx->gui_.dc_->line_to(&TitleRect, FIX_SYS_COLOR_3DLIGHT, factor, 0L); DrawLine(pcust.hdc, new Point(rect.right - 2, rect.top + 1), new Point(rect.right - 2, rect.bottom), lightPen); } }
internal override void PaintBackGround(NativeCustomDraw.NMCUSTOMDRAW pcust, NativeWindowCommon.RECT rect) { base.PaintBackGround(pcust, rect); // top line //SetRect(&TitleRect, Rect.left, Rect.top, Rect.right, Rect.top); //Gui->ctx->gui_.dc_->line_to(&TitleRect, TitleTopLeftColor, factor, 0L); DrawLine(pcust.hdc, new Point(rect.left, rect.top), new Point(rect.right, rect.top), WhitePen); // dark // bottom lines //SetRect(&Rect1, Rect.left, Row, Rect.right, Row); //Gui->ctx->gui_.dc_->line_to(&Rect1, FIX_SYS_COLOR_BTNTEXT, factor, 0L); rect.bottom--; DrawLine(pcust.hdc, new Point(rect.left, rect.bottom), new Point(rect.right, rect.bottom), darkpen); //Rect1.bottom -= factor; //Gui->ctx->gui_.dc_->line_to(&Rect1, FIX_SYS_COLOR_BTNSHADOW, factor, 0L); rect.bottom--; DrawLine(pcust.hdc, new Point(rect.left, rect.bottom), new Point(rect.right, rect.bottom), ButtonShadowPen); // draw left for first header section when we are not dragging if (!isSectionDragging) { if (rect.left == 0) { DrawLine(pcust.hdc, new Point(rect.left, rect.top), new Point(rect.left, rect.bottom), tableControl.RightToLeftLayout ? ButtonShadowPen : WhitePen); } // draw right borders for last header section if (rect.right == (tableControl.Bounds.Right - 2 * tableControl.BorderHeight)) { DrawLine(pcust.hdc, new Point(rect.right - 1, rect.top), new Point(rect.right - 1, rect.bottom), tableControl.RightToLeftLayout ? WhitePen : ButtonShadowPen); } } }