Exemplo n.º 1
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();
                }
            }
        }
Exemplo n.º 2
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;
                            }
                        }
                    }
                }
            }
        }