how to make a vertical progress bar












1















I'm trying to make a vertical progress bar and I understand that there isn't any easy way to do it.



I've seen this code floating around the forums:



public class VerticalProgressBar : ProgressBar { 
protected override CreateParams CreateParams {
get {
CreateParams cp = base.CreateParams;
cp.Style |= 0x04;
return cp;
}
}
}


My question is where do i put this code?
Does it go in my program.cs file or the form that the progress bar is on?










share|improve this question





























    1















    I'm trying to make a vertical progress bar and I understand that there isn't any easy way to do it.



    I've seen this code floating around the forums:



    public class VerticalProgressBar : ProgressBar { 
    protected override CreateParams CreateParams {
    get {
    CreateParams cp = base.CreateParams;
    cp.Style |= 0x04;
    return cp;
    }
    }
    }


    My question is where do i put this code?
    Does it go in my program.cs file or the form that the progress bar is on?










    share|improve this question



























      1












      1








      1


      1






      I'm trying to make a vertical progress bar and I understand that there isn't any easy way to do it.



      I've seen this code floating around the forums:



      public class VerticalProgressBar : ProgressBar { 
      protected override CreateParams CreateParams {
      get {
      CreateParams cp = base.CreateParams;
      cp.Style |= 0x04;
      return cp;
      }
      }
      }


      My question is where do i put this code?
      Does it go in my program.cs file or the form that the progress bar is on?










      share|improve this question
















      I'm trying to make a vertical progress bar and I understand that there isn't any easy way to do it.



      I've seen this code floating around the forums:



      public class VerticalProgressBar : ProgressBar { 
      protected override CreateParams CreateParams {
      get {
      CreateParams cp = base.CreateParams;
      cp.Style |= 0x04;
      return cp;
      }
      }
      }


      My question is where do i put this code?
      Does it go in my program.cs file or the form that the progress bar is on?







      c# winforms progress-bar






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 18:04









      georges619

      35111




      35111










      asked Apr 3 '13 at 18:31









      brian4342brian4342

      55851952




      55851952
























          2 Answers
          2






          active

          oldest

          votes


















          1














          It doesn't matter where you put the code, you only have to make sure you are creating a VerticalProgressBar in your Form.Designer.cs file.



          You have to change



          private System.Windows.Forms.ProgressBar progressBar1


          to



          private VerticalProgressBar progressBar1


          (or whatever it is called) and



          this.progressBar1 = new System.Windows.Forms.ProgressBar();


          to



          this.progressBar1 = new VerticalProgressBar();





          share|improve this answer





















          • 4





            VerticalProgressBar doesnt seem to work at all, do i need a specific namespace for it?

            – brian4342
            Apr 3 '13 at 18:45











          • It should be in the same namespace as your form is. Just put the code underneath the partial class Form1 in the Form1.Designer.cs

            – pascalhein
            Apr 3 '13 at 18:47



















          -2














          If this is a brand new application, use WPF. vertical progress bars are built-in



          <ProgressBar Orientation="Vertical" />





          share|improve this answer
























          • ah no its a large project i'm creating just doing my final form :

            – brian4342
            Apr 3 '13 at 18:40











          • stackoverflow.com/questions/5053501/…

            – LadderLogic
            Apr 3 '13 at 18:45











          • So you recommend adding the whole WPF libraries instead of adding 5 lines of WinForms code and keep the project clean ?

            – Stephan Leclercq
            Oct 28 '15 at 14:26











          • I was trying to contribute to a conversation. I don't understand what you're doing. Since when did adding a library references such an ungodly thing? Are we still coding on 8086? Define keeping project clean. Interop is not new, and it won't "mess" things up if you use it right. After all .NET is interop for Win32 API.

            – LadderLogic
            Oct 30 '15 at 22:42











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f15795205%2fhow-to-make-a-vertical-progress-bar%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          It doesn't matter where you put the code, you only have to make sure you are creating a VerticalProgressBar in your Form.Designer.cs file.



          You have to change



          private System.Windows.Forms.ProgressBar progressBar1


          to



          private VerticalProgressBar progressBar1


          (or whatever it is called) and



          this.progressBar1 = new System.Windows.Forms.ProgressBar();


          to



          this.progressBar1 = new VerticalProgressBar();





          share|improve this answer





















          • 4





            VerticalProgressBar doesnt seem to work at all, do i need a specific namespace for it?

            – brian4342
            Apr 3 '13 at 18:45











          • It should be in the same namespace as your form is. Just put the code underneath the partial class Form1 in the Form1.Designer.cs

            – pascalhein
            Apr 3 '13 at 18:47
















          1














          It doesn't matter where you put the code, you only have to make sure you are creating a VerticalProgressBar in your Form.Designer.cs file.



          You have to change



          private System.Windows.Forms.ProgressBar progressBar1


          to



          private VerticalProgressBar progressBar1


          (or whatever it is called) and



          this.progressBar1 = new System.Windows.Forms.ProgressBar();


          to



          this.progressBar1 = new VerticalProgressBar();





          share|improve this answer





















          • 4





            VerticalProgressBar doesnt seem to work at all, do i need a specific namespace for it?

            – brian4342
            Apr 3 '13 at 18:45











          • It should be in the same namespace as your form is. Just put the code underneath the partial class Form1 in the Form1.Designer.cs

            – pascalhein
            Apr 3 '13 at 18:47














          1












          1








          1







          It doesn't matter where you put the code, you only have to make sure you are creating a VerticalProgressBar in your Form.Designer.cs file.



          You have to change



          private System.Windows.Forms.ProgressBar progressBar1


          to



          private VerticalProgressBar progressBar1


          (or whatever it is called) and



          this.progressBar1 = new System.Windows.Forms.ProgressBar();


          to



          this.progressBar1 = new VerticalProgressBar();





          share|improve this answer















          It doesn't matter where you put the code, you only have to make sure you are creating a VerticalProgressBar in your Form.Designer.cs file.



          You have to change



          private System.Windows.Forms.ProgressBar progressBar1


          to



          private VerticalProgressBar progressBar1


          (or whatever it is called) and



          this.progressBar1 = new System.Windows.Forms.ProgressBar();


          to



          this.progressBar1 = new VerticalProgressBar();






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 3 '13 at 18:41

























          answered Apr 3 '13 at 18:33









          pascalheinpascalhein

          4,61642340




          4,61642340








          • 4





            VerticalProgressBar doesnt seem to work at all, do i need a specific namespace for it?

            – brian4342
            Apr 3 '13 at 18:45











          • It should be in the same namespace as your form is. Just put the code underneath the partial class Form1 in the Form1.Designer.cs

            – pascalhein
            Apr 3 '13 at 18:47














          • 4





            VerticalProgressBar doesnt seem to work at all, do i need a specific namespace for it?

            – brian4342
            Apr 3 '13 at 18:45











          • It should be in the same namespace as your form is. Just put the code underneath the partial class Form1 in the Form1.Designer.cs

            – pascalhein
            Apr 3 '13 at 18:47








          4




          4





          VerticalProgressBar doesnt seem to work at all, do i need a specific namespace for it?

          – brian4342
          Apr 3 '13 at 18:45





          VerticalProgressBar doesnt seem to work at all, do i need a specific namespace for it?

          – brian4342
          Apr 3 '13 at 18:45













          It should be in the same namespace as your form is. Just put the code underneath the partial class Form1 in the Form1.Designer.cs

          – pascalhein
          Apr 3 '13 at 18:47





          It should be in the same namespace as your form is. Just put the code underneath the partial class Form1 in the Form1.Designer.cs

          – pascalhein
          Apr 3 '13 at 18:47













          -2














          If this is a brand new application, use WPF. vertical progress bars are built-in



          <ProgressBar Orientation="Vertical" />





          share|improve this answer
























          • ah no its a large project i'm creating just doing my final form :

            – brian4342
            Apr 3 '13 at 18:40











          • stackoverflow.com/questions/5053501/…

            – LadderLogic
            Apr 3 '13 at 18:45











          • So you recommend adding the whole WPF libraries instead of adding 5 lines of WinForms code and keep the project clean ?

            – Stephan Leclercq
            Oct 28 '15 at 14:26











          • I was trying to contribute to a conversation. I don't understand what you're doing. Since when did adding a library references such an ungodly thing? Are we still coding on 8086? Define keeping project clean. Interop is not new, and it won't "mess" things up if you use it right. After all .NET is interop for Win32 API.

            – LadderLogic
            Oct 30 '15 at 22:42
















          -2














          If this is a brand new application, use WPF. vertical progress bars are built-in



          <ProgressBar Orientation="Vertical" />





          share|improve this answer
























          • ah no its a large project i'm creating just doing my final form :

            – brian4342
            Apr 3 '13 at 18:40











          • stackoverflow.com/questions/5053501/…

            – LadderLogic
            Apr 3 '13 at 18:45











          • So you recommend adding the whole WPF libraries instead of adding 5 lines of WinForms code and keep the project clean ?

            – Stephan Leclercq
            Oct 28 '15 at 14:26











          • I was trying to contribute to a conversation. I don't understand what you're doing. Since when did adding a library references such an ungodly thing? Are we still coding on 8086? Define keeping project clean. Interop is not new, and it won't "mess" things up if you use it right. After all .NET is interop for Win32 API.

            – LadderLogic
            Oct 30 '15 at 22:42














          -2












          -2








          -2







          If this is a brand new application, use WPF. vertical progress bars are built-in



          <ProgressBar Orientation="Vertical" />





          share|improve this answer













          If this is a brand new application, use WPF. vertical progress bars are built-in



          <ProgressBar Orientation="Vertical" />






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 3 '13 at 18:38









          LadderLogicLadderLogic

          671614




          671614













          • ah no its a large project i'm creating just doing my final form :

            – brian4342
            Apr 3 '13 at 18:40











          • stackoverflow.com/questions/5053501/…

            – LadderLogic
            Apr 3 '13 at 18:45











          • So you recommend adding the whole WPF libraries instead of adding 5 lines of WinForms code and keep the project clean ?

            – Stephan Leclercq
            Oct 28 '15 at 14:26











          • I was trying to contribute to a conversation. I don't understand what you're doing. Since when did adding a library references such an ungodly thing? Are we still coding on 8086? Define keeping project clean. Interop is not new, and it won't "mess" things up if you use it right. After all .NET is interop for Win32 API.

            – LadderLogic
            Oct 30 '15 at 22:42



















          • ah no its a large project i'm creating just doing my final form :

            – brian4342
            Apr 3 '13 at 18:40











          • stackoverflow.com/questions/5053501/…

            – LadderLogic
            Apr 3 '13 at 18:45











          • So you recommend adding the whole WPF libraries instead of adding 5 lines of WinForms code and keep the project clean ?

            – Stephan Leclercq
            Oct 28 '15 at 14:26











          • I was trying to contribute to a conversation. I don't understand what you're doing. Since when did adding a library references such an ungodly thing? Are we still coding on 8086? Define keeping project clean. Interop is not new, and it won't "mess" things up if you use it right. After all .NET is interop for Win32 API.

            – LadderLogic
            Oct 30 '15 at 22:42

















          ah no its a large project i'm creating just doing my final form :

          – brian4342
          Apr 3 '13 at 18:40





          ah no its a large project i'm creating just doing my final form :

          – brian4342
          Apr 3 '13 at 18:40













          stackoverflow.com/questions/5053501/…

          – LadderLogic
          Apr 3 '13 at 18:45





          stackoverflow.com/questions/5053501/…

          – LadderLogic
          Apr 3 '13 at 18:45













          So you recommend adding the whole WPF libraries instead of adding 5 lines of WinForms code and keep the project clean ?

          – Stephan Leclercq
          Oct 28 '15 at 14:26





          So you recommend adding the whole WPF libraries instead of adding 5 lines of WinForms code and keep the project clean ?

          – Stephan Leclercq
          Oct 28 '15 at 14:26













          I was trying to contribute to a conversation. I don't understand what you're doing. Since when did adding a library references such an ungodly thing? Are we still coding on 8086? Define keeping project clean. Interop is not new, and it won't "mess" things up if you use it right. After all .NET is interop for Win32 API.

          – LadderLogic
          Oct 30 '15 at 22:42





          I was trying to contribute to a conversation. I don't understand what you're doing. Since when did adding a library references such an ungodly thing? Are we still coding on 8086? Define keeping project clean. Interop is not new, and it won't "mess" things up if you use it right. After all .NET is interop for Win32 API.

          – LadderLogic
          Oct 30 '15 at 22:42


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f15795205%2fhow-to-make-a-vertical-progress-bar%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          404 Error Contact Form 7 ajax form submitting

          How to know if a Active Directory user can login interactively

          Refactoring coordinates for Minecraft Pi buildings written in Python