Tuesday, April 11, 2017

Fancy Progressbar - Ver 2 - C Sharp

Fancy Progressbar - Ver 2
(Demo for Progressbar, Prime numbers, Dynamic Form.)
(Written by me in c#)
.
Other versions:
Version Link
3.1 FG Progressbar 03.01 - 170410Mo
.
      I found a Project in working folder of C# 2010 with name 'FancyProgressbar' which was written by me a few years ago. I opened it ran it and went through it's code. That project was collection of some fancy looking Progressbars. After running that project for some time I made another project for sharing here  and named it 'FancyProgressbar-02'.
      This project is a demo project. First it demonstrates a fancy looking Progressbar. Second it demonstrates how to find prime numbers between 2 numbers with a gap of 100000000. Third it demonstrates how to create a form programmatically and use it to show Help information.
.
A simple fancy looking progressbar:
       Fancy looking progressbar is actually made of one TableLayoutPanel and two Progressbars. First Progressbar with it's Style set to ProgressBarStyle.Continuous and second Progressbar with it's Style set to ProgressBarStyle.Marquee. Resultant Progressbar is made to look fancier by playing with some Properties of these 3 controls. It's use is demonstrated  during finding of prime numbers.
.
Finding Prime numbers:
      Application runs a long process for finding prime numbers between 2 randomly generated numbers with a gap of 100000000 and updates fancy progressbar based on calculated percentage of work done by that process for each number it processes. Method for finding prime number is not optimized for speed or space. It is used here for having a long process for Fancy progressbar demo.
.
Creating Form programmatically:
       Help information is displayed through a form created  dynamically / programmatically on the fly. First Form is created second a control is added, Label in this case, third some  properties of Form and Label are set according to needs (like Help info to Text property of Label) and fourth form with Help information is displayed.
.

      Following are the screen shots of 'Fancy Progressbar - Ver 02'  application with explanation.
.
Application looks like this when it is loaded.
.

.
Application's Help form looks like this and it is displayed when 'Show Help' button is clicked. It displays some basic information about application. Working of main Form is not blocked by display of Help form. Help window uses different color on each load which it randomly selects from "Black, Blue, Green, Purple, DarkOrange, Red and DarkCyan". I used creation date of the original project in Help info.
.

.
Application looks like this when 'Start' button is clicked and application starts finding prime numbers between 2 randomly generated numbers. 'Start' button becomes disabled and 'Stop' button becomes enabled. In status line application shows that it is 'Busy...' and percentage of job done by progressbar and percentage number. It also shows number of Primes found and Primes found percentage in form.
.

.
Application looks like this when Job is completed. 'Start' button becomes enabled again and 'Stop' button becomes disabled. In status line it shows 'Done.' and Progressbar and percentage label shows that 100% job is completed. Total Primes found and Primes found percentage are shown in  different fields of form.
.

.
Application looks like this when 'Stop' button is clicked. On doing so application stops doing it's job and shows 'Stopped.' in status line. 'Start' button gets enabled and 'Stop' button gets disabled.
.

.
[Update-2017Apr12Wed]:
      Today I removed some typing mistakes from this post and user-interface of application. I also made improvement to logic of application today.
.

.
      Enjoy Complete Source code of application written and compiled in visual studio 2010 Ultimate by me. Download it. Extract it. Read 'ReadMeFirst.txt' file and do as is explained in it.



Friday, April 7, 2017

Happy 4000 PageViews - (2017 Apr 07 Fri)

.
CONGRATULATIONS
.
Today
On 2017 Apr 07 Fri
my this Blog reached 4000 page views mark.
.
A lot of THANKS to
Visitors, Viewers, Readers and Wanderers.
.
Please keep visiting this blog
and
Tell others about it.
.
Congratulations to me also.
.

Thursday, April 6, 2017

Menu Generator Ver 3 - C Sharp

Menu Generator Ver 3
(Generates Menu of my Dreams. Written by me in c#)
.
      Once upon a time I wanted to have a menu under and/or above every page of threads in Forums, I was visiting in those days,  to make navigation in between pages of thread easier.
      My idea then was and still is that, that menu and it's sub-menus will show all page numbers of respective thread in a hierarchy to let user go directly to required page. This type of menu will be specially very useful in any situation where one needs to go to some information through a number in a very long list of numbers eg page number of a thread or  record number of a database table etc, in a very long list.
      So I made an application in C# to test it's 'look and feel' myself. And it is looking good to me.
.

      Following are the screen shots of 'MenuGenerator - 03'  application with explanation.
.
Application looks like this when it is loaded.
.

.
Menu with 'Menu' text gives two options "Help" and "Exit". 'Help' menu gives three options 'About', 'Purpose' and 'How to Use'.
.

.
Application looks like this when 'About' option of 'Help' menu of 'Menu' menu is selected. It displays some basic information about application.
.

.
Application looks like this when 'Purpose' option of 'Help' menu of 'Menu' menu is selected. It displays text describing purpose of this application.
.

.
Application looks like this when 'How to Use' option of 'Help' menu of 'Menu' menu is selected. It displays information about how one can use this application.
.

.
Application looks like this when 'Generate Indexed Menu' button is clicked and application starts generating 'Indexed' menu. In status line application shows name of count of menuItem generated and time consumed so far.
.

.
Application looks like this when 'Indexed' menu generation completes. In status line it shows how many menus and menuItems were generated and how much time was consumed in doing so.
.

.
Application looks like this when 'Generate Pagination Menu' button is clicked and application starts generating 'Pagination' menu. In status line application shows name and count of menuItem generated and time consumed so far.
.

.
Application looks like this when 'Pagination' menu generation completes. In status line it shows how many menus and menuItems were generated and how much time was consumed in doing so.
.

.
Application looks like this when both 'Indexed' and 'Pagination'  menu generation completes. In status lines or both it shows how many menus and menuItems were generated and how much time was consumed in doing so.
.

.
Application looks like this when some menuItems are selected from generated 'Indexed' menu.
.

.
Application looks like this when some menuItems are selected from generated 'Pagination' menu. It clearly shows how easy it is to navigate to any number. And that number can be 'Page number of a thread' or a 'Record number of a database table' or any thing else similar.
.

.
      Menu generated by clicking 'Generate Pagination Menu' is the menu I was talking about at start of this blog post and this menu can be seen by clicking 'Pagination' menu. One can reach to any required number between 1 and 100000 by clicking 6 times only or by clicking 2 times, once for opening 'Pagination' menu and once for selecting required number, and hovering 4 times for expanding in between menus.
.

.
      Similarly for upper limit of 1000000 (one million) only 7 clicks will take to required number. For upper limit of 1000000000 (one billion) only 10 clicks will take to required number. For upper limit of 1000000000000 (one trillion) only 13 clicks will take to required number. For upper limit of
100000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000
only 101 clicks will take to required number. And so and so on.
.

.
      Menu generated by clicking 'Generate Indexed Menu' is added as a bonus in this application and this menu can be seen by clicking 'Indexed' menu.
.

.
      Enjoy Complete Source code of application written and compiled in visual studio 2010 Ultimate by me. Download it. Extract it. Read 'ReadMeFirst.txt' file and do as is explained in it.