Smile[Help]Methods other than SendKeys?[Solved]

Posts 31–36 of 36 · Page 3 of 3
Quote Originally Posted by Jason View Post
Find it for me /daum

Here we go :D



Applicable code:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace ProgressBarTest
{
    class CProgressBar : ProgressBar
    {
        Font font = new Font(new FontFamily("Segoe UI"), 8);
        int _value = 0;
        int fillWidth = 0;
        new public int Value { get { return _value; } set { _value = value; recalculateSize(); } }

        protected override void OnSizeChanged(EventArgs e) { base.OnSizeChanged(e); recalculateSize(); }
        void recalculateSize()
        {
            fillWidth = (int)((float)this.Width / this.Maximum * _value);
        }

        public CProgressBar()
        {
            this.SetStyle(ControlStyles.UserPaint, true);
        }


        
        protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.FillRectangle(Brushes.Red, e.ClipRectangle);
            e.Graphics.FillRectangle(Brushes.YellowGreen, new Rectangle(e.ClipRectangle.X, e.ClipRectangle.Y, fillWidth, e.ClipRectangle.Height));
            e.Graphics.DrawString("freedompeace ; example of custom progressbar in .NET 4. :D", font, Brushes.Black, new PointF(e.ClipRectangle.X, e.ClipRectangle.Y));
        }
    }
}
I've also attached the project I made.
ProgressBarTest.rarattachment deleted · 2 downloads before removal
Quote Originally Posted by freedompeace View Post
Here we go



Applicable code:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace ProgressBarTest
{
    class CProgressBar : ProgressBar
    {
        Font font = new Font(new FontFamily("Segoe UI"), 8);
        int _value = 0;
        int fillWidth = 0;
        new public int Value { get { return _value; } set { _value = value; recalculateSize(); } }

        protected override void OnSizeChanged(EventArgs e) { base.OnSizeChanged(e); recalculateSize(); }
        void recalculateSize()
        {
            fillWidth = (int)((float)this.Width / this.Maximum * _value);
        }

        public CProgressBar()
        {
            this.SetStyle(ControlStyles.UserPaint, true);
        }


        
        protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.FillRectangle(Brushes.Red, e.ClipRectangle);
            e.Graphics.FillRectangle(Brushes.YellowGreen, new Rectangle(e.ClipRectangle.X, e.ClipRectangle.Y, fillWidth, e.ClipRectangle.Height));
            e.Graphics.DrawString("freedompeace ; example of custom progressbar in .NET 4. :D", font, Brushes.Black, new PointF(e.ClipRectangle.X, e.ClipRectangle.Y));
        }
    }
}
I've also attached the project I made.
Of course you can do it with a custom progressbar lol, that's what I said from the start. You said you could handle the "Paint" event of a regular progressbar control, which you can't...as illustrated in my image. Oh yeah, C# is gay
Quote Originally Posted by Jason View Post


Of course you can do it with a custom progressbar lol, that's what I said from the start. You said you could handle the "Paint" event of a regular progressbar control, which you can't...as illustrated in my image. Oh yeah, C# is gay
That is the Paint event ... |: "OnPaint"

Isn't it?
Quote Originally Posted by freedompeace View Post
Here we go



Applicable code:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace ProgressBarTest
{
    class CProgressBar : ProgressBar
    {
        Font font = new Font(new FontFamily("Segoe UI"), 8);
        int _value = 0;
        int fillWidth = 0;
        new public int Value { get { return _value; } set { _value = value; recalculateSize(); } }

        protected override void OnSizeChanged(EventArgs e) { base.OnSizeChanged(e); recalculateSize(); }
        void recalculateSize()
        {
            fillWidth = (int)((float)this.Width / this.Maximum * _value);
        }

        public CProgressBar()
        {
            this.SetStyle(ControlStyles.UserPaint, true);
        }


        
        protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.FillRectangle(Brushes.Red, e.ClipRectangle);
            e.Graphics.FillRectangle(Brushes.YellowGreen, new Rectangle(e.ClipRectangle.X, e.ClipRectangle.Y, fillWidth, e.ClipRectangle.Height));
            e.Graphics.DrawString("freedompeace ; example of custom progressbar in .NET 4. :D", font, Brushes.Black, new PointF(e.ClipRectangle.X, e.ClipRectangle.Y));
        }
    }
}
I've also attached the project I made.
Thanks Ill download as soon as mods approve.

And thanks to everyone who replied. Feed back was helpful
Quote Originally Posted by freedompeace View Post
That is the Paint event ... |: "OnPaint"

Isn't it?
Yes is that.
Quote Originally Posted by Jason View Post
I created a class library for this. I'll edit this post when I find the link.

EDIT:

http://www.mpgh.net/forum/33-visual-...ender-dll.html

There you go.

Work's tried it real quick..

Quote Originally Posted by Lyoto Machida View Post
Yes is that.
Thank u. u beat me to it.
Posts 31–36 of 36 · Page 3 of 3
This thread is closed for replies.

Tags for this Thread

None

Talk with us