void NavBarControl_CustomDrawGroupCaption(object sender, DevExpress.XtraNavBar.ViewInfo.CustomDrawNavBarElementEventArgs e) { if (!IsCustomDrawNeeded()) { return; } try { isLocked = true; BaseNavGroupPainter painter = NavBarControl.View.CreateGroupPainter(NavBarControl); NavGroupInfoArgs info = e.ObjectInfo as NavGroupInfoArgs; Rectangle originalCaptionBounds = new Rectangle(info.CaptionClientBounds.X, info.CaptionClientBounds.Y, info.CaptionClientBounds.Width - info.ButtonBounds.Width, info.CaptionClientBounds.Height); Rectangle fixedCaptionBounds = GetCaptionBounds(originalCaptionBounds); Rectangle checkBoxBounds = GetCheckBoxBounds(fixedCaptionBounds); info.CaptionBounds = fixedCaptionBounds; painter.DrawObject(info); info.CaptionBounds = originalCaptionBounds; DrawCheckBox(e.Graphics, checkBoxBounds, IsGroupEnabled(info.Group)); e.Handled = true; } finally { isLocked = false; } }
private void navBarGroup3_CalcGroupClientHeight(object sender, DevExpress.XtraNavBar.NavBarCalcGroupClientHeightEventArgs e) { NavBarViewInfo vi = GetViewInfo(navBarControl1); NavGroupInfoArgs gi = vi.Groups[vi.Groups.Count - 1] as NavGroupInfoArgs; ExplorerBarNavGroupPainter groupPainter = GetGroupPainter(navBarControl1); Size buttonSize; int footerHeight = groupPainter.CalcFooterHeight(gi, out buttonSize); int delta = gi.Bounds.Top - vi.Client.Top; int ch = vi.Client.Height - delta - gi.Bounds.Height - footerHeight; e.Height = ch; }
protected override int CalcGroupsViewInfo(Rectangle bounds) { Groups.Clear(); NavBarGroup expandedGroup = GetExpandedGroup(); int bottom = bounds.Top; int minOverflowHeight = CalcOverflowAndSplitterHeight(); if (bounds.Height + 20 > minOverflowHeight) { bounds.Height -= 10; } else { minOverflowHeight = 0; } NavGroupInfoArgs expandedInfo = null; if (expandedGroup != null) { bottom = CalcExpandedGroupInfo(bounds, expandedGroup); expandedInfo = GetGroupInfo(expandedGroup); CalcButtonPositions(expandedInfo, false); } bounds.Height += minOverflowHeight; if (bottom == 0 || bottom > bounds.Bottom) { CalcButtonPositions(expandedInfo, true); return(0); } Rectangle groupBounds = new Rectangle(bounds.X, bottom, bounds.Width, bounds.Bottom - bottom); bottom = CalcSplitterInfo(new Rectangle(groupBounds.X, groupBounds.Y, groupBounds.Width, groupBounds.Height)); if (bottom == 0) { return(0); } groupBounds = new Rectangle(bounds.X, bottom, bounds.Width, bounds.Bottom - bottom); CalcNavGroupsViewInfo(bounds, groupBounds, expandedGroup); CreateOverflowGroupsList(); if (expandedGroup != null) { int deltaIndex = CalcDeltaLinksTopVisibleIndex(expandedInfo); expandedGroup.TopVisibleLinkIndex -= deltaIndex; } CalcButtonPositions(expandedInfo, true); UpdateGroupPaintIndexes(); return(0); }
bool IsCheckBox(Point p) { NavBarHitInfo hi = NavBarControl.CalcHitInfo(p); if (hi.Group == null) { return(false); } ; NavBarViewInfo vi = GetNavBarView(NavBarControl); vi.Calc(NavBarControl.ClientRectangle); NavGroupInfoArgs groupInfo = vi.GetGroupInfo(hi.Group); Rectangle originalCaptionBounds = new Rectangle(groupInfo.CaptionClientBounds.X, groupInfo.CaptionClientBounds.Y, groupInfo.CaptionClientBounds.Width - groupInfo.ButtonBounds.Width, groupInfo.CaptionClientBounds.Height); Rectangle checkBounds = GetCheckBoxBounds(GetCaptionBounds(originalCaptionBounds)); hotGroup = hi.Group; hotRectangle = checkBounds; return(checkBounds.Contains(p)); }