/*
		 * BuildItemPaintParams
		 */

		/// <summary>
		/// </summary>
		/// <param name="itemParams"></param>
		/// <returns></returns>
		/// <exception cref="ArgumentNullException">
		/// <para>
		///		<paramref name="itemParams"/> is <see langword="null"/>.
		/// </para>
		/// </exception>
		public static NuGenItemPaintParams BuildItemPaintParams(NuGenItemParams itemParams)
		{
			if (itemParams == null)
			{
				throw new ArgumentNullException("itemParams");
			}

			NuGenControlState currentState = NuGenControlState.Normal;

			if ((itemParams.State & DrawItemState.Selected) > 0)
			{
				currentState = NuGenControlState.Hot;
			}

			NuGenItemPaintParams itemPaintParams = new NuGenItemPaintParams(
				itemParams.Sender,
				itemParams.Graphics,
				itemParams.Bounds,
				currentState
			);

			itemPaintParams.ContentAlign = itemParams.RightToLeft == RightToLeft.No
				? ContentAlignment.MiddleLeft
				: ContentAlignment.MiddleRight
				;
			itemPaintParams.Font = itemParams.Font;
			itemPaintParams.ForeColor = itemParams.ForeColor;
			itemPaintParams.Image = itemParams.Image;
			itemPaintParams.Text = itemParams.Text;

			return itemPaintParams;
		}
Esempio n. 2
0
        /*
         * BuildItemPaintParams
         */

        /// <summary>
        /// </summary>
        /// <param name="itemParams"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">
        /// <para>
        ///		<paramref name="itemParams"/> is <see langword="null"/>.
        /// </para>
        /// </exception>
        public static NuGenItemPaintParams BuildItemPaintParams(NuGenItemParams itemParams)
        {
            if (itemParams == null)
            {
                throw new ArgumentNullException("itemParams");
            }

            NuGenControlState currentState = NuGenControlState.Normal;

            if ((itemParams.State & DrawItemState.Selected) > 0)
            {
                currentState = NuGenControlState.Hot;
            }

            NuGenItemPaintParams itemPaintParams = new NuGenItemPaintParams(
                itemParams.Sender,
                itemParams.Graphics,
                itemParams.Bounds,
                currentState
                );

            itemPaintParams.ContentAlign = itemParams.RightToLeft == RightToLeft.No
                                ? ContentAlignment.MiddleLeft
                                : ContentAlignment.MiddleRight
            ;
            itemPaintParams.Font      = itemParams.Font;
            itemPaintParams.ForeColor = itemParams.ForeColor;
            itemPaintParams.Image     = itemParams.Image;
            itemPaintParams.Text      = itemParams.Text;

            return(itemPaintParams);
        }
Esempio n. 3
0
        /*
         * OnDrawItem
         */

        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.ListBox.DrawItem"></see> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.DrawItemEventArgs"></see> that contains the event data.</param>
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            if (e.Index < 0 || this.Items.Count < 1)
            {
                return;
            }

            NuGenItemParams itemParams = new NuGenItemParams(this, e.Graphics, e.Bounds, e.State);

            itemParams.Font      = this.Font;
            itemParams.ForeColor = e.ForeColor;

            if (this.ImageList != null)
            {
                itemParams.Image = this.ImageListService.FindImageAtIndex(this.ImageList, e.Index);
            }

            itemParams.Text = this.GetItemText(this.Items[e.Index]);

            this.Renderer.DrawItem(NuGenItemService.BuildItemPaintParams(itemParams));
        }
		/*
		 * BuildItemPaintParams
		 */

		/// <summary>
		/// </summary>
		/// <param name="itemParams"></param>
		/// <returns></returns>
		/// <exception cref="ArgumentNullException">
		/// <para>
		///		<paramref name="itemParams"/> is <see langword="null"/>.
		/// </para>
		/// </exception>
		internal static NuGenItemPaintParams BuildItemPaintParams(NuGenItemParams itemParams)
		{
			if (itemParams == null)
			{
				throw new ArgumentNullException("itemParams");
			}

			NuGenItemPaintParams itemPaintParams = new NuGenItemPaintParams(itemParams.Graphics);
			itemPaintParams.BackgroundColor = itemParams.BackgroundColor;
			itemPaintParams.Bounds = itemParams.Bounds;
			itemPaintParams.ContentAlign = itemParams.RightToLeft == RightToLeft.No
				? ContentAlignment.MiddleLeft
				: ContentAlignment.MiddleRight
				;
			itemPaintParams.Font = itemParams.Font;
			itemPaintParams.ForeColor = itemParams.ForeColor;
			itemPaintParams.Image = itemParams.Image;
			itemPaintParams.Text = itemParams.Text;
			itemPaintParams.State = NuGenDrawItemStateTranslator.ToControlState(itemParams.State);

			return itemPaintParams;
		}
Esempio n. 5
0
        /*
         * BuildItemPaintParams
         */

        /// <summary>
        /// </summary>
        /// <param name="itemParams"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">
        /// <para>
        ///		<paramref name="itemParams"/> is <see langword="null"/>.
        /// </para>
        /// </exception>
        internal static NuGenItemPaintParams BuildItemPaintParams(NuGenItemParams itemParams)
        {
            if (itemParams == null)
            {
                throw new ArgumentNullException("itemParams");
            }

            NuGenItemPaintParams itemPaintParams = new NuGenItemPaintParams(itemParams.Graphics);

            itemPaintParams.BackgroundColor = itemParams.BackgroundColor;
            itemPaintParams.Bounds          = itemParams.Bounds;
            itemPaintParams.ContentAlign    = itemParams.RightToLeft == RightToLeft.No
                                ? ContentAlignment.MiddleLeft
                                : ContentAlignment.MiddleRight
            ;
            itemPaintParams.Font      = itemParams.Font;
            itemPaintParams.ForeColor = itemParams.ForeColor;
            itemPaintParams.Image     = itemParams.Image;
            itemPaintParams.Text      = itemParams.Text;
            itemPaintParams.State     = NuGenDrawItemStateTranslator.ToControlState(itemParams.State);

            return(itemPaintParams);
        }
Esempio n. 6
0
		/*
		 * OnDrawItem
		 */

		/// <summary>
		/// Raises the <see cref="E:System.Windows.Forms.ListBox.DrawItem"></see> event.
		/// </summary>
		/// <param name="e">A <see cref="T:System.Windows.Forms.DrawItemEventArgs"></see> that contains the event data.</param>
		protected override void OnDrawItem(DrawItemEventArgs e)
		{
			if (e.Index < 0 || this.Items.Count < 1)
			{
				return;
			}

			NuGenItemParams itemParams = new NuGenItemParams(e.Graphics);

			itemParams.BackgroundColor = e.BackColor;
			itemParams.Bounds = e.Bounds;
			itemParams.Font = this.Font;
			itemParams.ForeColor = e.ForeColor;
			itemParams.State = e.State;

			if (this.ImageList != null)
			{
				itemParams.Image = this.ImageListService.FindImageAtIndex(this.ImageList, e.Index);
			}

			itemParams.Text = this.GetItemText(this.Items[e.Index]);
			this.Renderer.DrawItem(NuGenItemService.BuildItemPaintParams(itemParams));
		}