Пример #1
0
 private void FGrid_CustomDrawCellGetHeight(object sender, iGCustomDrawCellGetHeightEventArgs e)
 {
     // This event is raised while auto-adjusting the height of a row containing a custom draw cell.
     // Here we calculate the height of the cell's contents needed to display it entirely.
     if (e.RowIndex < 0)
     {
         // e.RowIndex equals -1 in the case when GetPrefferedRowHeight is called
         // (this is also done in the ISupportInitialize.EndInit call from the designer).
         e.Height = fGrid.Font.Height + CELL_BUTTON_PADDING * 2;
     }
     else
     {
         if (IsButtonColumn(e.ColIndex) && IsCellButtonVisible(e.RowIndex, e.ColIndex))
         {
             iGCell myCell  = fGrid.Cells[e.RowIndex, e.ColIndex];
             Image  myImage = null;
             if ((fGrid.ImageList != null) && (myCell.ImageIndex > -1))
             {
                 myImage = fGrid.ImageList.Images[myCell.ImageIndex];
             }
             if (myImage == null)
             {
                 e.Height = fGrid.Cells[e.RowIndex, e.ColIndex].EffectiveFont.Height + CELL_BUTTON_PADDING * 2;
             }
             else
             {
                 e.Height = myImage.Height + CELL_BUTTON_PADDING * 2;
             }
         }
     }
 }
        private void fGrid_AfterAutoGroupRowCreated(object sender, iGAfterAutoGroupRowCreatedEventArgs e)
        {
            iGCell myGroupRowCell = fGrid.RowTextCol.Cells[e.AutoGroupRowIndex];

            myGroupRowCell.Row.AutoHeight();
            iGCell myFirstCellInGroup = fGrid.Cells[e.GroupedRowIndex, "svalue"];

            myGroupRowCell.Value   = string.Format("{0}   ::  {1}", myFirstCellInGroup.Value.ToProperCase(), m_GroupTotal[myFirstCellInGroup.Text].ToNumberDisplayFormat());
            myGroupRowCell.Row.Key = myFirstCellInGroup.Text;
            myGroupRowCell.Row.RowTextCell.Row.Key = myFirstCellInGroup.Text;
            myGroupRowCell.Row.TextAlign           = iGContentAlignment.MiddleLeft;
        }
Пример #3
0
        // Keyboard interface: cell buttons can be clicked with the SPACE key.
        private void FGrid_KeyPress(object sender, KeyPressEventArgs e)
        {
            iGCell myCurCell = fGrid.CurCell;

            if ((e.KeyChar == ' ') && (myCurCell != null))
            {
                if (IsCellButtonEnabled(myCurCell.RowIndex, myCurCell.ColIndex))
                {
                    OnCellButtonClick(new IGCellButtonClickEventArgs(myCurCell.RowIndex, myCurCell.ColIndex));
                }
            }
        }
 private void position_button_controller()
 {
     if (fGrid2.Rows.Count > 0)
     {
         iGCell _cell = fGrid2.Rows["othersxxx"].Cells["type"];
         if (_cell != null)
         {
             buttonX1.Left  = fGrid2.Left + _cell.Bounds.Left;
             buttonX1.Top   = fGrid2.Top + _cell.Bounds.Top + 1;
             buttonX1.Width = _cell.Bounds.Width;
         }
     }
     position_button_controller1();
 }
        private void fGrid_AfterAutoGroupRowCreated(object sender, iGAfterAutoGroupRowCreatedEventArgs e)
        {
            iGrid  _grid          = sender as iGrid;
            iGCell myGroupRowCell = _grid.RowTextCol.Cells[e.AutoGroupRowIndex];

            myGroupRowCell.Row.AutoHeight();
            ic.church_groupC _gp       = _grid.Rows[e.GroupedRowIndex].Tag as ic.church_groupC;
            string           _disp_str = string.Empty;

            if (_gp != null)
            {
                _disp_str = datam.DATA_CG_TYPES[_gp.cg_type_id].cg_type_name;
            }
            myGroupRowCell.Value    = _disp_str;
            myGroupRowCell.AuxValue = _gp.cg_type_id;
        }
Пример #6
0
        private void FGrid_CustomDrawCellForeground(object sender, iGCustomDrawCellEventArgs e)
        {
            if (IsButtonColumn(e.ColIndex) && IsCellButtonVisible(e.RowIndex, e.ColIndex))
            {
                iGCell myCell = fGrid.Cells[e.RowIndex, e.ColIndex];
                //myCell.ImageIndex = 6;
                // Determine the button state.
                PushButtonState myState;
                switch (e.State)
                {
                case iGControlState.Normal:
                    myState = PushButtonState.Normal;
                    break;

                case iGControlState.Hot:
                    myState = PushButtonState.Hot;
                    break;

                case iGControlState.Pressed:
                    myState = PushButtonState.Pressed;
                    break;

                default:
                    myState = PushButtonState.Disabled;
                    break;
                }

                // Draw a button cell.
                Image myImage = null;
                if ((fGrid.ImageList != null) && (myCell.ImageIndex > -1))
                {
                    myImage = fGrid.ImageList.Images[myCell.ImageIndex];
                }
                if (myImage == null)
                {
                    ButtonRenderer.DrawButton(e.Graphics, e.Bounds, myCell.Text, myCell.EffectiveFont, false, myState);
                }
                else
                {
                    Rectangle myImageRect = new Rectangle(0, 0, myImage.Width, myImage.Height);
                    CenterRect(e.Bounds, ref myImageRect);
                    ButtonRenderer.DrawButton(e.Graphics, e.Bounds, null, myCell.EffectiveFont, myImage, myImageRect, false, myState);
                }
            }
        }
Пример #7
0
        void g_AfterAutoGroupRowCreated(object sender, iGAfterAutoGroupRowCreatedEventArgs e)
        {
            iGrid objfgrid = sender as iGrid;

            if (objfgrid == null)
            {
                return;
            }
            iGCell myGroupRowCell = objfgrid.RowTextCol.Cells[e.AutoGroupRowIndex];

            myGroupRowCell.Row.AutoHeight();
            myGroupRowCell.Row.Height     = myGroupRowCell.Row.Height + 3;
            myGroupRowCell.Row.Selectable = false;
            iGCell myFirstCellInGroup = objfgrid.Cells[e.GroupedRowIndex, "category"];

            myGroupRowCell.Row.Key       = string.Format("GP{0}", objfgrid.Cells[e.GroupedRowIndex, "svalue"].Value.ToInt32());
            myFirstCellInGroup.TextAlign = iGContentAlignment.MiddleCenter;
            myGroupRowCell.Value         = string.Format("{0}", myFirstCellInGroup.Value.ToString());
        }
        private void fGrid_AfterAutoGroupRowCreated(object sender, iGAfterAutoGroupRowCreatedEventArgs e)
        {
            iGrid  _grid          = sender as iGrid;
            iGCell myGroupRowCell = _grid.RowTextCol.Cells[e.AutoGroupRowIndex];

            myGroupRowCell.Row.AutoHeight();
            ic.church_groupC _gp       = _grid.Rows[e.GroupedRowIndex].Tag as ic.church_groupC;
            string           _disp_str = null;
            var _cg_type = datam.DATA_CG_TYPES[_gp.cg_type_id];

            if (_gp != null)
            {
                _disp_str = _cg_type.cg_type_name;
            }
            myGroupRowCell.Value    = _cg_type.is_default ? string.Format("{0} (Default)", _disp_str) : _disp_str;
            myGroupRowCell.AuxValue = _gp.cg_type_id;
            myGroupRowCell.Row.Tag  = _cg_type;
            myGroupRowCell.Row.Key  = string.Format("gp-{0}", _cg_type.cg_type_id);
        }
 private void position_button_controller1()
 {
     if (fGrid2.Rows.Count > 0)
     {
         iGCell _cell = fGrid2.Rows["othersxxx"].Cells["mem"];
         if (_cell != null)
         {
             buttonX2.Left = fGrid2.Left + (_cell.Bounds.Left + _cell.Bounds.Width - buttonX2.Width);
             buttonX2.Top  = fGrid2.Top + _cell.Bounds.Top + 1;
         }
     }
     if (fGrid2.Rows.Count > 0)
     {
         iGCell _cell = fGrid2.Rows["othersxxx"].Cells["desig"];
         if (_cell != null)
         {
             buttonR.Left = fGrid2.Left + (_cell.Bounds.Left + _cell.Bounds.Width - buttonR.Width);
             buttonR.Top  = fGrid2.Top + _cell.Bounds.Top + 1;
         }
     }
     // if (!buttonX2.Visible) { buttonX2.Visible = true; }
 }
Пример #10
0
        private void fGrid_AfterAutoGroupRowCreated(object sender, iGAfterAutoGroupRowCreatedEventArgs e)
        {
            iGrid objfgrid = sender as iGrid;

            if (objfgrid == null)
            {
                return;
            }
            iGCell myGroupRowCell = objfgrid.RowTextCol.Cells[e.AutoGroupRowIndex];

            myGroupRowCell.Row.AutoHeight();
            myGroupRowCell.Row.Height = myGroupRowCell.Row.Height + 4;
            iGCell myFirstCellInGroup = objfgrid.Cells[e.GroupedRowIndex, m_group_col];

            myGroupRowCell.Row.Key       = string.Format("GP{0}", objfgrid.Cells[e.GroupedRowIndex, "svalue"].Value.ToInt32());
            myGroupRowCell.Row.TextAlign = iGContentAlignment.MiddleLeft;
            myFirstCellInGroup.TextAlign = iGContentAlignment.MiddleCenter;
            myGroupRowCell.Value         = string.Format("{0}", myFirstCellInGroup.Value.ToProperCase());
            combofilter.Items.Add(myGroupRowCell.Text);
            m_GroupedRows.Add(myGroupRowCell.Row.Key);
            OtherGroups.Add(e.GroupedRowIndex - 1);
        }
Пример #11
0
 private void FGrid_CustomDrawCellGetWidth(object sender, iGCustomDrawCellGetWidthEventArgs e)
 {
     // This event is raised while auto-adjusting the width of a column containing a custom draw cell.
     // Here we calculate the width of the cell's contents needed to display it entirely.
     if (IsButtonColumn(e.ColIndex) && IsCellButtonVisible(e.RowIndex, e.ColIndex))
     {
         iGCell myCell  = fGrid.Cells[e.RowIndex, e.ColIndex];
         Image  myImage = null;
         if ((fGrid.ImageList != null) && (myCell.ImageIndex > -1))
         {
             myImage = fGrid.ImageList.Images[myCell.ImageIndex];
         }
         if (myImage == null)
         {
             using (Graphics myGraphics = fGrid.CreateGraphics())
                 e.Width = (int)myGraphics.MeasureString(myCell.Text, myCell.EffectiveFont).Width + CELL_BUTTON_PADDING * 2;
         }
         else
         {
             e.Width = myImage.Width + CELL_BUTTON_PADDING * 2;
         }
     }
 }
Пример #12
0
        void LoadPictureGrid()
        {
            try
            {
                if (view_data.Data == null || view_data.Data.Count() == 0)
                {
                    return;
                }
                int   record_count = 0;
                iGRow _row         = null;
                iGrid1.BeginUpdate();
                iGrid1.Rows.Clear();
                var _nlist = (from v in view_data.Data
                              orderby v.HasPic descending, v.gender_id
                              select v);

                int y = 0;
                for (int j = 0; j < 30; j++)
                {
                    iGrid1.Cols[j].Visible = false;
                }
                record_count = _nlist.Count();
                bool       _passed_first = false;
                ic.memberC _mem          = null;
                iGCell     _cell         = null;

                while (y < _nlist.Count())
                {
                    _row        = iGrid1.Rows.Add();
                    _row.Height = 150;
                    for (int j = 0; j < m_ret_cols; j++)
                    {
                        if (y == record_count)
                        {
                            break;
                        }
                        _mem = _nlist.ElementAt(y);
                        if (_mem == null)
                        {
                            continue;
                        }
                        if (!_passed_first)
                        {
                            if (!iGrid1.Cols[j].Visible)
                            {
                                iGrid1.Cols[j].Visible = true;
                            }
                        }
                        _cell = _row.Cells[j];
                        if (_mem.objPicture != null)
                        {
                            _cell.CustomDrawFlags |= iGCustomDrawFlags.Foreground;
                            _cell.Value            = _mem.objPicture.SmallLabelPicture;
                            _cell.AuxValue         = _mem.mem_id;
                            iGrid1.Cols[j].Width   = 103;
                        }
                        else
                        {
                            _cell.CustomDrawFlags = iGCustomDrawFlags.None;
                            _cell.TextFormatFlags = iGStringFormatFlags.WordWrap;
                            _cell.TextAlign       = iGContentAlignment.MiddleCenter;
                            if (_mem.mem_title_id > 0)
                            {
                                _cell.Value = string.Format("{0} {1}", xso.xso.DATA_COMMON[_mem.mem_title_id].item_name, _mem.mem_name).ToProperCase();
                            }
                            else
                            {
                                _cell.Value = string.Format("{0}", _mem.mem_name).ToProperCase();
                            }
                            _cell.AuxValue       = _mem.mem_id;
                            _cell.BackColor      = Color.Gainsboro;
                            iGrid1.Cols[j].Width = 103;
                        }
                        y++;
                    }
                    _passed_first = true;
                }
                iGrid1.AutoResizeCols = false;
                iGrid1.EndUpdate();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void LoadMonthData()
        {
            IEnumerable <ic.expense_transC> _list = null;

            switch (m_showType)
            {
            case _show_type.payments_expenses:
            {
                _list = from e in datam.DATA_YEAR_EXPENSES[m_YEAR].Values
                        where e.voucher_status == em.voucher_statusS.valid
                        select e;
                break;
            }

            case _show_type.expenses_only:
            {
                _list = from e in datam.DATA_YEAR_EXPENSES[m_YEAR].Values
                        where e.voucher_status == em.voucher_statusS.valid & e.IsExpense
                        select e;
                break;
            }

            case _show_type.payments_only:
            {
                _list = from e in datam.DATA_YEAR_EXPENSES[m_YEAR].Values
                        where e.voucher_status == em.voucher_statusS.valid & e.IsPayment
                        select e;
                break;
            }
            }

            iGCell _cell        = null;
            iGRow  _row         = null;
            int    amount       = 0;
            int    month_id     = 0;
            var    _grid        = fGrid;
            iGCell _cell_parent = null;

            _grid.BeginUpdate();
            foreach (var _exp in _list)
            {
                _cell             = _grid.Rows[_exp.exp_acc_id.ToString()].Cells[_exp.exp_date.Value.Month];
                _cell.TypeFlags   = iGCellTypeFlags.HasEllipsisButton;
                _cell.ReadOnly    = iGBool.False;
                _cell.Row.Visible = true;
                if (_cell.Row.Level == 0)
                {
                    _cell.Value = (_cell.Value.ToInt32() + _exp.exp_amount);
                    if (_cell.AuxValue == null)
                    {
                        _cell.AuxValue = string.Format("{0}|{1}|{2}|{3}|{4}|{5}", "me", 0, _exp.exp_cat_id, m_YEAR, _exp.exp_date.Value.Month, m_showType.ToByte());
                    }
                }
                else
                {
                    _cell.Value = (_cell.Value.ToInt32() + _exp.exp_amount);
                    if (_cell.AuxValue == null)
                    {
                        _cell.AuxValue = string.Format("{0}|{1}|{2}|{3}|{4}|{5}", "me", 1, _exp.exp_acc_id, m_YEAR, _exp.exp_date.Value.Month, m_showType.ToByte());
                    }
                    //
                    _cell_parent       = _grid.Rows[_cell.Row.Cells["parent_id"].Text].Cells[_cell.ColIndex];
                    _cell_parent.Value = (_cell_parent.Value.ToInt32() + _exp.exp_amount);
                    if (_cell_parent.AuxValue == null)
                    {
                        _cell_parent.AuxValue = string.Format("{0}|{1}|{2}|{3}|{4}|{5}", "me", _exp.exp_cat_id, _cell_parent.Row.Key.ToInt32(), m_YEAR, _exp.exp_date.Value.Month, m_showType.ToByte());
                    }
                    //
                }
            }
            #region calculate grand_total
            var gnd_tt = from n in _grid.Cols.Cast <iGCol>()
                         where n.Index > 0 & n.Index < 13
                         from c in n.Cells.Cast <iGCell>()
                         where (c.Row.Index < _grid.Rows["gt"].Index & c.Row.Level == 0)
                         & c.Value != null
                         group c by c.ColKey into ngroup
                         select new
            {
                col_key = ngroup.Key,
                xsum    = ngroup.Sum(j => j.Value.ToInt32())
            };
            foreach (var t in gnd_tt)
            {
                _grid.Rows["gt"].Cells[t.col_key].Value = t.xsum;
            }
            #endregion
            #region calculate row totals
            var clist = from n in _grid.Rows.Cast <iGRow>()
                        where !string.IsNullOrEmpty(n.Key)
                        from c in n.Cells.Cast <iGCell>()
                        where (c.ColIndex > 0 & c.ColIndex < 13) & c.Value != null
                        group c by c.RowKey into ngroup
                        select new
            {
                row_key = ngroup.Key,
                xsum    = ngroup.Sum(j => j.Value.ToInt32())
            };
            foreach (var t in clist)
            {
                _grid.Rows[t.row_key].Cells["total"].Value = t.xsum;
            }
            #endregion

            _grid.Cols.AutoWidth();
            _grid.EndUpdate();
            _grid.EndUpdate();
        }