예제 #1
0
        protected void printGrid(Infragistics.Win.UltraWinGrid.UltraGrid grid, string headerText)
        {
            // Associate the print document with the grid & preview dialog here
            // in case we want to change documents for each grid
            _ultraGridPrintDocument.Grid = grid;
            _ultraGridPrintDocument.DefaultPageSettings.Landscape = true;
            _ultraGridPrintDocument.DefaultPageSettings.Color     = false;
            _ultraGridPrintDocument.DocumentName = ErrorMsgs.UserPermissionsCaption;
            //_ultraGridPrintDocument.FitWidthToPages = 2;
            if (grid.Rows.Count > 0)
            {
                _ultraGridPrintDocument.Header.TextLeft =
                    string.Format(PrintHeaderTimeDisplay,
                                  string.Format(PrintHeaderDisplay, headerText, grid.Rows.FilteredInNonGroupByRowCount),
                                  DateTime.Now);
            }
            else
            {
                _ultraGridPrintDocument.Header.TextLeft = headerText;
            }
            _ultraPrintPreviewDialog.Document = _ultraGridPrintDocument;

            // Call ShowDialog to show the print preview dialog.
            _ultraPrintPreviewDialog.ShowDialog();
        }
예제 #2
0
        protected void printGrid(Infragistics.Win.UltraWinGrid.UltraGrid grid)
        {
            // Associate the print document with the grid & preview dialog here
            // in case we want to change documents for each grid
            _ultraGridPrintDocument.Grid = grid;
            _ultraGridPrintDocument.DefaultPageSettings.Landscape = true;
            _ultraGridPrintDocument.DefaultPageSettings.Color     = false;
            _ultraGridPrintDocument.DocumentName = ErrorMsgs.UserPermissionsCaption;
            //_ultraGridPrintDocument.FitWidthToPages = 2;
            if (_dt_activity.Rows.Count > 0)
            {
                _ultraGridPrintDocument.Header.TextLeft =
                    string.Format(PrintHeaderDisplay,
                                  grid.Rows.FilteredInNonGroupByRowCount + " of " + _dt_activity.Rows.Count,
                                  DateTime.Now
                                  );
            }
            else
            {
                _ultraGridPrintDocument.Header.TextLeft = PrintEmptyHeaderDisplay;
            }
            //_ultraGridPrintDocument.Footer.TextCenter =
            //    string.Format("Page {0}",
            //                    _ultraGridPrintDocument.PageNumber,
            //                    _ultraPrintPreviewDialog.pag
            _ultraPrintPreviewDialog.Document = _ultraGridPrintDocument;

            // Call ShowDialog to show the print preview dialog.
            _ultraPrintPreviewDialog.ShowDialog();
        }
예제 #3
0
        protected void saveGrid(Infragistics.Win.UltraWinGrid.UltraGrid grid)
        {
            bool iconHidden = false;

            if (_saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    if (grid == _grid_Servers)
                    {
                        //save the current state of the icon column and then hide it before exporting
                        iconHidden = grid.DisplayLayout.Bands[0].Columns[colIcon].Hidden;
                        grid.DisplayLayout.Bands[0].Columns[colIcon].Hidden = true;
                    }
                    _ultraGridExcelExporter.Export(grid, _saveFileDialog.FileName);
                }
                catch (Exception ex)
                {
                    Utility.MsgBox.ShowError(Utility.ErrorMsgs.ExportToExcelCaption, Utility.ErrorMsgs.FailedToExportToExcelFile, ex);
                }
                if (grid == _grid_Servers)
                {
                    grid.DisplayLayout.Bands[0].Columns[colIcon].Hidden = iconHidden;
                }
            }
        }
예제 #4
0
        public UltraGrid GenerateGrid(string moduleName, Control ctr, Point p)
        {
            Sys_PD_Module module = new Sys_PD_Module();

            module = instModule.GetListByWhere(" and SPM_Module='" + moduleName + "'").ToList()[0];
            //List<Sys_PD_Filed> filedList = new List<Sys_PD_Filed>();
            //filedList = instField.GetListByWhere(" and DCP_ModuleName='" + moduleName + "' order by DCP_Order").ToList();
            GridTagObject gridObj = new GridTagObject();
            gridObj.Module = module;
            gridObj.GridValuePrefix = "";

            UltraGrid ug_list = new Infragistics.Win.UltraWinGrid.UltraGrid();
            ctr.Tag = module;
            ug_list.Location = p;
            ug_list.Name = module.SPM_LPrefix + module.SPM_Module;//grid的技术名称
            ug_list.Tag = gridObj;
            ug_list.Size = new System.Drawing.Size(module.SPM_LX, module.SPM_LY);
            ug_list.Dock = DockStyle.Fill;
            ug_list.Text = module.SPM_Name;

            #region 默认样式初始化
            GridFormater.SetGridStyle(ug_list);
            #endregion

            ug_list.AfterColPosChanged += new AfterColPosChangedEventHandler(ug_list_AfterColPosChanged);
            ug_list.InitializeLayout += new InitializeLayoutEventHandler(ug_list_InitializeLayout);
            ug_list.KeyUp += new KeyEventHandler(ug_list_KeyUp);
            ug_list.CellChange += new CellEventHandler(ug_list_CellChange);
            ug_list.BeforeCellListDropDown += new CancelableCellEventHandler(ug_list_BeforeCellListDropDown);
            ctr.Controls.Add(ug_list);
            return ug_list;
        }
예제 #5
0
        protected void printGrid(Infragistics.Win.UltraWinGrid.UltraGrid grid)
        {
            Debug.Assert(grid.Tag.GetType() == typeof(ToolStripLabel));

            // Associate the print document with the grid & preview dialog here
            // for consistency with other forms that require it
            _ultraGridPrintDocument.Grid = grid;
            _ultraGridPrintDocument.DefaultPageSettings.Color = false;
            _ultraGridPrintDocument.DocumentName = ErrorMsgs.UserPermissionsCaption;
            if (grid == _grid_Servers)
            {
                _ultraGridPrintDocument.Header.TextLeft =
                    string.Format(PrintServersHeaderDisplay,
                                  Program.gController.Repository.Instance,
                                  _label_AuditedServers,
                                  DateTime.Now.ToShortDateString()
                                  );
            }
            else
            {
                _ultraGridPrintDocument.Header.TextLeft =
                    string.Format(PrintDatabasesHeaderDisplay,
                                  m_SelectedServer,
                                  DateTime.Now.ToShortDateString()
                                  );
            }

            _ultraPrintPreviewDialog.Document = _ultraGridPrintDocument;

            // Call ShowDialog to show the print preview dialog.
            _ultraPrintPreviewDialog.ShowDialog();
        }
        protected void saveGrid(Infragistics.Win.UltraWinGrid.UltraGrid grid)
        {
            if (_saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    //display the details column, which is always hidden from the user
                    if (grid.DisplayLayout.Bands[0].Columns.Exists(colSeverityCode))
                    {
                        grid.DisplayLayout.Bands[0].Columns[colSeverityCode].Hidden = false;
                    }

                    grid.DisplayLayout.ValueLists[valueListSeverity].DisplayStyle = ValueListDisplayStyle.DisplayText;

                    _ultraGridExcelExporter.Export(grid, _saveFileDialog.FileName);

                    grid.DisplayLayout.ValueLists[valueListSeverity].DisplayStyle = ValueListDisplayStyle.Picture;
                }
                catch (Exception ex)
                {
                    grid.DisplayLayout.ValueLists[valueListSeverity].DisplayStyle = ValueListDisplayStyle.Picture;

                    MsgBox.ShowError(ErrorMsgs.ExportToExcelCaption, ErrorMsgs.FailedToExportToExcelFile, ex);
                }
                if (grid.DisplayLayout.Bands[0].Columns.Exists(colSeverityCode))
                {
                    grid.DisplayLayout.Bands[0].Columns[colSeverityCode].Hidden = true;
                }
            }
        }
예제 #7
0
        protected void printGrid(Infragistics.Win.UltraWinGrid.UltraGrid grid)
        {
            Debug.Assert(grid.Tag.GetType() == typeof(ToolStripLabel));

            // Associate the print document with the grid & preview dialog here
            // in case we want to change documents for each grid
            _ultraGridPrintDocument.Grid = grid;
            _ultraGridPrintDocument.DefaultPageSettings.Color = false;
            _ultraGridPrintDocument.DocumentName = ErrorMsgs.UserPermissionsCaption;

            if (m_policy != null)
            {
                _ultraGridPrintDocument.Header.TextLeft =
                    string.Format(PrintHeaderDisplay,
                                  m_policy.PolicyName,
                                  DateTime.Now,
                                  ((ToolStripLabel)grid.Tag).Text
                                  );
            }
            else
            {
                _ultraGridPrintDocument.Header.TextLeft =
                    string.Format(PrintEmptyHeaderDisplay,
                                  ((ToolStripLabel)grid.Tag).Text
                                  );
            }
            //_ultraGridPrintDocument.Footer.TextCenter =
            //    string.Format("Page {0}",
            //                    _ultraGridPrintDocument.PageNumber,
            //                    _ultraPrintPreviewDialog.pag
            _ultraPrintPreviewDialog.Document = _ultraGridPrintDocument;

            // Call ShowDialog to show the print preview dialog.
            _ultraPrintPreviewDialog.ShowDialog();
        }
예제 #8
0
        public static void Process(
            Infragistics.Win.UltraWinGrid.UltraGrid grid
            )
        {
            Debug.Assert(grid != null);

            Form_GridColumnChooser form = new Form_GridColumnChooser(grid, string.Empty);

            form.ShowDialog();
        }
예제 #9
0
        protected void showGridColumnChooser(Infragistics.Win.UltraWinGrid.UltraGrid grid)
        {
            // set any column chooser options before showing????
            string gridHeading = ((ToolStripLabel)grid.Tag).Text;

            if (gridHeading.IndexOf("(") > 0)
            {
                gridHeading = gridHeading.Remove(gridHeading.IndexOf("(") - 1);
            }

            Forms.Form_GridColumnChooser.Process(grid, gridHeading);
        }
예제 #10
0
            // the message that will be put in the tooltip
            //private string msg = String.Empty;

            public CustomizedToolTip(Infragistics.Win.UltraWinGrid.UltraGrid dataGrid)
            {
                UltraDataGrid = dataGrid;
                // prevent the grid from showing its own tooltips
                UltraDataGrid.DisplayLayout.Override.TipStyleCell = TipStyle.Hide;

                // set this value to however many milliseconds the tooltip delay should be
                timer.Interval = 500;

                // when the timer ticks we want our method to be called
                timer.Tick += new EventHandler(OnTimerTick);
            }
예제 #11
0
파일: Constant.cs 프로젝트: Strongc/sencond
        public static void RefreshAndAutoSize(Infragistics.Win.UltraWinGrid.UltraGrid grid)
        {
            //grid.DataBind();

            grid.ActiveRow = null;

            foreach (Infragistics.Win.UltraWinGrid.UltraGridColumn ugc in grid.DisplayLayout.Bands[0].Columns)
            {
                ugc.PerformAutoResize(PerformAutoSizeType.AllRowsInBand);
            }

            grid.Refresh();
        }
예제 #12
0
        private static void ActivateFreeForm(IG.UltraGrid grid, IG.UltraGridBand gridBand)
        {
            gridBand.RowLayoutStyle         = IG.RowLayoutStyle.ColumnLayout;
            gridBand.RowLayoutLabelPosition = Infragistics.Win.UltraWinGrid.LabelPosition.Left;
            gridBand.RowLayoutLabelStyle    = Infragistics.Win.UltraWinGrid.RowLayoutLabelStyle.WithCellData;

            //gridband override
            gridBand.Override.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.None;

            //grid layout
            grid.DisplayLayout.UseScrollWindow = IG.UseScrollWindow.Both;

            grid.DisplayLayout.MaxBandDepth       = 1;
            grid.DisplayLayout.NewBandLoadStyle   = IG.NewBandLoadStyle.Hide;
            grid.DisplayLayout.NewColumnLoadStyle = IG.NewColumnLoadStyle.Hide;
            grid.DisplayLayout.RowConnectorStyle  = IG.RowConnectorStyle.None;
            grid.DisplayLayout.BorderStyle        = Infragistics.Win.UIElementBorderStyle.None;
            //MAF: u freeform mame problemy s vertikalni  scrollbarou, proto vypnu scrolovani a zapnu rucni layoutovani (v evente OnLayout)
            //grid.DisplayLayout.ScrollStyle = Infragistics.Win.UltraWinGrid.ScrollStyle.Immediate;
            //grid.DisplayLayout.ScrollBounds = Infragistics.Win.UltraWinGrid.ScrollBounds.ScrollToFill;
            grid.DisplayLayout.Scrollbars = IG.Scrollbars.None; //Scrollbars.Automatic;

            //layout override
            grid.DisplayLayout.Override.CellPadding       = 0;
            grid.DisplayLayout.Override.CellSpacing       = 1;
            grid.DisplayLayout.Override.BorderStyleHeader = Infragistics.Win.UIElementBorderStyle.None;
            grid.DisplayLayout.Override.HeaderStyle       = Infragistics.Win.HeaderStyle.XPThemed; //podpora pro hezke zobrazeni tlacitek na WinXP
            grid.DisplayLayout.Override.HeaderAppearance  = new Infragistics.Win.Appearance()
            {
            };
            //grid.DisplayLayout.Override.BorderStyleCell = UIElementBorderStyle.Dotted;
            grid.DisplayLayout.Override.RowSelectors   = Infragistics.Win.DefaultableBoolean.False;
            grid.DisplayLayout.Override.AllowColMoving = IG.AllowColMoving.NotAllowed;
            //grid.DisplayLayout.Override.AllowColSizing = AllowColSizing.None;
            grid.DisplayLayout.Override.AllowColSwapping = IG.AllowColSwapping.NotAllowed;
            grid.DisplayLayout.Override.AllowAddNew      = IG.AllowAddNew.No;

            grid.DisplayLayout.Override.CellAppearance = new Infragistics.Win.Appearance()
            {
            };
            grid.DisplayLayout.Override.CellClickAction        = Infragistics.Win.UltraWinGrid.CellClickAction.EditAndSelectText; // Infragistics.Win.UltraWinGrid.CellClickAction.CellSelect
            grid.DisplayLayout.Override.SelectedCellAppearance = new Infragistics.Win.Appearance()
            {
            };

            grid.DisplayLayout.Override.AllowMultiCellOperations = Infragistics.Win.UltraWinGrid.AllowMultiCellOperation.Copy; //dch 3.8.2006 - umozni kopirovat data z formulare
            // grid.DisplayLayout.Override.AllowMultiCellOperations = AllowMultiCellOperation.None;

            // JR 23891 - freeform nebude mit trideni na click na header
            grid.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.Select;
        }
예제 #13
0
 protected void saveGrid(Infragistics.Win.UltraWinGrid.UltraGrid grid)
 {
     if (_saveFileDialog.ShowDialog() == DialogResult.OK)
     {
         try
         {
             _ultraGridExcelExporter.Export(grid, _saveFileDialog.FileName);
         }
         catch (Exception ex)
         {
             Utility.MsgBox.ShowError(Utility.ErrorMsgs.ExportToExcelCaption, Utility.ErrorMsgs.FailedToExportToExcelFile, ex);
         }
     }
 }
예제 #14
0
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance();
			this.ultraGrid1 = new Infragistics.Win.UltraWinGrid.UltraGrid();
			this.ultraLabel1 = new Infragistics.Win.Misc.UltraLabel();
			((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).BeginInit();
			this.SuspendLayout();
			// 
			// ultraGrid1
			// 
			this.ultraGrid1.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right);
			this.ultraGrid1.Location = new System.Drawing.Point(8, 64);
			this.ultraGrid1.Name = "ultraGrid1";
			this.ultraGrid1.Size = new System.Drawing.Size(520, 200);
			this.ultraGrid1.TabIndex = 0;
			this.ultraGrid1.Text = "ultraGrid1";
			this.ultraGrid1.InitializeLayout += new Infragistics.Win.UltraWinGrid.InitializeLayoutEventHandler(this.ultraGrid1_InitializeLayout);
			// 
			// ultraLabel1
			// 
			this.ultraLabel1.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right);
			appearance1.BackColor = System.Drawing.Color.White;
			appearance1.BackColor2 = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(255)), ((System.Byte)(255)));
			appearance1.BackGradientStyle = Infragistics.Win.GradientStyle.Vertical;
			this.ultraLabel1.Appearance = appearance1;
			this.ultraLabel1.Location = new System.Drawing.Point(8, 8);
			this.ultraLabel1.Name = "ultraLabel1";
			this.ultraLabel1.Size = new System.Drawing.Size(520, 56);
			this.ultraLabel1.TabIndex = 1;
			this.ultraLabel1.Text = @"Click a column header to sort the grid. Give the grid focus, but make sure the grid is not in edit mode. If a cell is in edit mode, press F2 to exit edit mode. Then type the characters of the text you want to find. The grid will select the row that matches what you type. The search is performed on the current sorted column. Click a column header to sort by a different column and then type to search that column.";
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(536, 270);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.ultraLabel1,
																		  this.ultraGrid1});
			this.Name = "Form1";
			this.Text = "Keyboard Searching in WinGrid";
			this.Load += new System.EventHandler(this.Form1_Load);
			this.Closed += new System.EventHandler(this.Form1_Closed);
			((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).EndInit();
			this.ResumeLayout(false);

		}
예제 #15
0
        /*
         *
         * Para crear una Queue que almacene valores
         * Qs es una Clase Chromosome
         *
         * Queue q = new Queue();
         * q.Enqueue(Qs);
         */

        /*
         *
         *      int[,] x = new int[2, 3];
         *      x[0, 1] = 88;
         *      x[1, 0] = 55;
         *      x[1, 2] = 97;
         *
         *           0   1   2
         *         _____________
         *      0 |     88   -
         *      1 | 55   -  97
         |_____________
         *
         *      foreach(int i in x)
         *      {
         *          MessageBox.Show(i.ToString());
         *      }
         *
         */

        public void ExcelExport(Infragistics.Win.UltraWinGrid.UltraGrid Grid)
        {
            Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter Export = new Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter();
            SaveFileDialog Save = new SaveFileDialog();

            Save.Filter = "Excel File (.xlsx) |*.xlsx|Excel File 97-2003 (.xls)|*.xls";
            Save.Title  = "Save The QueueService File";
            Save.ShowDialog();

            if (Save.FileName != "")
            {
                Export.Export(Grid, Save.FileName);
                MessageBox.Show("Excel File was exported successfully!");
            }
        }
예제 #16
0
        private void ugvDatos_KeyPress(object sender, KeyPressEventArgs e)
        {
            Infragistics.Win.UltraWinGrid.UltraGrid grid = (sender as Infragistics.Win.UltraWinGrid.UltraGrid);

            Infragistics.Win.UltraWinGrid.UltraGridCell activeCell = grid == null ? null : grid.ActiveCell;

            // if there is an active cell, its not in edit mode and can enter edit mode
            if (null != activeCell && false == activeCell.IsInEditMode && activeCell.CanEnterEditMode)
            {
                // if the character is not a control character
                if (char.IsControl(e.KeyChar) == false)
                {
                    // try to put cell into edit mode
                    grid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);

                    // if this cell is still active and it is in edit mode...
                    if (grid.ActiveCell == activeCell && activeCell.IsInEditMode)
                    {
                        // get its editor
                        Infragistics.Win.EmbeddableEditorBase editor = grid.ActiveCell.EditorResolved;

                        // if the editor supports selectable text
                        if (editor.SupportsSelectableText)
                        {
                            // select all the text so it can be replaced
                            editor.SelectionStart  = 0;
                            editor.SelectionLength = editor.TextLength;

                            if (editor is Infragistics.Win.EditorWithMask)
                            {
                                // just clear the selected text and let the grid
                                // forward the keypress to the editor
                                editor.SelectedText = string.Empty;
                            }
                            else
                            {
                                // then replace the selected text with the character
                                editor.SelectedText = new string(e.KeyChar, 1);

                                // mark the event as handled so the grid doesn't process it
                                e.Handled = true;
                            }
                        }
                    }
                }
            }
        }
        protected void printGrid(Infragistics.Win.UltraWinGrid.UltraGrid grid)
        {
            // Associate the print document with the grid & preview dialog here
            // for consistency with other forms that require it
            _ultraGridPrintDocument.Grid = grid;
            _ultraGridPrintDocument.DefaultPageSettings.Landscape = true;
            _ultraGridPrintDocument.DefaultPageSettings.Color     = false;
            _ultraGridPrintDocument.DocumentName    = PrintTitle;
            _ultraGridPrintDocument.FitWidthToPages = 1;

            Policy policy = Program.gController.Repository.Policies.Find(m_PolicyId);

            if (policy.AssessmentId != m_AssessmentId && policy.HasAssessment(m_AssessmentId))
            {
                policy = policy.Assessments.Find(m_AssessmentId);
            }

            PolicyMetric check = null;

            foreach (PolicyMetric metric in policy.GetPolicyMetrics())
            {
                if (metric.MetricId == m_MetricId)
                {
                    check = metric;
                    break;
                }
            }

            if (policy != null && check != null)
            {
                _ultraGridPrintDocument.Header.TextLeft =
                    string.Format(PrintHeaderDisplay,
                                  policy.PolicyAssessmentName,
                                  check.MetricName,
                                  DateTime.Now.ToShortDateString()
                                  );
                _ultraPrintPreviewDialog.Document = _ultraGridPrintDocument;

                // Call ShowDialog to show the print preview dialog.
                _ultraPrintPreviewDialog.ShowDialog();
            }
            else
            {
                logX.loggerX.Error(string.Format(Utility.ErrorMsgs.ErrorStub, Utility.ErrorMsgs.CantGetPolicy));
                MsgBox.ShowError(Utility.ErrorMsgs.PolicyCaption, Utility.ErrorMsgs.CantGetPolicy);
            }
        }
예제 #18
0
 /****************************************************************************************************
 * NAME         : call_uGrid_IsInEditMode                                                           *
 * DESCRIPTION  : Call the Trigger for Raise the ExitEditMode Event.                                *
 * WRITTEN BY   : RajaSekar J                                                                       *
 * DATE         : 15Feb2018                                                                           *
 ****************************************************************************************************/
 private void call_uGrid_IsInEditMode(IWUG.UltraGrid uGrid)
 {
     try
     {
         if (uGrid.ActiveCell != null)
         {
             if (uGrid.ActiveCell.IsInEditMode)
             {
                 uGrid.PerformAction(IWIN.UltraWinGrid.UltraGridAction.ExitEditMode);
             }
         }
     }
     catch (Exception ex)
     {
         string str = ex.Message;
     }
 }
예제 #19
0
        private void ugvDatos_KeyDown(object sender, KeyEventArgs e)
        {
            Infragistics.Win.UltraWinGrid.UltraGrid dgvDatos = (sender as Infragistics.Win.UltraWinGrid.UltraGrid);
            switch (e.KeyCode)
            {
            case Keys.Up:
                dgvDatos.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.ExitEditMode, false,
                                       false);
                dgvDatos.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.AboveCell, false,
                                       false);
                e.Handled = true;
                dgvDatos.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false,
                                       false);
                break;

            case Keys.Down:
                dgvDatos.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.ExitEditMode, false,
                                       false);
                dgvDatos.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.BelowCell, false,
                                       false);
                e.Handled = true;
                dgvDatos.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false,
                                       false);
                break;

            case Keys.Right:
                dgvDatos.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.ExitEditMode, false,
                                       false);
                dgvDatos.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.NextCellByTab, false,
                                       false);
                e.Handled = true;
                dgvDatos.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false,
                                       false);
                break;

            case Keys.Left:
                dgvDatos.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.ExitEditMode, false,
                                       false);
                dgvDatos.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.PrevCellByTab, false,
                                       false);
                e.Handled = true;
                dgvDatos.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode, false,
                                       false);
                break;
            }
        }
예제 #20
0
        public static void RefreshAndAutoSize(Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid)
        {
            try
            {
                ultraGrid.DataBind();

                foreach (UltraGridBand band in ultraGrid.DisplayLayout.Bands)
                {
                    foreach (UltraGridColumn column in ultraGrid.DisplayLayout.Bands[band.Key].Columns)
                    {
                        column.PerformAutoResize(PerformAutoSizeType.AllRowsInBand);
                    }
                }

                ultraGrid.Refresh();
            }
            catch { }
        }
예제 #21
0
        private Form_GridColumnChooser(
            Infragistics.Win.UltraWinGrid.UltraGrid grid,
            string header
            )
        {
            InitializeComponent();

            _ultraGridColumnChooser.SourceGrid = grid;

            if (!string.IsNullOrEmpty(header))
            {
                Text = header;
            }
            else
            {
                Text = "Select Columns";
            }
        }
예제 #22
0
        protected void printGrid(Infragistics.Win.UltraWinGrid.UltraGrid grid)
        {
            // Associate the print document with the grid & preview dialog here
            // for consistency with other forms that require it
            _ultraGridPrintDocument.Grid = grid;
            _ultraGridPrintDocument.DefaultPageSettings.Landscape = true;
            _ultraGridPrintDocument.DefaultPageSettings.Color     = false;
            _ultraGridPrintDocument.DocumentName    = PrintTitle;
            _ultraGridPrintDocument.FitWidthToPages = 1;
            _ultraGridPrintDocument.Header.TextLeft =
                string.Format(PrintHeaderDisplay,
                              DateTime.Now.ToShortDateString()
                              );
            _ultraPrintPreviewDialog.Document = _ultraGridPrintDocument;

            // Call ShowDialog to show the print preview dialog.
            _ultraPrintPreviewDialog.ShowDialog();
        }
예제 #23
0
 private void InitializeComponent()
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmDDPregleDGodina));
     this.UltraGrid1   = new Infragistics.Win.UltraWinGrid.UltraGrid();
     this.UltraButton1 = new Infragistics.Win.Misc.UltraButton();
     ((System.ComponentModel.ISupportInitialize)(this.UltraGrid1)).BeginInit();
     this.SuspendLayout();
     //
     // UltraGrid1
     //
     this.UltraGrid1.Dock              = System.Windows.Forms.DockStyle.Bottom;
     this.UltraGrid1.Location          = new System.Drawing.Point(0, 49);
     this.UltraGrid1.Name              = "UltraGrid1";
     this.UltraGrid1.Size              = new System.Drawing.Size(212, 568);
     this.UltraGrid1.TabIndex          = 1;
     this.UltraGrid1.InitializeLayout += new Infragistics.Win.UltraWinGrid.InitializeLayoutEventHandler(this.UltraGrid1_InitializeLayout);
     this.UltraGrid1.DoubleClickRow   += new Infragistics.Win.UltraWinGrid.DoubleClickRowEventHandler(this.UltraGrid1_DoubleClickRow);
     //
     // UltraButton1
     //
     this.UltraButton1.Location = new System.Drawing.Point(39, 12);
     this.UltraButton1.Name     = "UltraButton1";
     this.UltraButton1.Size     = new System.Drawing.Size(123, 23);
     this.UltraButton1.TabIndex = 0;
     this.UltraButton1.Text     = "Odaberi";
     this.UltraButton1.Click   += new System.EventHandler(this.UltraButton1_Click);
     //
     // frmDDPregleDGodina
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize          = new System.Drawing.Size(212, 617);
     this.Controls.Add(this.UltraButton1);
     this.Controls.Add(this.UltraGrid1);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
     this.Icon            = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.MaximizeBox     = false;
     this.MinimizeBox     = false;
     this.Name            = "frmDDPregleDGodina";
     this.StartPosition   = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.Text            = "Mjeseci i godine isplate";
     ((System.ComponentModel.ISupportInitialize)(this.UltraGrid1)).EndInit();
     this.ResumeLayout(false);
 }
예제 #24
0
        protected void printGrid(Infragistics.Win.UltraWinGrid.UltraGrid grid)
        {
            // Associate the print document with the grid & preview dialog here
            // for consistency with other forms that require it
            _ultraGridPrintDocument.Grid = grid;
            _ultraGridPrintDocument.DefaultPageSettings.Landscape = true;
            _ultraGridPrintDocument.DefaultPageSettings.Color     = false;
            _ultraGridPrintDocument.DocumentName    = PrintTitle;
            _ultraGridPrintDocument.FitWidthToPages = 1;
            _ultraGridPrintDocument.Header.TextLeft =
                string.Format(PrintHeaderDisplay,
                              m_UseBaseline ? @"baseline " : string.Empty,
                              m_SelectDate.ToLocalTime().ToString(Constants.DATETIME_FORMAT)
                              );
            _ultraPrintPreviewDialog.Document = _ultraGridPrintDocument;

            // Call ShowDialog to show the print preview dialog.
            _ultraPrintPreviewDialog.ShowDialog();
        }
예제 #25
0
        protected void saveGrid(Infragistics.Win.UltraWinGrid.UltraGrid grid)
        {
            if (_saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    //fix the enabled checkboxes to export as values
                    grid.DisplayLayout.Bands[0].Columns[Utility.Constants.POLICY_METRIC_COLUMN_IS_ENABLED].ValueList = grid.DisplayLayout.ValueLists[Utility.Constants.POLICY_METRIC_VALUE_LIST_ENABLED];

                    _ultraGridExcelExporter.Export(grid, _saveFileDialog.FileName);

                    grid.DisplayLayout.Bands[0].Columns[Utility.Constants.POLICY_METRIC_COLUMN_IS_ENABLED].ValueList = null;
                }
                catch (Exception ex)
                {
                    Utility.MsgBox.ShowError(Utility.ErrorMsgs.ExportToExcelCaption, Utility.ErrorMsgs.FailedToExportToExcelFile, ex);
                }
            }
        }
예제 #26
0
        protected void printGrid(Infragistics.Win.UltraWinGrid.UltraGrid grid)
        {
            // Associate the print document with the grid & preview dialog here
            // for consistency with other forms that require it
            _ultraGridPrintDocument.Grid = grid;
            _ultraGridPrintDocument.DefaultPageSettings.Landscape = true;
            _ultraGridPrintDocument.DefaultPageSettings.Color     = false;
            _ultraGridPrintDocument.DocumentName    = Utility.Constants.POLICY_METRIC_PROPERTIES_PRINT_TITLE;
            _ultraGridPrintDocument.FitWidthToPages = 1;
            _ultraGridPrintDocument.Header.TextLeft =
                string.Format(Utility.Constants.POLICY_METRIC_PROPERTIES_PRINT_HEADER_DISPLAY,
                              m_policy.PolicyAssessmentName,
                              DateTime.Now.ToShortDateString()
                              );
            _ultraPrintPreviewDialog.Document = _ultraGridPrintDocument;

            // Call ShowDialog to show the print preview dialog.
            _ultraPrintPreviewDialog.ShowDialog();
        }
예제 #27
0
파일: Constant.cs 프로젝트: Strongc/sencond
        public static void ExportGrid2Excel(System.Windows.Forms.Form Form,
                                            Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter ExcelExporter,
                                            Infragistics.Win.UltraWinGrid.UltraGrid Grid)
        {
            Cursor oldCursor = Form.Cursor;

            Form.Cursor = Cursors.WaitCursor;

            if (Constant.WaitingForm == null)
            {
                Constant.WaitingForm = new WaitingForm();
            }

            Constant.WaitingForm.ShowToUser = true;
            Constant.WaitingForm.Show();
            Constant.WaitingForm.Update();

            try
            {
                if (!System.IO.Directory.Exists(System.Environment.CurrentDirectory + "\\temp"))
                {
                    System.IO.Directory.CreateDirectory(System.Environment.CurrentDirectory + "\\temp");
                }

                string StrfileName = string.Format(System.Environment.CurrentDirectory + "\\temp\\" + Form.Text + ".xls");
                ExcelExporter.Export(Grid, StrfileName);

                ProcessStartInfo p = new ProcessStartInfo(StrfileName);
                p.WorkingDirectory = Path.GetDirectoryName(StrfileName);
                Process.Start(p);

                Form.Cursor = oldCursor;
                Constant.WaitingForm.ShowToUser = false;
                Constant.WaitingForm.Close();
            }
            catch (Exception ex)
            {
                Form.Cursor = oldCursor;
                Constant.WaitingForm.ShowToUser = false;
                Constant.WaitingForm.Close();
                MessageBox.Show(ex.Message);
            }
        }
예제 #28
0
 private void SetActiveRow(Infragistics.Win.UltraWinGrid.UltraGrid grid, string policyName)
 {
     if (!string.IsNullOrEmpty(policyName))
     {
         Infragistics.Win.UltraWinGrid.RowsCollection sr = grid.Rows;
         if (sr.Count > 0)
         {
             foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in sr)
             {
                 row.Selected = false;
                 if (row.Cells[colHeaderName].Text == policyName)
                 {
                     row.Selected   = true;
                     grid.ActiveRow = row;
                 }
             }
         }
     }
 }
예제 #29
0
    /// <summary>
    ///     Método responsável por verificar se há alguma coluna na seção 'GroupByBox'.
    /// </summary>
    /// <param name="UltraGrid">UltraDataGridView que terá a ordenação das colunas limpa.</param>
    /// <remarks>Link de ajuda: http://help.infragistics.com/Help/Doc/WinForms/2011.2/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v11.2~Infragistics.Win.UltraWinGrid.UltraGridColumn~IsGroupByColumn.html</remarks>
    /// <returns>True caso houve alguma coluna na seção 'GroupByBox'</returns>
    public static Boolean GridPossuiAgrupamento(Infragistics.Win.UltraWinGrid.UltraGrid UltraGrid)
    {
        try
        {
            Infragistics.Win.UltraWinGrid.UltraGridBand band = UltraGrid.DisplayLayout.Bands[0];

            for (int i = 0; i < band.Columns.Count; i++)
            {
                ////Adicionei a condição para ser mais rápido, onde, irei considerar apenas as colunas visíveis.
                //if (!band.Columns[i].Hidden) continue;

                if (band.Columns[i].IsGroupByColumn)
                {
                    return(true);
                }
            }
            return(false);
        }
        catch { return(false); }
    }
예제 #30
0
        // Make right click select row.
        // Also, make clicking off of an element clear selected row
        //  unless clicking on header or scroll bars
        // --------------------------------------------------------
        private void _grid_MouseDown(object sender, MouseEventArgs e)
        {
            Infragistics.Win.UIElement elementMain;
            Infragistics.Win.UIElement elementUnderMouse;
            Infragistics.Win.UltraWinGrid.UltraGrid grid = (Infragistics.Win.UltraWinGrid.UltraGrid)sender;

            elementMain = grid.DisplayLayout.UIElement;

            elementUnderMouse = elementMain.ElementFromPoint(new Point(e.X, e.Y));
            if (elementUnderMouse != null)
            {
                Infragistics.Win.UltraWinGrid.UltraGridCell cell = elementUnderMouse.GetContext(typeof(Infragistics.Win.UltraWinGrid.UltraGridCell)) as Infragistics.Win.UltraWinGrid.UltraGridCell;
                if (cell != null)
                {
                    m_gridCellClicked = true;
                    if (!cell.Row.Selected)
                    {
                        if (e.Button == MouseButtons.Right)
                        {
                            grid.Selected.Rows.Clear();
                            cell.Row.Selected = true;
                            grid.ActiveRow    = cell.Row;
                        }
                    }
                }
                else
                {
                    m_gridCellClicked = false;
                    Infragistics.Win.UltraWinGrid.HeaderUIElement       he = elementUnderMouse.GetAncestor(typeof(Infragistics.Win.UltraWinGrid.HeaderUIElement)) as Infragistics.Win.UltraWinGrid.HeaderUIElement;
                    Infragistics.Win.UltraWinGrid.ColScrollbarUIElement ce = elementUnderMouse.GetAncestor(typeof(Infragistics.Win.UltraWinGrid.ColScrollbarUIElement)) as Infragistics.Win.UltraWinGrid.ColScrollbarUIElement;
                    Infragistics.Win.UltraWinGrid.RowScrollbarUIElement re = elementUnderMouse.GetAncestor(typeof(Infragistics.Win.UltraWinGrid.RowScrollbarUIElement)) as Infragistics.Win.UltraWinGrid.RowScrollbarUIElement;
                    if (he == null && ce == null && re == null)
                    {
                        grid.Selected.Rows.Clear();
                        grid.ActiveRow = null;
                    }
                }
            }

            setMenuConfiguration();
        }
예제 #31
0
        public void ExcelExport(Infragistics.Win.UltraWinGrid.UltraGrid Grid, string FileName)
        {
            try
            {
                Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter Export = new Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter();
                SaveFileDialog Save = new SaveFileDialog();

                Save.Filter   = "Excel File (.xlsx) |*.xlsx|Excel File 97-2003 (.xls)|*.xls";
                Save.Title    = "Save The QueueService File";
                Save.FileName = FileName;

                if (Save.ShowDialog() == DialogResult.OK)
                {
                    Export.Export(Grid, Save.FileName);
                    MessageBox.Show("Excel File was exported successfully!", "Excel File Exportation", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #32
0
        protected void saveGrid(Infragistics.Win.UltraWinGrid.UltraGrid grid)
        {
            //bool iconHidden = false;
            if (_saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    ////save the current state of the icon column and then hide it before exporting
                    //if (grid.DisplayLayout.Bands[0].Columns.Exists(colIcon))
                    //{
                    //    // this column doesn't exist in the raw data hack
                    //    iconHidden = grid.DisplayLayout.Bands[0].Columns[colIcon].Hidden;
                    //    grid.DisplayLayout.Bands[0].Columns[colIcon].Hidden = true;
                    //    // Fix the sub list display on the effective grid
                    //    if (grid.DisplayLayout.Bands.Count > 1
                    //        && grid.DisplayLayout.Bands[1].Columns.Exists(colIcon))
                    //    {
                    //        grid.DisplayLayout.Bands[1].Columns[colIcon].Hidden = true;
                    //    }
                    //}

                    _ultraGridExcelExporter.Export(grid, _saveFileDialog.FileName);
                }
                catch (Exception ex)
                {
                    MsgBox.ShowError(ErrorMsgs.ExportToExcelCaption, ErrorMsgs.FailedToExportToExcelFile, ex);
                }
                //if (grid.DisplayLayout.Bands[0].Columns.Exists(colIcon))
                //{
                //    // this column doesn't exist in the raw data hack
                //    grid.DisplayLayout.Bands[0].Columns[colIcon].Hidden = iconHidden;
                //}
                //// Fix the sub list display on the effective grid
                //if (grid.DisplayLayout.Bands.Count > 1
                //    && grid.DisplayLayout.Bands[1].Columns.Exists(colIcon))
                //{
                //    grid.DisplayLayout.Bands[1].Columns[colIcon].Hidden = iconHidden;
                //}
            }
        }