Page 3 of 3 FirstFirst 123
Results 31 to 36 of 36
  1. #31
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    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.

  2. #32
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    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 Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  3. #33
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    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?

  4. #34
    Dreamer's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    Seattle
    Posts
    8,745
    Reputation
    393
    Thanks
    1,481
    My Mood
    Bitchy
    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
    Resource Team: Feb/5/2012 - May/5/2012
    Middleman: April/25/2012 - September/16/12


  5. #35
    Lyoto Machida's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Location
    Far away with girls
    Posts
    3,734
    Reputation
    133
    Thanks
    1,621
    My Mood
    Aggressive
    Quote Originally Posted by freedompeace View Post
    That is the Paint event ... |: "OnPaint"

    Isn't it?
    Yes is that.

  6. #36
    SubCub's Avatar
    Join Date
    Feb 2011
    Gender
    male
    Location
    Clarion, Pa
    Posts
    695
    Reputation
    -32
    Thanks
    120
    My Mood
    Cheerful
    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:

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

    There you go.

    Work's tried it real quick..

    Quote Originally Posted by -WØW'' View Post
    Yes is that.
    Thank u. u beat me to it.
    Last edited by SubCub; 02-06-2011 at 02:42 PM.

Page 3 of 3 FirstFirst 123