⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datagridviewradiobuttoncelllayout.cs

📁 vs.net2005 中DataGridView中加入RadioButton的源码,把多个RadioButton加入DataGridView的每一行中.
💻 CS
字号:
using System;
using System.Drawing;

namespace DataGridViewRadioButtonElements
{
    /// <summary>
    /// Internal class that represents the layout of a DataGridViewRadioButtonCell cell.
    /// It tracks the first displayed item index, the number of displayed items, 
    /// scrolling information and various location/size information.
    /// </summary>
    internal class DataGridViewRadioButtonCellLayout
    {
        private int firstDisplayedItemIndex;
        private int displayedItemsCount;
        private int totallyDisplayedItemsCount;
        private bool scrollingNeeded;
        private Point upButtonLocation;
        private Point downButtonLocation;
        private Size scrollButtonsSize;
        private Point firstDisplayedItemLocation;
        private Size radioButtonsSize;
        private Rectangle contentBounds;

        public DataGridViewRadioButtonCellLayout()
        {
        }

        /// <summary>
        /// Boundaries of the cell content defined as the radio buttons of the displayed items.
        /// </summary>
        public Rectangle ContentBounds
        {
            get
            {
                return this.contentBounds;
            }
            set
            {
                this.contentBounds = value;
            }
        }

        /// <summary>
        /// Index of the first displayed item.
        /// </summary>
        public int FirstDisplayedItemIndex
        {
            get
            {
                return this.firstDisplayedItemIndex;
            }
            set
            {
                this.firstDisplayedItemIndex = value;
            }
        }

        /// <summary>
        /// Number of displayed items (includes potential partially displayed one).
        /// </summary>
        public int DisplayedItemsCount
        {
            get
            {
                return this.displayedItemsCount;
            }
            set
            {
                this.displayedItemsCount = value;
            }
        }

        /// <summary>
        /// Number of totally displayed items.
        /// </summary>
        public int TotallyDisplayedItemsCount
        {
            get
            {
                return this.totallyDisplayedItemsCount;
            }
            set
            {
                this.totallyDisplayedItemsCount = value;
            }
        }

        /// <summary>
        /// Indicates whether the scroll buttons need to be shown or not.
        /// </summary>
        public bool ScrollingNeeded
        {
            get
            {
                return this.scrollingNeeded;
            }
            set
            {
                this.scrollingNeeded = value;
            }
        }

        /// <summary>
        /// Location of the Down scroll button.
        /// </summary>
        public Point DownButtonLocation
        {
            get
            {
                return this.downButtonLocation;
            }
            set
            {
                this.downButtonLocation = value;
            }
        }

        /// <summary>
        /// Location of the Up scroll button.
        /// </summary>
        public Point UpButtonLocation
        {
            get
            {
                return this.upButtonLocation;
            }
            set
            {
                this.upButtonLocation = value;
            }
        }

        /// <summary>
        /// Location of the top most displayed item.
        /// </summary>
        public Point FirstDisplayedItemLocation
        {
            get
            {
                return this.firstDisplayedItemLocation;
            }
            set
            {
                this.firstDisplayedItemLocation = value;
            }
        }

        /// <summary>
        /// Size of the scroll buttons.
        /// </summary>
        public Size ScrollButtonsSize
        {
            get
            {
                return this.scrollButtonsSize;
            }
            set
            {
                this.scrollButtonsSize = value;
            }
        }

        /// <summary>
        /// Size of the radio button glyphs.
        /// </summary>
        public Size RadioButtonsSize
        {
            get
            {
                return this.radioButtonsSize;
            }
            set
            {
                this.radioButtonsSize = value;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -