Наследование: System.ComponentModel.Component
Пример #1
0
        /// <summary>
        /// Initializes a new instance of the HeaderContextMenu class with 
        /// no menu items specified
        /// </summary>
        public HeaderContextMenu()
            : base()
        {
            this.model = null;
            this.enabled = true;

            this.moreMenuItem = new MenuItem("More...", new EventHandler(moreMenuItem_Click));
            this.separator = new MenuItem("-");
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the ColumnModel.ColumnCollection class 
        /// that belongs to the specified ColumnModel
        /// </summary>
        /// <param name="owner">A ColumnModel representing the columnModel that owns 
        /// the Column collection</param>
        public ColumnCollection(ColumnModel owner)
            : base()
        {
            if (owner == null)
            {
                throw new ArgumentNullException("owner");
            }

            this.owner = owner;
            this.totalColumnWidth = 0;
            this.visibleColumnsWidth = 0;
            this.visibleColumnCount = 0;
            this.lastVisibleColumn = -1;
        }
Пример #3
0
        protected virtual ColumnModel ColumnInitialize()
        {
            TextColumn col1 = new TextColumn(Translator.Instance.T("版本"));

            ImageColumn col2 = new ImageColumn(Translator.Instance.T("类别"));
            col2.DrawText = true;

            TextColumn col3 = new TextColumn(Translator.Instance.T("内容"));

            ColumnModel r = new ColumnModel(new Column[] { col1, col2, col3 });
            foreach (Column col in r.Columns)
            {
                col.Resizable = true;
                col.Editable = false;
            }
            return r;
        }
Пример #4
0
        /// <summary>
        /// Initialise default values
        /// </summary>
        private void Init()
        {
            this.text         = null;
            this.width        = Column.DefaultWidth;
            this.columnState  = ColumnState.Normal;
            this.alignment    = ColumnAlignment.Left;
            this.image        = null;
            this.imageOnRight = false;
            this.columnModel  = null;
            this.x            = 0;
            this.tooltipText  = null;
            this.format       = "";
            this.sortOrder    = SortOrder.None;
            this.renderer     = null;
            this.editor       = null;
            this.comparer     = null;

            // Mateusz [PEYN] Adamus ([email protected])
            // Added STATE_RESIZABLE to column's initialization
            this.state = (byte)(STATE_ENABLED | STATE_EDITABLE | STATE_VISIBLE | STATE_SELECTABLE | STATE_SORTABLE | STATE_RESIZABLE);
        }
Пример #5
0
        /// <summary>
        /// Initialise default values
        /// </summary>
        private void Init()
        {
            this.text = null;
            this.width = Column.DefaultWidth;
            this.columnState = ColumnState.Normal;
            this.alignment = ColumnAlignment.Left;
            this.image = null;
            this.imageOnRight = false;
            this.columnModel = null;
            this.x = 0;
            this.tooltipText = null;
            this.format = "";
            this.sortOrder = SortOrder.None;
            this.renderer = null;
            this.editor = null;
            this.comparer = null;

            // Mateusz [PEYN] Adamus ([email protected])
            // Added STATE_RESIZABLE to column's initialization
            this.state = (byte) (STATE_ENABLED | STATE_EDITABLE | STATE_VISIBLE | STATE_SELECTABLE | STATE_SORTABLE | STATE_RESIZABLE );
        }
Пример #6
0
        /// <summary>
        /// Creates a ColumnModel for the columns the data source provides and assigns it to the Table.
        /// </summary>
        private void CalculateColumns()
        {
            ColumnModel columns = new ColumnModel();

            if (dataManager == null)
                return;

            int index = 0;
            foreach (PropertyDescriptor prop in dataManager.GetItemProperties())
            {
                Column column = this.DataSourceColumnBinder.GetColumn(prop, index);
                columns.Columns.Add(column);
                index++;
            }

            this.ColumnModel = columns;
        }
Пример #7
0
        /// <summary>
        /// Initializes a new instance of the Table class with default settings
        /// </summary>
        public Table()
        {
            // starting setup
            this.init = true;

            // This call is required by the Windows.Forms Form Designer.
            components = new System.ComponentModel.Container();

            //
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.DoubleBuffer, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(ControlStyles.Selectable, true);
            this.TabStop = true;

            this.Size = new Size(150, 150);

            this.BackColor = Color.White;

            //
            this.columnModel = null;
            this.tableModel = null;

            // header
            this.headerStyle = ColumnHeaderStyle.Clickable;
            this.headerFont = this.Font;
            this.headerRenderer = new XPHeaderRenderer();
            //this.headerRenderer = new GradientHeaderRenderer();
            //this.headerRenderer = new FlatHeaderRenderer();
            this.headerRenderer.Font = this.headerFont;
            this.headerContextMenu = new HeaderContextMenu();

            this.columnResizing = true;
            this.resizingColumnIndex = -1;
            this.resizingColumnWidth = -1;
            this.hotColumn = -1;
            this.pressedColumn = -1;
            this.lastSortedColumn = -1;
            this.sortedColumnBackColor = Color.WhiteSmoke;

            // borders
            this.borderStyle = BorderStyle.Fixed3D;
            this.borderColor = Color.Black;
            this.unfocusedBorderColor = Color.Black;

            // scrolling
            this.scrollable = true;

            this.hScrollBar = new HScrollBar();
            this.hScrollBar.Visible = false;
            this.hScrollBar.Location = new Point(this.BorderWidth, this.Height - this.BorderWidth - SystemInformation.HorizontalScrollBarHeight);
            this.hScrollBar.Width = this.Width - (this.BorderWidth * 2) - SystemInformation.VerticalScrollBarWidth;
            this.hScrollBar.Scroll += new ScrollEventHandler(this.OnHorizontalScroll);
            this.Controls.Add(this.hScrollBar);

            this.vScrollBar = new VScrollBar();
            this.vScrollBar.Visible = false;
            this.vScrollBar.Location = new Point(this.Width - this.BorderWidth - SystemInformation.VerticalScrollBarWidth, this.BorderWidth);
            this.vScrollBar.Height = this.Height - (this.BorderWidth * 2) - SystemInformation.HorizontalScrollBarHeight;
            this.vScrollBar.Scroll += new ScrollEventHandler(this.OnVerticalScroll);
            this.Controls.Add(this.vScrollBar);

            //
            this.gridLines = GridLines.None; ;
            this.gridColor = SystemColors.Control;
            this.gridLineStyle = GridLineStyle.Solid;

            this.allowSelection = true;
            this.allowRMBSelection = false;
            this.multiSelect = false;
            this.fullRowSelect = false;
            this.hideSelection = false;
            this.selectionBackColor = SystemColors.Highlight;
            this.selectionForeColor = SystemColors.HighlightText;
            this.unfocusedSelectionBackColor = SystemColors.Control;
            this.unfocusedSelectionForeColor = SystemColors.ControlText;
            this.selectionStyle = SelectionStyle.ListView;
            this.alternatingRowColor = Color.Transparent;
            this.alternatingRowSpan = 1;

            // current table state
            this.tableState = TableState.Normal;

            this.lastMouseCell = new CellPos(-1, -1);
            this.lastMouseDownCell = new CellPos(-1, -1);
            this.focusedCell = new CellPos(-1, -1);
            this.hoverTime = 1000;
            this.trackMouseEvent = null;
            this.ResetMouseEventArgs();

            this.toolTip = new ToolTip(this.components);
            this.toolTip.Active = false;
            this.toolTip.InitialDelay = 1000;

            this.noItemsText = "There are no items in this view";

            this.editingCell = new CellPos(-1, -1);
            this.curentCellEditor = null;
            this.editStartAction = EditStartAction.DoubleClick;
            this.customEditKey = Keys.F5;
            //this.tabMovesEditor = true;

            // showSelectionRectangle defaults to true
            this.showSelectionRectangle = true;

            // for data binding
            listChangedHandler = new ListChangedEventHandler(dataManager_ListChanged);
            positionChangedHandler = new EventHandler(dataManager_PositionChanged);
            dataSourceColumnBinder = new DataSourceColumnBinder();

            // finished setting up
            this.beginUpdateCount = 0;
            this.init = false;
            this.preview = false;
        }
Пример #8
0
            /// <summary>
            /// 
            /// </summary>
            /// <param name="model"></param>
            /// <returns></returns>
            public void AddColumns(ColumnModel model)
            {
                this.model = model;

                CellStyle cellStyle = new CellStyle();
                cellStyle.Padding = new CellPadding(6, 0, 0, 0);

                this.columnTable.BeginUpdate();

                for (int i=0; i<model.Columns.Count; i++)
                {
                    Row row = new Row();

                    Cell cell = new Cell(model.Columns[i].Text, model.Columns[i].Visible);
                    cell.Tag = model.Columns[i].Width;
                    cell.CellStyle = cellStyle;

                    row.Cells.Add(cell);

                    this.columnTable.TableModel.Rows.Add(row);
                }

                this.columnTable.SelectionChanged += new XPTable.Events.SelectionEventHandler(columnTable_SelectionChanged);
                this.columnTable.CellCheckChanged += new XPTable.Events.CellCheckBoxEventHandler(columnTable_CellCheckChanged);

                if (this.columnTable.VScroll)
                {
                    this.columnTable.ColumnModel.Columns[0].Width -= SystemInformation.VerticalScrollBarWidth;
                }

                if (this.columnTable.TableModel.Rows.Count > 0)
                {
                    this.columnTable.TableModel.Selections.SelectCell(0, 0);

                    this.showButton.Enabled = !this.model.Columns[0].Visible;
                    this.hideButton.Enabled = this.model.Columns[0].Visible;

                    this.widthTextBox.Text = this.model.Columns[0].Width.ToString();
                }

                this.columnTable.EndUpdate();
            }
Пример #9
0
        /// <summary>
        /// Displays the shortcut menu at the specified position
        /// </summary>
        /// <param name="control">A Control object that specifies the control 
        /// with which this shortcut menu is associated</param>
        /// <param name="pos">A Point object that specifies the coordinates at 
        /// which to display the menu. These coordinates are specified relative 
        /// to the client coordinates of the control specified in the control 
        /// parameter</param>
        public new void Show(Control control, Point pos)
        {
            if (control == null)
            {
                throw new ArgumentNullException("control", "control cannot be null");
            }

            if (!(control is Table))
            {
                throw new ArgumentException("control must be of type Table", "control");
            }

            if (((Table) control).ColumnModel == null)
            {
                throw new InvalidOperationException("The specified Table does not have an associated ColumnModel");
            }

            //
            this.model = ((Table) control).ColumnModel;

            //
            this.MenuItems.Clear();

            base.Show(control, pos);
        }
Пример #10
0
        protected virtual ColumnModel ColumnInitialize()
        {
            TextColumn col1 = new TextColumn(Translator.Instance.T("ģ��"));
            TextColumn col2 = new TextColumn(Translator.Instance.T("���֤�汾"));
            TextColumn col3 = new TextColumn(Translator.Instance.T("��Ȩ�û�"));
            TextColumn col4 = new TextColumn(Translator.Instance.T("��ע"));

            ColumnModel r = new ColumnModel(new Column[] { col1, col2, col3, col4 });
            foreach (Column col in r.Columns)
            {
                col.Resizable = true;
                col.Editable = false;
            }
            return r;
        }
Пример #11
0
        protected virtual ColumnModel ColumnInitialize()
        {
            TextColumn col1 = new TextColumn(Translator.Instance.T("����"), 100);
            TextColumn col2 = new TextColumn(Translator.Instance.T("��ַ(URL)"), 100);

            ColumnModel r = new ColumnModel(new Column[] { col1, col2 });
            foreach (Column col in r.Columns)
            {
                col.Resizable = true;
                col.Editable = true;
            }
            return r;
        }
Пример #12
0
 /// <summary>
 /// Initializes a new instance of the ColumnModelEventArgs class with 
 /// the specified ColumnModel source, start index, end index and affected Column
 /// </summary>
 /// <param name="source">The ColumnModel that originated the event</param>
 /// <param name="column">The affected Column</param>
 /// <param name="fromIndex">The start index of the affected Column(s)</param>
 /// <param name="toIndex">The end index of the affected Column(s)</param>
 public ColumnModelEventArgs(ColumnModel source, Column column, int fromIndex, int toIndex)
     : base()
 {
     this.source = source;
     this.column = column;
     this.fromIndex = fromIndex;
     this.toIndex = toIndex;
 }