Пример #1
0
        /// <summary>
        /// Renders ProgressBar bugs
        /// </summary>
        /// <param name="e"></param>
        private void RenderProgressBugs(GridPostRenderCellEventArgs e)
        {
            if ((e.RenderParts & RenderParts.Content) == RenderParts.Content)
            {
                GridProgressBarXEditControl pbx =
                    e.GridCell.GridColumn.EditControl as GridProgressBarXEditControl;

                if (pbx != null)
                {
                    using (Image image =
                               ShellServices.LoadBitmap("SuperGridDemo.Resources.BugRight.png"))
                    {
                        if (image != null)
                        {
                            Rectangle r = e.Bounds;
                            r.Inflate(-3, -3);

                            r.Y   += ((e.Bounds.Height - image.Height) / 2) - 2;
                            r.Size = image.Size;

                            int value = (int)e.GridCell.Value;
                            int n     = (int)(e.Bounds.Width * ((float)value / pbx.Maximum));
                            int count = n / image.Width;

                            for (int i = 0; i < count; i++)
                            {
                                e.Graphics.DrawImage(image, r);

                                r.X += image.Width;
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Handles the TreeButton check changes
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CbxTreeButtonsCheckedChanged(object sender, EventArgs e)
        {
            GridPanel panel = superGridControl1.PrimaryGrid;

            if (cbxTreeButtons.Checked == true)
            {
                // Change the expand and collapse images to little red bugs

                panel.ExpandImage   = ShellServices.LoadBitmap("SuperGridDemo.Resources.BugUp.png");
                panel.CollapseImage = ShellServices.LoadBitmap("SuperGridDemo.Resources.BugRight.png");
            }
            else
            {
                // Reset the expand and collapse images

                Image image = panel.ExpandImage;
                if (image != null)
                {
                    panel.ExpandImage = null;
                    image.Dispose();
                }

                image = panel.CollapseImage;
                if (image != null)
                {
                    panel.CollapseImage = null;
                    image.Dispose();
                }
            }
        }
        /// <summary>
        /// Populates the grid container
        /// with the contents of a given directory.
        /// </summary>
        /// <param name="path">Directory path</param>
        /// <param name="row">Container to add the entries into</param>
        private void PopulateDirectoryRows(string path, GridContainer row)
        {
            string[] directories = new string[] { };

            try
            {
                // Get the directory entries

                directories = Directory.GetDirectories(path);
            }
            catch
            {
            }

            // Add each non-hidden, non-system directories into the container

            if (directories.Length > 100)
            {
                Cursor = Cursors.AppStarting;
            }

            foreach (string directory in directories)
            {
                DirectoryInfo info = new DirectoryInfo(directory);

                if ((info.Attributes & (FileAttributes.Hidden | FileAttributes.System)) == 0)
                {
                    // Allocate a new GridRow for the directory entry, with
                    // the first cell allocated and set to the directory name

                    GridRow frow = new GridRow(info.Name);

                    // Let it's row height auto-size

                    frow.RowHeight = 0;

                    // Tell the grid that the row might have nested rows
                    // under it, which we will determine if / when the user
                    // clicks on the row's expand button

                    frow.RowsUnresolved = true;

                    // Set the Tag value to the directory, so we can use it later
                    // to resolve and potentially load any discovered entries

                    frow.Tag = directory;

                    // Set the cell image to the directory icon

                    frow.Cells[0].CellStyles.Default.Image =
                        ShellServices.GetFileImage(directory, false, false);

                    // Add the row to the container

                    row.Rows.Add(frow);
                }
            }
        }
        public DemoGridArchitecture()
        {
            InitializeComponent();

            // Set the sample description text

            ShellServices.LoadRtbText(richTextBox1,
                                      "SuperGridDemo.Resources.DemoArchitecture.rtf");
        }
Пример #5
0
        public Form1()
        {
            InitializeComponent();

            InitializeGrid();

            ShellServices.LoadRtbText(rtb,
                                      "SuperGridDemo.Resources.Welcome.rtf");
        }
Пример #6
0
        public DemoGridBasics0()
        {
            InitializeComponent();

            // Initialize the grid and set the sample description text

            InitializeGrid();

            ShellServices.LoadRtbText(richTextBox1,
                                      "SuperGridDemo.Resources.DemoBasics0.rtf");
        }
        public DemoFileExplorer()
        {
            InitializeComponent();

            // Initialize our grid and
            // set the sample description text

            InitializeGrid();

            ShellServices.LoadRtbText(richTextBox1,
                                      "SuperGridDemo.Resources.DemoFileExplorer.rtf");
        }
Пример #8
0
        public DemoGridBinding()
        {
            InitializeComponent();

            // Initialize the grid, selected comboBox
            // Data Source, and the sample description text.

            InitializeGrid();

            ShellServices.LoadRtbText(richTextBox1,
                                      "SuperGridDemo.Resources.DemoGridBinding.rtf");
        }
Пример #9
0
        public DemoUserEdit()
        {
            InitializeComponent();

            // Initialize the grid, ComboBoxes,
            // Audio Clip, etc, and set the sample description text.

            InitializeGrid();

            ShellServices.LoadRtbText(richTextBox1,
                                      "SuperGridDemo.Resources.DemoUserEdit.rtf");
        }
Пример #10
0
        /// <summary>
        /// Populates the given container with files from
        /// the given directory path.
        /// </summary>
        /// <param name="path">Directory path</param>
        /// <param name="row">Container to add files into</param>
        private void PopulateDirectoryFiles(string path, GridContainer row)
        {
            string[] files = new string[] { };

            try
            {
                // Get the directory files

                files = Directory.GetFiles(path);
            }
            catch
            {
            }

            // Add each non-hidden, non-system file
            // into the container

            if (files.Length > 100)
            {
                Cursor = Cursors.AppStarting;
            }

            foreach (string file in files)
            {
                FileInfo info = new FileInfo(file);

                if ((info.Attributes & (FileAttributes.Hidden | FileAttributes.System)) == 0)
                {
                    // Allocate a GridRow, with the first cell contents
                    // being allocated and set to the file's name

                    GridRow frow = new GridRow(info.Name);

                    // Let the row height auto-size

                    frow.RowHeight = 0;

                    // Save the file path for future use

                    frow.Tag = file;

                    // Set the cell image to the file icon

                    frow.Cells[0].CellStyles.Default.Image =
                        ShellServices.GetFileImage(file, false, false);

                    // Add the file to the container

                    row.Rows.Add(frow);
                }
            }
        }
Пример #11
0
        public DemoSpreadsheet()
        {
            InitializeComponent();

            // Initialize the grid, color pickers,
            // and set the sample description text

            InitializeGrid();
            InitColorPickers();

            ShellServices.LoadRtbText(richTextBox1,
                                      "SuperGridDemo.Resources.DemoSpreadsheet.rtf");
        }
Пример #12
0
        public DemoGridBasics2()
        {
            InitializeComponent();

            // Initialize the grid, SortLevel
            // ComboBox, and the sample description text.

            InitializeGrid();
            InitSortLevelComboBox();

            ShellServices.LoadRtbText(richTextBox1,
                                      "SuperGridDemo.Resources.DemoBasics2.rtf");
        }
        public DemoExtendedFiltering()
        {
            InitializeComponent();

            // Initialize base form controls and the grid
            // and then set the sample description text

            InitControls();
            InitializeGrid();

            ShellServices.LoadRtbText(richTextBox1,
                                      "SuperGridDemo.Resources.DemoExtendedFiltering.rtf");
        }
Пример #14
0
        public DemoMasterDetail()
        {
            InitializeComponent();

            // Initialize the grid, bind to our grid data
            // and set the sample description text

            InitializeGrid();
            BindCustomerData();

            ShellServices.LoadRtbText(richTextBox1,
                                      "SuperGridDemo.Resources.DemoMasterDetail.rtf");
        }
Пример #15
0
        /// <summary>
        /// Populates the grid with the current
        /// discoverable system drives
        /// </summary>
        private void PopulateDriveRows()
        {
            GridPanel panel = superGridControl1.PrimaryGrid;

            foreach (DriveInfo drive in DriveInfo.GetDrives())
            {
                if (drive.DriveType == DriveType.Fixed)
                {
                    // Allocate a new GridRow for the drive, with the
                    // first cell allocated and set to the drive name.

                    GridRow drow = new GridRow(drive.Name);

                    // Let the height auto-size

                    drow.RowHeight = 0;

                    // The RowsUnresolved property is a convenient mechanism
                    // to tell the grid that the row may have nested rows, but
                    // that fact has not yet been determined.
                    //
                    // Later, when the user clicks on the row's expand button, the
                    // application then can then resolve the row state by doing 2 things:
                    //
                    // 1 - Clear the RowsUnresolved property (as, whether there are nested
                    //     rows or not) it is now resolved.
                    //
                    // 2 - Determine whether there are in fact any nested rows or
                    //     not and load them into the grid if there are.

                    drow.RowsUnresolved = true;

                    // Save the root directory path for use later if
                    // the user clicks on the expand button

                    drow.Tag = drive.RootDirectory.FullName;

                    // Set the cell image to the drive icon

                    drow.Cells[0].CellStyles.Default.Image =
                        ShellServices.GetFileImage(drive.Name, true, false);

                    // Add the row to the panel

                    panel.Rows.Add(drow);
                }
            }
        }
Пример #16
0
        public DemoDragDrop()
        {
            InitializeComponent();

            // Initialize the grid and
            // set the sample description text

            InitializeGrid();
            InitializeListBox();
            InitializeTreeView();
            InitializeAdvTree();

            ShellServices.LoadRtbText(richTextBox1,
                                      "SuperGridDemo.Resources.DemoDragDrop.rtf");

            superGridControl1.ItemDrag += SuperGridControlItemDrag;
        }
Пример #17
0
            /// <summary>
            /// Handles user "play clip" button clicks
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            protected override void BtnPlayClick(object sender, EventArgs e)
            {
                // Play the audio clip

                if (EditorCell.Value != null)
                {
                    using (Stream stream = (Stream)
                                           ShellServices.GetResource("SuperGridDemo.Resources." + EditorCell.Value + ".wav"))
                    {
                        if (stream != null)
                        {
                            if (_Sp == null)
                            {
                                _Sp = new SoundPlayer();
                            }

                            _Sp.Stream = stream;
                            _Sp.Play();
                        }
                    }
                }

                base.BtnPlayClick(sender, e);
            }
Пример #18
0
        /// <summary>
        /// This routine populates the right-hand grid with
        /// files discovered from the given directory path.
        /// </summary>
        /// <param name="path">Directory path</param>
        /// <param name="row">Container row</param>
        /// <param name="count">Count of files added</param>
        /// <returns>The total size of all files added</returns>
        private long PopulateDirectoryInfo(
            string path, GridContainer row, ref int count)
        {
            string[] files = new string[] { };

            try
            {
                // Get the directory files

                files = Directory.GetFiles(path);
            }
            catch
            {
            }

            // Add each discovered, non-hidden, non-system files
            // into the given container

            long totalSize = 0;

            if (files.Length > 100)
            {
                Cursor = Cursors.AppStarting;
            }

            foreach (string file in files)
            {
                FileInfo info = new FileInfo(file);

                if ((info.Attributes & (FileAttributes.Hidden | FileAttributes.System)) == 0)
                {
                    // Create an array of
                    // cell values to create the new row with.

                    long size = info.Length;

                    object[] s = new object[5];
                    s[0] = info.Name;
                    s[1] = size;
                    s[2] = ShellServices.GetFileType(file);
                    s[3] = info.CreationTime.ToShortDateString();
                    s[4] = info.LastAccessTime.ToShortDateString();

                    // Allocate a new row, giving it an array of objects
                    // to use in the creation of the row's Cells

                    GridRow frow = new GridRow(s);

                    // Let the rowheight auto-size and set the Tag value
                    // to the file path for future use.

                    frow.RowHeight = 0;
                    frow.Tag       = file;

                    // Set the first cell's image to the file icon

                    frow.Cells[0].CellStyles.Default.Image =
                        ShellServices.GetFileImage(file, false, false);

                    // Add the row to the container, and
                    // update our running count and total size

                    row.Rows.Add(frow);

                    count++;
                    totalSize += size;
                }
            }

            Cursor = Cursors.Default;

            return(totalSize);
        }