Change the progress bar height

Posted by: satson90 on 8 September 2017, 3:08 pm EST

  • Posted 8 September 2017, 3:08 pm EST

    <p>Hi </p><p>In Speard sheet i want to show the progressbar. row height is 40 so the progress bar show that much height. how to reduce the progress bar height and show in the center of the cell. How can i acheive this. i am using progressbar cell type </p>
  • Replied 8 September 2017, 3:08 pm EST

    <p>Hello,</p><p>You need to create a CustomCelltype for that matter and have to adjust the rectangle size depending on your requirement. Please have a look at the below mentioned code for that matter:-<br></p><p>class CustomProgressBar : FarPoint.Win.Spread.CellType.ProgressCellType<br>    {<br>        public override void PaintCell(System.Drawing.Graphics g, System.Drawing.Rectangle r, FarPoint.Win.Spread.Appearance appearance, object value, bool isSelected, bool isLocked, float zoomFactor)<br>        {<br>            base.PaintCell(g, new Rectangle(r.Right - 37, r.Y, 17, r.Height - 7), appearance, value, isSelected, isLocked, zoomFactor); // Here adjust the rectangle size<br>        }<br>    }</p><p>        private void Form1_Load(object sender, EventArgs e)<br>        {<br>            CustomProgressBar cus = new CustomProgressBar();<br>            fpSpread1.ActiveSheet.Cells[1, 1].CellType = cus;<br>            fpSpread1.ActiveSheet.Cells[1, 1].Value = 30;<br>        } </p><p>Hope it helps.</p><p>Thanks,</p><p>Reeva <br></p>
  • Replied 8 September 2017, 3:08 pm EST

    <p>Hi i am try this but its not wroking what am doing wrong?</p><p> <span style="font-size:10pt;">  Dim xProgress As New CustomProgress </span></p><p>xProgress.Maximum = xDrive.TotalSize / 1073741824</p><p>                        xProgress.Minimum = 0</p><p>                        xProgress.FillColor = Color.Green</p><p>                        xProgress.Style = FarPoint.Win.ProgressStyle.Default</p><p>                        .Cells(.RowCount - 1, .Columns("Progresscol").Index).CellType = xProgress</p><p>                        .Cells(.RowCount - 1, .Columns("Progresscol").Index).Value = (xDrive.TotalSize - xDrive.TotalFreeSpace) / 1073741824</p><p>                        .Rows(.RowCount - 1).Height = 40 </p><p> </p><p>Public Class CustomProgress</p><p>    Inherits FarPoint.Win.Spread.CellType.ProgressCellType</p><p><br></p><p>    Public Overrides Sub PaintCell(ByVal g As FarPoint.PDF.PdfGraphics, ByVal r As System.Drawing.RectangleF, ByVal appearance As FarPoint.Win.Spread.Appearance, ByVal value As Object, ByVal isSelected As Boolean, ByVal isLocked As Boolean, ByVal zoomFactor As Single)</p><p>        MyBase.PaintCell(g, r, appearance, value, isSelected, isLocked, zoomFactor)</p><p><br></p><p>        MyBase.PaintCell(g, New Rectangle(r.Right - 37, r.Y, 17, r.Height - 7), appearance, value, isSelected, isLocked, zoomFactor)</p><p><br></p><p>    End Sub </p>
  • Replied 8 September 2017, 3:08 pm EST

    <p>Hello,

    </p><p>You are overriding a wrong method. Please have a look at the attached sample in VB.Net for complete implementation of the same.</p><p>Hope it helps.</p><p>Thanks,</p><p>Reeva <br></p>
    2013/06/CustomProgressBar_VB.zip
  • Replied 8 September 2017, 3:08 pm EST

    <p>Thanks Reeva.</p><p>Its Work well</p><p> </p>
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels