コード例 #1
0
 internal ListBoxStateMachineItemEventArgs(ListBoxStateMachineItem listBoxItemStateMachine)
 {
     this.item = listBoxItemStateMachine;
 }
コード例 #2
0
        /// <summary>
        /// Called from the <strong>OnItemStateChanged</strong> event handler to
        /// raise the <strong><see cref="ItemStateChanged"/></strong> event for clients of this 
        /// <strong><see cref="ListBoxStateMachine"/></strong> object.
        /// </summary>
        /// <param name="item">The item that changed state.</param>
        protected virtual void OnItemStateChanged(ListBoxStateMachineItem item)
        {
            GotItemStateChanged = true;
            EventHandler<ListBoxStateMachineItemEventArgs> temp = ItemStateChanged;

            if (temp != null)
            {
                temp(this, new ListBoxStateMachineItemEventArgs(item));
            }
        }
コード例 #3
0
ファイル: ListBox.cs プロジェクト: AnthonyB28/Marist_Map
        /// <summary>
        /// Calculate the source and destination Rectangles to be used for drawing a list box item.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="source">The source Rectangle.</param>
        /// <param name="destination">The destination Rectangle</param>
        /// <param name="clipLeft">Number of pixels to clip on left.</param>
        /// <param name="clipRight">Number of pixels to clip on right.</param>
        private void GetDrawingRectangles(ListBoxStateMachineItem item,
                                          out Rectangle source, out Rectangle destination,
                                          out int clipLeft, out int clipRight)
        {
            int x = Convert.ToInt32(Left + item.HorizontalStartPosition * item.Parent.NumberOfPixelsInHorizontalAxis);
            int y = Convert.ToInt32(Top);

            int width = itemDefault.Width;
            int height = itemDefault.Height;

            // Determine if the item should be clipped on the right.
            clipRight = 0;
            if (x + itemDefault.Width > Right)
            {
                clipRight = x + itemDefault.Width - Convert.ToInt32(Right);
                width -= clipRight;
            }

            // Determine if the item should be clipped on the left.
            int left = Convert.ToInt32(Left);
            clipLeft = 0;
            if (x < left)
            {
                clipLeft = left - x;
                width -= clipLeft;
                x = left;
            }

            source = new Rectangle(clipLeft, 0, width, height);
            destination = new Rectangle(x, y, width, height);
        }