Beispiel #1
0
            private void OnColumnsCollectionChanged(object sender, CollectionChangeEventArgs args)
            {
                SWF.DataGridColumnStyle column = (SWF.DataGridColumnStyle)args.Element;

                if (args.Action == CollectionChangeAction.Remove)
                {
                    DataGridDataItemEditProvider edit = columns [column];
                    edit.Terminate();
                    RemoveChildProvider(edit);

                    columns.Remove(column);
                }
                else if (args.Action == CollectionChangeAction.Add)
                {
                    DataGridDataItemEditProvider edit
                        = new DataGridDataItemEditProvider(this, column);
                    edit.Initialize();
                    AddChildProvider(edit);

                    columns [column] = edit;
                }
                else if (args.Action == CollectionChangeAction.Refresh)
                {
                    foreach (DataGridDataItemEditProvider edit in columns.Values)
                    {
                        edit.Terminate();
                    }
                    OnNavigationChildrenCleared();
                }
            }
Beispiel #2
0
            public DataGridHeaderItemProvider GetHeaderItem(SWF.DataGridColumnStyle column)
            {
                DataGridHeaderItemProvider provider;

                dictionary.TryGetValue(column, out provider);
                return(provider);
            }
Beispiel #3
0
            private void OnColumnsCollectionChanged(object sender, CollectionChangeEventArgs args)
            {
                SWF.DataGridColumnStyle column = (SWF.DataGridColumnStyle)args.Element;

                if (args.Action == CollectionChangeAction.Add)
                {
                    DataGridHeaderItemProvider headerItem
                        = new DataGridHeaderItemProvider(this, column);
                    headerItem.Initialize();
                    AddChildProvider(headerItem);
                    dictionary [column] = headerItem;
                }
                else if (args.Action == CollectionChangeAction.Remove)
                {
                    DataGridHeaderItemProvider headerItem = null;
                    if (!dictionary.TryGetValue(column, out headerItem))
                    {
                        return;
                    }
                    headerItem.Terminate();
                    RemoveChildProvider(headerItem);
                    dictionary.Remove(column);
                }
                else if (args.Action == CollectionChangeAction.Refresh)
                {
                    foreach (DataGridHeaderItemProvider headerItem in dictionary.Values)
                    {
                        headerItem.Terminate();
                    }
                    OnNavigationChildrenCleared();
                }
            }
 /// <summary>
 /// Creates a <see cref="IGridFilter"/> for the specified arguments.
 /// It calls <see cref="CreateGridFilterInternal"/> which must be overridden
 /// by any implementing class and raises the <see cref="GridFilterCreated"/>
 /// afterwards.
 /// </summary>
 /// <param name="column">The <see cref="DataColumn"/> for which the filter control should be created.</param>
 /// <param name="columnStyle">The <see cref="DataGridColumnStyle"/> for which the filter control should be created.</param>
 /// <returns>A <see cref="IGridFilter"/>.</returns>
 public IGridFilter CreateGridFilter(DataColumn column, DataGridColumnStyle columnStyle)
 {
     IGridFilter gridFilter = CreateGridFilterInternal(column, columnStyle);
     GridFilterEventArgs gridFilterEventArgs = new GridFilterEventArgs(column, columnStyle, gridFilter);
     OnGridFilterCreated(gridFilterEventArgs);
     return gridFilterEventArgs.GridFilter;
 }
 protected Brush ForeBrushForDataPaint(ref DataGridCell current, DataGridColumnStyle gridColumn, int column)
 {
     Brush brush = this.dgTable.IsDefault ? this.DataGrid.ForeBrush : this.dgTable.ForeBrush;
     if (this.Selected)
     {
         brush = this.dgTable.IsDefault ? this.DataGrid.SelectionForeBrush : this.dgTable.SelectionForeBrush;
     }
     return brush;
 }
 protected Brush BackBrushForDataPaint(ref DataGridCell current, DataGridColumnStyle gridColumn, int column)
 {
     Brush backBrush = this.GetBackBrush();
     if (this.Selected)
     {
         backBrush = this.dgTable.IsDefault ? this.DataGrid.SelectionBackBrush : this.dgTable.SelectionBackBrush;
     }
     return backBrush;
 }
 /// <summary>
 /// Gets the <see cref="IGridFilter"/> which is associated with the given <see cref="DataGridColumnStyle"/>.
 /// </summary>
 public IGridFilter this[DataGridColumnStyle columnStyle]
 {
     get
     {
         if (base.InnerList.Contains(_columnStylesToGridFiltersHash[columnStyle]))
             return (IGridFilter)_columnStylesToGridFiltersHash[columnStyle];
         else
             return null;
     }
 }
 public void AddRange(DataGridColumnStyle[] columns)
 {
     if (columns == null)
     {
         throw new ArgumentNullException("columns");
     }
     for (int i = 0; i < columns.Length; i++)
     {
         this.Add(columns[i]);
     }
 }
 internal void CheckForMappingNameDuplicates(DataGridColumnStyle column)
 {
     if (!string.IsNullOrEmpty(column.MappingName))
     {
         for (int i = 0; i < this.items.Count; i++)
         {
             if (((DataGridColumnStyle) this.items[i]).MappingName.Equals(column.MappingName) && (column != this.items[i]))
             {
                 throw new ArgumentException(System.Windows.Forms.SR.GetString("DataGridColumnStyleDuplicateMappingName"), "column");
             }
         }
     }
 }
 public virtual int Add(DataGridColumnStyle column)
 {
     if (this.isDefault)
     {
         throw new ArgumentException(System.Windows.Forms.SR.GetString("DataGridDefaultColumnCollectionChanged"));
     }
     this.CheckForMappingNameDuplicates(column);
     column.SetDataGridTableInColumn(this.owner, true);
     column.MappingNameChanged += new EventHandler(this.ColumnStyleMappingNameChanged);
     column.PropertyDescriptorChanged += new EventHandler(this.ColumnStylePropDescChanged);
     if ((this.DataGridTableStyle != null) && (column.Width == -1))
     {
         column.width = this.DataGridTableStyle.PreferredColumnWidth;
     }
     int num = this.items.Add(column);
     this.OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Add, column));
     return num;
 }
Beispiel #11
0
            public override void InitializeChildControlStructure()
            {
                for (int column = 0; column < provider.CurrentTableStyle.GridColumnStyles.Count; column++)
                {
                    SWF.DataGridColumnStyle columnStyle = provider.CurrentTableStyle.GridColumnStyles [column];

                    DataGridDataItemEditProvider edit
                        = new DataGridDataItemEditProvider(this, columnStyle);
                    edit.Initialize();
                    AddChildProvider(edit);

                    if (column == 0)
                    {
                        name = GetName(edit);
                    }

                    columns [columnStyle] = edit;
                }

                // To keep track of columns
                DataGridProvider.CurrentTableStyle.GridColumnStyles.CollectionChanged += OnColumnsCollectionChanged;
            }
Beispiel #12
0
        protected void EnToCh(string strChinese, string strWidth, DataTable dt, System.Windows.Forms.DataGrid dg)
        {
            if (dt != null)
            {
                int      col_count = 0;
                string[] str       = strChinese.Split(',');
                string[] wid       = strWidth.Split(',');
                System.Windows.Forms.DataGridTableStyle t_style = new System.Windows.Forms.DataGridTableStyle();
                t_style.MappingName = dt.TableName;
                System.Windows.Forms.DataGridColumnStyle[] c_style = new System.Windows.Forms.DataGridColumnStyle[str.Length];
                dg.TableStyles.Clear();
                col_count = (str.Length < dt.Columns.Count)?str.Length:dt.Columns.Count;
                for (int i = 0; i < col_count; i++)
                {
                    c_style[i]             = new System.Windows.Forms.DataGridTextBoxColumn();
                    c_style[i].MappingName = dt.Columns[i].ColumnName;
                    c_style[i].HeaderText  = (str[i] != "")?str[i]:dt.Columns[i].ColumnName;
                    if (i < wid.Length && wid[i] != "")
                    {
                        c_style[i].Width = Convert.ToInt32(wid[i]);
                    }
                    t_style.GridColumnStyles.Add(c_style[i]);
                }
                t_style.AlternatingBackColor = System.Drawing.Color.WhiteSmoke;
                t_style.BackColor            = System.Drawing.Color.White;
                t_style.GridLineColor        = System.Drawing.Color.LightSkyBlue;
                t_style.HeaderBackColor      = Color.Gainsboro;
                t_style.HeaderForeColor      = System.Drawing.SystemColors.ControlText;
                t_style.SelectionBackColor   = System.Drawing.SystemColors.Info;
                t_style.SelectionForeColor   = Color.Blue;

                dg.Capture = true;

                dg.TableStyles.Add(t_style);
                dg.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
                dg.ReadOnly    = true;
            }
        }
 /// <summary>
 /// Must be overridden by implementing classes.
 /// Should return a valid <see cref="IGridFilter"/> for the specified arguments. 
 /// </summary>
 /// <param name="column">The <see cref="DataColumn"/> for which the filter control should be created.</param>
 /// <param name="columnStyle">The <see cref="DataGridColumnStyle"/> for which the filter control should be created.</param>
 /// <returns>A <see cref="IGridFilter"/>.</returns>
 protected abstract IGridFilter CreateGridFilterInternal(DataColumn column, DataGridColumnStyle columnStyle);
Beispiel #14
0
 public bool Contains(DataGridColumnStyle column)
 {
     return(this.items.IndexOf(column) != -1);
 }
Beispiel #15
0
 public DataGridDataItemEditProvider(DataGridDataItemProvider provider,
                                     SWF.DataGridColumnStyle column) : base(null)
 {
     this.provider = provider;
     this.column   = column;
 }
 protected bool IsColumnDisplayable(DataGridColumnStyle col)
 {
     if (col == null
         || col.Width <= 0
         || col.PropertyDescriptor == null)
     { return false; }
     else
     { return true; }
 }
 /// <summary>
 /// Return always a <see cref="GridFilters.NullGridFilter"/>. 
 /// </summary>
 /// <param name="column">The <see cref="DataColumn"/> for which the filter control should be created.</param>
 /// <param name="columnStyle">The <see cref="DataGridColumnStyle"/> for which the filter control should be created.</param>
 /// <returns>A <see cref="IGridFilter"/>.</returns>
 protected override IGridFilter CreateGridFilterInternal(DataColumn column, DataGridColumnStyle columnStyle)
 {
     return new GridFilters.NullGridFilter();
 }
Beispiel #18
0
 public bool BeginEdit(DataGridColumnStyle gridColumn, int rowNumber)
 {
     throw null;
 }
Beispiel #19
0
 public DataGridColumnHeaderAccessibleObject(DataGridColumnStyle owner)
 {
     this.owner = owner;
 }
        private void makeGeotiffDataGridStyle()
        {
            if(m_geotiffTS != null)
            {
                return;
            }

            //STEP 1: Create a DataTable style object and set properties if required.
            m_geotiffTS = new DataGridTableStyle();
            //specify the table from dataset (required step)
            m_geotiffTS.MappingName = "geotiff";
            // Set other properties (optional step)
            //m_geotiffTS.AlternatingBackColor = Color.LightBlue;

            int colCount = 0;

            //STEP 1: Create an int column style and add it to the tablestyle
            //this requires setting the format for the column through its property descriptor
            PropertyDescriptorCollection pdc = this.BindingContext[m_geotiffDS, "geotiff"].GetItemProperties();
            //now created a formated column using the pdc
            DataGridDigitsTextBoxColumn csIDInt = new DataGridDigitsTextBoxColumn(pdc["id"], "i", true);
            csIDInt.MappingName = "id";
            csIDInt.HeaderText = "";
            csIDInt.Width = 30;
            csIDInt.ReadOnly = true;
            m_geotiffTS.GridColumnStyles.Add(csIDInt);
            colCount++;

            //STEP 2: Create a string column and add it to the tablestyle
            NameCol = new DataGridTextBoxColumn();
            NameCol.MappingName = "name"; //from dataset table
            NameCol.HeaderText = "Name";
            NameCol.Width = Math.Max(10, Project.nameColWidthCm);
            NameCol.ReadOnly = true;
            m_geotiffTS.GridColumnStyles.Add(NameCol);
            colCount++;

            //STEP 3: Add the checkbox
            DataGridColumnStyle boolCol = new MyDataGridBoolColumn(colCount);
            boolCol.MappingName = "displayed";
            boolCol.HeaderText = "Shown";
            //hook the new event to our handler in the grid
            ((MyDataGridBoolColumn)boolCol).BoolValueChanged += new BoolValueChangedEventHandler(HandleCustomMapShowChanges);
            //uncomment this line to get a two-state checkbox
            ((DataGridBoolColumn)boolCol).AllowNull = false;
            boolCol.Width = 45;
            m_geotiffTS.GridColumnStyles.Add(boolCol);
            colCount++;

            //STEP 3: Add the checkbox
            DataGridColumnStyle boolCol2 = new MyDataGridBoolColumn(colCount);
            boolCol2.MappingName = "persist";
            boolCol2.HeaderText = "Load on start";
            //hook the new event to our handler in the grid
            ((MyDataGridBoolColumn)boolCol2).BoolValueChanged += new BoolValueChangedEventHandler(HandleCustomMapPersistChanges);
            //uncomment this line to get a two-state checkbox
            ((DataGridBoolColumn)boolCol2).AllowNull = false;
            boolCol2.Width = 80;
            m_geotiffTS.GridColumnStyles.Add(boolCol2);
            colCount++;

            //STEP 4: Create a string column and add it to the tablestyle
            DescrCol = new DataGridTextBoxColumn();
            DescrCol.MappingName = "descr"; //from dataset table
            DescrCol.HeaderText = "Description";
            //DescrCol.Width = Math.Max(10, Project.descColWidthCm);
            DescrCol.Width = 1;
            DescrCol.ReadOnly = true;
            m_geotiffTS.GridColumnStyles.Add(DescrCol);
            colCount++;

            //STEP 5: Create a string column and add it to the tablestyle
            SourceCol = new DataGridTextBoxColumn();
            SourceCol.MappingName = "source"; //from dataset table
            SourceCol.HeaderText = "Source";
            int colWidthLeft = Math.Max(100, this.Width - csIDInt.Width - NameCol.Width - boolCol.Width - DescrCol.Width - 140);
            SourceCol.Width = Math.Max(colWidthLeft, 100); // Project.sourceColWidthCm);
            SourceCol.ReadOnly = true;
            m_geotiffTS.GridColumnStyles.Add(SourceCol);
            colCount++;

            geotiffDataGrid.CaptionVisible = false;

            //STEP 6: Add the tablestyle to your datagrid's tablestlye collection:
            geotiffDataGrid.TableStyles.Add(m_geotiffTS);

            /* how to test for checked checkboxes:
            if((bool)geotiffDataGrid[row, column])
                MessageBox.Show("I am true");
            else
                MessageBox.Show("I am false");
            */
        }
 protected override void PaintCellContents(Graphics g, Rectangle cellBounds, DataGridColumnStyle column, Brush backBr, Brush foreBrush, bool alignToRight)
 {
     CurrencyManager listManager = base.DataGrid.ListManager;
     string str = string.Empty;
     Rectangle visualBounds = cellBounds;
     object obj2 = base.DataGrid.ListManager[base.number];
     if (obj2 is IDataErrorInfo)
     {
         str = ((IDataErrorInfo) obj2)[column.PropertyDescriptor.Name];
     }
     if (!string.IsNullOrEmpty(str))
     {
         Rectangle rectangle2;
         int num;
         Bitmap errorBitmap = base.GetErrorBitmap();
         lock (errorBitmap)
         {
             rectangle2 = base.PaintIcon(g, visualBounds, true, alignToRight, errorBitmap, backBr);
         }
         if (alignToRight)
         {
             visualBounds.Width -= rectangle2.Width + 3;
         }
         else
         {
             visualBounds.X += rectangle2.Width + 3;
         }
         DataGrid dataGrid = base.DataGrid;
         dataGrid.ToolTipId = (num = dataGrid.ToolTipId) + 1;
         base.DataGrid.ToolTipProvider.AddToolTip(str, (IntPtr) num, rectangle2);
     }
     column.Paint(g, visualBounds, listManager, base.RowNumber, backBr, foreBrush, alignToRight);
 }
        /// <summary>
        /// Updates the style of an existing column
        /// </summary>
        /// <param name="position">Position of the original column</param>
        /// <param name="column">Updated column</param>
        private void UpdateColumnStyle(int position, GridColumnBase column)
        {
            position = position - iColumnOffset;
            DataGridColumnStyle[] temp = new DataGridColumnStyle[dgColumns.TableStyles["GridColumns"].GridColumnStyles.Count];
            dgColumns.TableStyles["GridColumns"].GridColumnStyles.CopyTo(temp, 0);
            List<DataGridColumnStyle> styles = new List<DataGridColumnStyle>(temp);

            DataGridTextBoxColumn textColumn = new DataGridTextBoxColumn();
            textColumn.MappingName = column.Name;
            textColumn.HeaderText = column.Text;
            textColumn.Width = (column.Width > 0 ? column.Width : 75);
            textColumn.NullText = string.Empty;
            textColumn.WidthChanged += new EventHandler(textColumn_WidthChanged);

            styles.RemoveAt(position);
            styles.Insert(position, textColumn);

            dgColumns.TableStyles["GridColumns"].GridColumnStyles.Clear();
            dgColumns.TableStyles["GridColumns"].GridColumnStyles.AddRange(styles.ToArray());
        }
Beispiel #23
0
            /// <include file='doc\DataGridColumn.uex' path='docs/doc[@for="DataGridColumnStyle.DataGridColumnHeaderAccessibleObject.DataGridColumnHeaderAccessibleObject"]/*' />
            /// <devdoc>
            ///    <para>[To be supplied.]</para>
            /// </devdoc>
            public DataGridColumnHeaderAccessibleObject(DataGridColumnStyle owner) : this() {
                Debug.Assert(owner != null, "DataGridColumnHeaderAccessibleObject must have a valid owner DataGridColumn");
                this.owner = owner;

            }
        /// <include file='doc\DataGridColumnCollection.uex' path='docs/doc[@for="GridColumnStylesCollection.Remove"]/*' />
        /// <devdoc>
        /// <para>Removes the specified System.Windows.Forms.DataGridColumnStyle from the System.Windows.Forms.GridColumnsStyleCollection.</para>
        /// </devdoc>
        public void Remove(DataGridColumnStyle column) {
            if (this.isDefault) {
                throw new ArgumentException(SR.GetString(SR.DataGridDefaultColumnCollectionChanged));
            }

            int columnIndex = -1;
            int itemsCount = items.Count;
            for (int i = 0; i < itemsCount; ++i)
                if (items[i] == column) {
                    columnIndex = i;
                    break;
                }
            if (columnIndex == -1)
                throw new InvalidOperationException(SR.GetString(SR.DataGridColumnCollectionMissing));
            else
                RemoveAt(columnIndex);
        }
        /* implemented at BaseCollection
        /// <overload>
        ///    <para>
        ///       Gets an enumerator for the System.Windows.Forms.GridColumnsStyleCollection.
        ///    </para>
        /// </overload>
        /// <summary>
        ///    <para>
        ///       Gets an enumerator for the System.Windows.Forms.GridColumnsStyleCollection.
        ///    </para>
        /// </summary>
        /// <returns>
        ///    <para>
        ///       An <see cref='System.Collections.IEnumerator'/>
        ///       that can be used to iterate through the collection.
        ///    </para>
        /// </returns>
        /// <example>
        ///    <para>
        ///       The following example gets an <see cref='System.Collections.IEnumerator'/> that iterates through the System.Windows.Forms.GridColumnsStyleCollection. and prints the
        ///    <see cref='System.Windows.Forms.GridColumnsCollection.Caption'/> of each <see cref='System.Data.DataColumn'/> 
        ///    associated with the object.
        /// </para>
        /// <code lang='VB'>
        /// Private Sub EnumerateThroughGridColumns()
        ///    Dim ie As System.Collections.IEnumerator
        ///    Dim dgCol As DataGridColumn
        ///    Set ie = DataGrid1.GridColumns.GetEnumerator
        ///    Do While ie.GetNext = True
        ///       Set dgCol = ie.GetObject
        ///       Debug.Print dgCol.DataColumn.Caption
        ///    Loop
        /// End Sub
        /// </code>
        /// </example>
        /// <seealso cref='System.Data.DataColumn'/>
        /// <seealso cref='System.Collections.IEnumerator'/>
        /// <seealso cref='System.Windows.Forms.IEnumerator.GetNext'/>
        /// <seealso cref='System.Windows.Forms.IEnumerator.GetObject'/>
        public override IEnumerator GetEnumerator() {
            return items.GetEnumerator();
        }

        /// <summary>
        ///    <para>
        ///       Gets an enumerator for the System.Windows.Forms.GridColumnsStyleCollection
        ///       .
        ///    </para>
        /// </summary>
        /// <param name='allowRemove'>
        /// <para>A value that indicates if the enumerator can remove elements. <see langword='true'/>, if removals are allowed; otherwise, <see langword='false'/>. The default is <see langword='false'/>.</para>
        /// </param>
        /// <returns>
        ///    <para>
        ///       An <see cref='System.Collections.IEnumerator'/> that can be used to iterate through the
        ///       collection.
        ///    </para>
        /// </returns>
        /// <exception cref='NotSupportedException'>
        ///    An attempt was made to remove the System.Windows.Forms.DataGridColumnStyle through the <see cref='System.Collections.Enumerator'/> object's <see cref='System.Windows.Forms.Enumerator.Remove'/> method. Use the System.Windows.Forms.GridColumnsStyleCollection object's <see cref='System.Windows.Forms.GridColumnsCollection.Remove'/> method instead.
        /// </exception>
        /// <remarks>
        ///    <para>
        ///       Because this implementation doesn't support the removal
        ///       of System.Windows.Forms.DataGridColumnStyle objects through the <see cref='System.Collections.Enumerator'/>
        ///       class's <see cref='System.Windows.Forms.Enumerator.Remove'/> method, you must use the <see cref='System.Windows.Forms.DataGridCollection'/> class's <see cref='System.Windows.Forms.GridColumnsCollection.Remove'/>
        ///       method instead.
        ///    </para>
        /// </remarks>
        /// <example>
        ///    <para>
        ///       The following example gets an <see cref='System.Collections.IEnumerator'/> for that iterates through the System.Windows.Forms.GridColumnsStyleCollection. If a column in the collection is of type <see cref='System.Windows.Forms.DataGridBoolColumn'/>, it is deleted.
        ///    </para>
        ///    <code lang='VB'>
        /// Private Sub RemoveBoolColumns()
        ///    Dim ie As System.Collections.IEnumerator
        ///    Dim dgCol As DataGridColumn
        ///    Set ie = DataGrid1.GridColumns.GetEnumerator(true)
        ///    Do While ie.GetNext
        ///       Set dgCol = ie.GetObject
        ///       
        ///       If dgCol.ToString = "DataGridBoolColumn" Then
        ///          DataGrid1.GridColumns.Remove dgCol
        ///       End If
        ///    Loop
        /// End If
        ///    </code>
        /// </example>
        /// <seealso cref='System.Collections.IEnumerator'/>
        /// <seealso cref='System.Windows.Forms.IEnumerator.GetNext'/>
        /// <seealso cref='System.Windows.Forms.IEnumerator.GetObject'/>
        /// <seealso cref='System.Windows.Forms.GridColumnsCollection.Remove'/>
        public override IEnumerator GetEnumerator(bool allowRemove) {
            if (!allowRemove)
                return GetEnumerator();
            else
                throw new NotSupportedException(SR.GetString(SR.DataGridColumnCollectionGetEnumerator));
        }
        */

        /// <include file='doc\DataGridColumnCollection.uex' path='docs/doc[@for="GridColumnStylesCollection.IndexOf"]/*' />
        /// <devdoc>
        /// <para>Gets the index of a specified System.Windows.Forms.DataGridColumnStyle.</para>
        /// </devdoc>
        public int IndexOf(DataGridColumnStyle element) {
            int itemCount = items.Count;
            for (int i = 0; i < itemCount; ++i) {
                DataGridColumnStyle column = (DataGridColumnStyle)items[i];
                if (element == column)
                    return i;
            }
            return -1;
        }
Beispiel #26
0
 public DataGridColumnHeaderAccessibleObject(DataGridColumnStyle owner)
 {
     throw null;
 }
 internal void AddDefaultColumn(DataGridColumnStyle column)
 {
     column.SetDataGridTableInColumn(this.owner, true);
     this.items.Add(column);
 }
        /// <include file='doc\DataGridColumnCollection.uex' path='docs/doc[@for="GridColumnStylesCollection.Contains1"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Gets a value indicating whether the System.Windows.Forms.GridColumnsStyleCollection contains the specified System.Windows.Forms.DataGridColumnStyle.
        ///    </para>
        /// </devdoc>
        public bool Contains(DataGridColumnStyle column)
        {
            int index = items.IndexOf(column);

            return(index != -1);
        }
        /// <summary>
        /// The array of IImagingTasks last received
        /// </summary>
        //private IImagingTask[] tasks;

        #region IImagingTaskProvider Methods

        // public IImagingTask[] GetImagingTasks(Formulatrix.Integrations.ImagerLink.IRobot robot, string plateID)
        // public bool SupportsPriority(Formulatrix.Integrations.ImagerLink.IRobot robot)
        // public void UpdatedPriority(Formulatrix.Integrations.ImagerLink.IRobot robot, string plateID, DateTime dateToImage, int priority)
        // public string ImagingPlate(Formulatrix.Integrations.ImagerLink.IRobot robot, string plateID, bool scheduled, DateTime dateToImage, DateTime dateImaged)
        // public void ImagedPlate(Formulatrix.Integrations.ImagerLink.IRobot robot, string plateID, string imagingID)
        // public void SkippedImaging(Formulatrix.Integrations.ImagerLink.IRobot robot, string plateID, DateTime dateToImage)

        #endregion

        public ImagingTaskProviderTester()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            // TODO: Add any initialization after the InitializeComponent call

            // Get an ImagingTaskProvider
            //itp = new ImagingTaskProvider();
            itp = new ImagingTaskProviderNew();

            // Get a robot
            Robot r = new Robot();

            r.SetID("1");
            r.SetName("RI1000-0014");
            robot = r;

            // Get a DataTable
            dt = new DataTable();

            // Set the columns for the DataTable
            dt.Columns.Add(new DataColumn("Date To Image", typeof(DateTime)));
            dt.Columns.Add(new DataColumn("Priority", typeof(Int32)));
            dt.Columns.Add(new DataColumn("In Queue", typeof(bool)));
            dt.Columns.Add(new DataColumn("State", typeof(Formulatrix.Integrations.ImagerLink.Scheduling.ImagingState)));
            dt.Columns.Add(new DataColumn("Date Imaged UTC", typeof(DateTime)));
            dt.Columns.Add(new DataColumn("Date To Image UTC", typeof(DateTime)));
            dt.Columns.Add(new DataColumn("Date Imaged Local", typeof(DateTime)));
            dt.Columns.Add(new DataColumn("Date To Image Local", typeof(DateTime)));

            // Convert to something the DataGrid can show
            DataView dv = new DataView(dt);

            dv.AllowDelete = false;
            dv.AllowEdit   = false;
            dv.AllowNew    = false;
            dv.Sort        = "Date To Image ASC";

            // Show the table in the DataGrid
            dgImagingTasks.DataSource = dv;

            System.Windows.Forms.CurrencyManager    cm = null;
            System.Windows.Forms.DataGridTableStyle ts = null;
            if (dgImagingTasks.TableStyles.Count > 0)
            {
                ts = dgImagingTasks.TableStyles[0];
            }
            else
            {
                cm = (CurrencyManager)BindingContext[dv, dt.TableName];
                ts = new System.Windows.Forms.DataGridTableStyle(cm);
                dgImagingTasks.TableStyles.Add(ts);
            }
            for (Int32 i = 0; i < dt.Columns.Count; i++)
            {
                System.Data.DataColumn dc = dt.Columns[i];
                if (dc.DataType == typeof(System.DateTime))
                {
                    System.Windows.Forms.DataGridColumnStyle cs =
                        dgImagingTasks.TableStyles[0].GridColumnStyles[i];
                    if ((cs != null) && (cs.GetType() ==
                                         typeof(System.Windows.Forms.DataGridTextBoxColumn)))
                    {
                        ((System.Windows.Forms.DataGridTextBoxColumn)cs).Format = "yyyy-MM-dd HH:mm:ss";
                        ((System.Windows.Forms.DataGridTextBoxColumn)cs).Width  = 150;
                    }
                }
                else
                {
                    System.Windows.Forms.DataGridTextBoxColumn dgcs = new
                                                                      System.Windows.Forms.DataGridTextBoxColumn();
                    ts.GridColumnStyles.Add(dgcs);
                }
            }
            //EdsDataGrid.TableStyles.Add(ts);
        }
Beispiel #30
0
 protected virtual void PaintCellContents(Graphics g, Rectangle cellBounds, DataGridColumnStyle column,
                                          Brush backBr, Brush foreBrush)
 {
     PaintCellContents(g, cellBounds, column, backBr, foreBrush, false);
 }
Beispiel #31
0
 protected override void PaintCellContents(Graphics g, Rectangle cellBounds, DataGridColumnStyle column,
                                           Brush backBr, Brush foreBrush, bool alignToRight) {
     if (DataBound) {
         CurrencyManager listManager = DataGrid.ListManager;
         column.Paint(g, cellBounds, listManager, this.RowNumber, alignToRight);
     }
     else {
         base.PaintCellContents(g, cellBounds, column, backBr, foreBrush, alignToRight);
     }
 }
Beispiel #32
0
		public bool BeginEdit (DataGridColumnStyle gridColumn, int rowNumber)
		{
			throw new NotImplementedException ();
		}
Beispiel #33
0
 public bool EndEdit(DataGridColumnStyle gridColumn, int rowNumber, bool shouldAbort)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Creates a new instance
 /// </summary>
 /// <param name="column">Column the <see cref="IGridFilter"/> is created for.</param>
 /// <param name="columnStyle">Column style the <see cref="IGridFilter"/> is created for.</param>
 /// <param name="gridFilter">Default <see cref="IGridFilter"/> instance.</param>
 public GridFilterEventArgs(DataColumn column, DataGridColumnStyle columnStyle, IGridFilter gridFilter)
 {
     _column = column;
     _columnStyle = columnStyle;
     _gridFilter = gridFilter;
 }
Beispiel #35
0
 internal void AddDefaultColumn(DataGridColumnStyle column)
 {
     column.SetDataGridTableInColumn(this.owner, true);
     this.items.Add(column);
 }
Beispiel #36
0
		internal void InvalidateColumn (DataGridColumnStyle column)
		{
			Rectangle rect_col = new Rectangle ();
			int col_pixel;
			int col = -1;

			col = CurrentTableStyle.GridColumnStyles.IndexOf (column);

			if (col == -1)
				return;

			rect_col.Width = column.Width;
			col_pixel = GetColumnStartingPixel (col);
			rect_col.X = cells_area.X + col_pixel - horiz_pixeloffset;
			rect_col.Y = cells_area.Y;
			rect_col.Height = cells_area.Height;
			Invalidate (rect_col);
		}
Beispiel #37
0
 public DataGridHeaderItemProvider(DataGridHeaderProvider header,
                                   SWF.DataGridColumnStyle style) : base(null)
 {
     this.header = header;
     this.style  = style;
 }
Beispiel #38
0
		public bool BeginEdit (DataGridColumnStyle gridColumn, int rowNumber)
		{
			if (is_changing)
				return false;

			int column = CurrentTableStyle.GridColumnStyles.IndexOf (gridColumn);
			if (column < 0)
				return false;

			CurrentCell = new DataGridCell (rowNumber, column);

			/* force editing of CurrentCell if we aren't already editing */
			Edit ();

			return true;
		}
 public void Remove(DataGridColumnStyle column)
 {
     items.Remove(column);
     DisconnectColumnEvents(column);
     OnCollectionChanged(new CollectionChangeEventArgs(CollectionChangeAction.Remove, column));
 }
 public int IndexOf(DataGridColumnStyle element)
 {
     return(items.IndexOf(element));
 }
Beispiel #41
0
 protected virtual void PaintCellContents(Graphics g, Rectangle cellBounds, DataGridColumnStyle column,
                                          Brush backBr, Brush foreBrush, bool alignToRight)
 {
     g.FillRectangle(backBr, cellBounds);
 }
Beispiel #42
0
 public bool EndEdit(DataGridColumnStyle gridColumn, int rowNumber, bool shouldAbort)
 {
     throw null;
 }
Beispiel #43
0
		public bool EndEdit (DataGridColumnStyle gridColumn, int rowNumber, bool shouldAbort)
		{
			throw new NotImplementedException ();
		}
Beispiel #44
0
 public bool BeginEdit(DataGridColumnStyle gridColumn, int rowNumber)
 {
     throw new NotImplementedException();
 }
        void delete_Click(object sender, EventArgs e)
        {
            DialogResult confirmDelete = MsgBox.ShowQuestion(SharedStrings.CONFIRM_DELETE_GRID_COLUMN, MessageBoxButtons.YesNo);
            if (confirmDelete.Equals(DialogResult.Yes))
            {
                string columnName = string.Empty;
                List<GridColumnBase> tempGrid = null;
                if (Util.IsEmpty(gridColumns))
                {
                    gridColumns = new List<GridColumnBase>(field.Columns);
                }

                if (!Util.IsEmpty(dgColumns.DataSource))
                {
                    columnName = ((DataTable)dgColumns.DataSource).Columns[hti.Column].ColumnName;
                    tempGrid = new List<GridColumnBase>(gridColumns);

                    foreach (GridColumnBase col in tempGrid)
                    {
                        if (col.Name.Equals(columnName))
                        {
                            gridColumns.Remove(col);
                            break;
                        }
                    }

                    DataGridColumnStyle[] temp = new DataGridColumnStyle[dgColumns.TableStyles["GridColumns"].GridColumnStyles.Count];
                    dgColumns.TableStyles["GridColumns"].GridColumnStyles.CopyTo(temp, 0);
                    List<DataGridColumnStyle> styles = new List<DataGridColumnStyle>(temp);
                    styles.RemoveAt(hti.Column);

                    dgColumns.TableStyles["GridColumns"].GridColumnStyles.Clear();
                    dgColumns.TableStyles["GridColumns"].GridColumnStyles.AddRange(styles.ToArray());

                    tempGrid = null;

                    if (dgColumns.DataSource is DataTable)
                    {
                        if (dgColumns.TableStyles["GridColumns"].GridColumnStyles.Count.Equals(0))
                        {
                            btnOk.Enabled = false;
                        }
                        else
                        {
                            btnOk.Enabled = true;
                        }
                    }
                }
            }
        }
 public bool Contains(DataGridColumnStyle column)
 {
     return (this.items.IndexOf(column) != -1);
 }
Beispiel #47
0
		public bool EndEdit (DataGridColumnStyle gridColumn, int rowNumber, bool shouldAbort)
		{
			if (shouldAbort || (_readonly || gridColumn.TableStyleReadOnly || gridColumn.ReadOnly))
				gridColumn.Abort (rowNumber);
			else {
				gridColumn.Commit (ListManager, rowNumber);
				gridColumn.ConcedeFocus ();
			}

			if (is_editing || is_changing) {
				is_editing = false;
				is_changing = false;
				InvalidateRowHeader (rowNumber);
			}
			return true;
		}
 public int IndexOf(DataGridColumnStyle element)
 {
     int count = this.items.Count;
     for (int i = 0; i < count; i++)
     {
         DataGridColumnStyle style = (DataGridColumnStyle) this.items[i];
         if (element == style)
         {
             return i;
         }
     }
     return -1;
 }
Beispiel #49
0
		internal void EditRowChanged (DataGridColumnStyle column_style)
		{
			if (cursor_in_add_row) {
				if (!commit_row_changes) { // first change in add row, time to show another row in the ui
					commit_row_changes = true;
					RecreateDataGridRows (true);
				}
			}
		}
 public void Remove(DataGridColumnStyle column)
 {
     if (this.isDefault)
     {
         throw new ArgumentException(System.Windows.Forms.SR.GetString("DataGridDefaultColumnCollectionChanged"));
     }
     int index = -1;
     int count = this.items.Count;
     for (int i = 0; i < count; i++)
     {
         if (this.items[i] == column)
         {
             index = i;
             break;
         }
     }
     if (index == -1)
     {
         throw new InvalidOperationException(System.Windows.Forms.SR.GetString("DataGridColumnCollectionMissing"));
     }
     this.RemoveAt(index);
 }
 public DataGridColumnHeaderAccessibleObject(DataGridColumnStyle owner) : this()
 {
     this.owner = owner;
 }
 public bool Contains(DataGridColumnStyle column)
 {
     return(FromColumnNameToIndex(column.MappingName) != -1);
 }