예제 #1
0
        private void InitExpandNode(ExpandNodeState expandState)
        {
            if (expandNodeImages != null && expandNodeImages.ContainsKey(expandState))
            {
                return;
            }
            if (expandNodeImages == null)
            {
                expandNodeImages = new Dictionary <ExpandNodeState, Bitmap>();
            }

            Bitmap image = null;

            switch (expandState)
            {
            case ExpandNodeState.OpenedDisabled:    image = ResourcesCache.ExpandNodeOpenedDisabled;        break;

            case ExpandNodeState.OpenedNormal:              image = ResourcesCache.ExpandNodeOpenedNormal;  break;

            case ExpandNodeState.OpenedHot:                 image = ResourcesCache.ExpandNodeOpenedHot;             break;

            case ExpandNodeState.OpenedPressed:             image = ResourcesCache.ExpandNodeOpenedPressed; break;

            case ExpandNodeState.ClosedDisabled:    image = ResourcesCache.ExpandNodeClosedDisabled;        break;

            case ExpandNodeState.ClosedNormal:              image = ResourcesCache.ExpandNodeClosedNormal;  break;

            case ExpandNodeState.ClosedHot:                 image = ResourcesCache.ExpandNodeClosedHot;             break;

            case ExpandNodeState.ClosedPressed:             image = ResourcesCache.ExpandNodeClosedPressed; break;
            }
            expandNodeImages[expandState] = image;
        }
		private void InitExpandNode(ExpandNodeState expandState)
		{
			if (expandNodeImages != null && expandNodeImages.ContainsKey(expandState)) return;
			if (expandNodeImages == null) expandNodeImages = new Dictionary<ExpandNodeState,Bitmap>();

			Bitmap image = null;
			switch (expandState)
			{
				case ExpandNodeState.OpenedDisabled:	image = Resources.ExpandNodeOpenedDisabled;	break;
				case ExpandNodeState.OpenedNormal:		image = Resources.ExpandNodeOpenedNormal;	break;
				case ExpandNodeState.OpenedHot:			image = Resources.ExpandNodeOpenedHot;		break;
				case ExpandNodeState.OpenedPressed:		image = Resources.ExpandNodeOpenedPressed;	break;
				case ExpandNodeState.ClosedDisabled:	image = Resources.ExpandNodeClosedDisabled;	break;
				case ExpandNodeState.ClosedNormal:		image = Resources.ExpandNodeClosedNormal;	break;
				case ExpandNodeState.ClosedHot:			image = Resources.ExpandNodeClosedHot;		break;
				case ExpandNodeState.ClosedPressed:		image = Resources.ExpandNodeClosedPressed;	break;
			}
			expandNodeImages[expandState] = image;
		}
		public void DrawExpandNode(Graphics g, Point loc, ExpandNodeState state)
		{
			InitExpandNode(state);
			g.DrawImageUnscaled(expandNodeImages[state], loc);
		}
예제 #4
0
        protected void PaintIndentExpandButton(Graphics g, GroupedPropertyEditor childGroup)
        {
            if (childGroup.headerHeight == 0)
            {
                return;
            }
            if ((childGroup.Hints & HintFlags.HasExpandCheck) == HintFlags.None)
            {
                return;
            }

            Rectangle indentExpandRect = new Rectangle(childGroup.Location.X - this.indent, childGroup.Location.Y, this.indent, childGroup.headerHeight);
            Rectangle expandButtonRect = new Rectangle(
                indentExpandRect.X + indentExpandRect.Width / 2 - ControlRenderer.ExpandNodeSize.Width / 2,
                indentExpandRect.Y + indentExpandRect.Height / 2 - ControlRenderer.ExpandNodeSize.Height / 2 - 1,
                ControlRenderer.ExpandNodeSize.Width,
                ControlRenderer.ExpandNodeSize.Height);
            ExpandNodeState expandState = ExpandNodeState.OpenedDisabled;

            if (childGroup.Enabled && childGroup.CanExpand && (childGroup.Hints & HintFlags.ExpandEnabled) != HintFlags.None)
            {
                if (!childGroup.Expanded)
                {
                    if (childGroup.expandCheckPressed)
                    {
                        expandState = ExpandNodeState.ClosedPressed;
                    }
                    else if (childGroup.expandCheckHovered)
                    {
                        expandState = ExpandNodeState.ClosedHot;
                    }
                    else if (childGroup.Focused)
                    {
                        expandState = ExpandNodeState.ClosedHot;
                    }
                    else
                    {
                        expandState = ExpandNodeState.ClosedNormal;
                    }
                }
                else
                {
                    if (childGroup.expandCheckPressed)
                    {
                        expandState = ExpandNodeState.OpenedPressed;
                    }
                    else if (childGroup.expandCheckHovered)
                    {
                        expandState = ExpandNodeState.OpenedHot;
                    }
                    else if (childGroup.Focused)
                    {
                        expandState = ExpandNodeState.OpenedHot;
                    }
                    else
                    {
                        expandState = ExpandNodeState.OpenedNormal;
                    }
                }
            }
            else
            {
                if (childGroup.Expanded)
                {
                    expandState = ExpandNodeState.OpenedDisabled;
                }
                else
                {
                    expandState = ExpandNodeState.ClosedDisabled;
                }
            }

            ControlRenderer.DrawExpandNode(g, expandButtonRect.Location, expandState);
        }
예제 #5
0
 public void DrawExpandNode(Graphics g, Point loc, ExpandNodeState state)
 {
     InitExpandNode(state);
     g.DrawImageUnscaled(expandNodeImages[state], loc);
 }