├── .gitignore
├── LICENSE
├── README.md
└── src
├── AnalogClock
├── Form1.Designer.cs
├── Form1.cs
└── ReadMe.txt
├── CustomProgressBar
├── Form1.Designer.cs
├── Form1.cs
└── ReadMe.txt
├── DigitalClock
├── Form1.Designer.cs
├── Form1.cs
└── ReadMe.txt
├── Grayscale
├── Form1.Designer.cs
├── Form1.cs
└── ReadMe.txt
├── ImageViewer
├── Form1.Designer.cs
├── Form1.cs
└── ReadMe.txt
├── MatrixScreen
├── Program.cs
└── ReadMe.txt
├── MatrixScreen2
├── Program.cs
└── ReadMe.txt
├── MirrorImage
├── Form1.Designer.cs
├── Form1.cs
└── ReadMe.txt
├── NegativeImage
├── Form1.Designer.cs
├── Form1.cs
└── ReadMe.txt
├── RandomPixelImage
├── Form1.Designer.cs
├── Form1.cs
└── ReadMe.txt
├── ReadWriteImage
├── Form1.Designer.cs
├── Form1.cs
└── ReadMe.txt
├── RedGreenBlueImage
├── Form1.Designer.cs
├── Form1.cs
└── ReadMe.txt
├── Sepia
├── Form1.Designer.cs
├── Form1.cs
└── ReadMe.txt
└── SimpleRadar
├── Form1.Designer.cs
├── Form1.cs
└── ReadMe.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | #################
2 | ## Eclipse
3 | #################
4 |
5 | *.pydevproject
6 | .project
7 | .metadata
8 | bin/
9 | tmp/
10 | *.tmp
11 | *.bak
12 | *.swp
13 | *~.nib
14 | local.properties
15 | .classpath
16 | .settings/
17 | .loadpath
18 |
19 | # External tool builders
20 | .externalToolBuilders/
21 |
22 | # Locally stored "Eclipse launch configurations"
23 | *.launch
24 |
25 | # CDT-specific
26 | .cproject
27 |
28 | # PDT-specific
29 | .buildpath
30 |
31 |
32 | #################
33 | ## Visual Studio
34 | #################
35 |
36 | ## Ignore Visual Studio temporary files, build results, and
37 | ## files generated by popular Visual Studio add-ons.
38 |
39 | # User-specific files
40 | *.suo
41 | *.user
42 | *.sln.docstates
43 |
44 | # Build results
45 |
46 | [Dd]ebug/
47 | [Rr]elease/
48 | x64/
49 | build/
50 | [Bb]in/
51 | [Oo]bj/
52 |
53 | # MSTest test Results
54 | [Tt]est[Rr]esult*/
55 | [Bb]uild[Ll]og.*
56 |
57 | *_i.c
58 | *_p.c
59 | *.ilk
60 | *.meta
61 | *.obj
62 | *.pch
63 | *.pdb
64 | *.pgc
65 | *.pgd
66 | *.rsp
67 | *.sbr
68 | *.tlb
69 | *.tli
70 | *.tlh
71 | *.tmp
72 | *.tmp_proj
73 | *.log
74 | *.vspscc
75 | *.vssscc
76 | .builds
77 | *.pidb
78 | *.log
79 | *.scc
80 |
81 | # Visual C++ cache files
82 | ipch/
83 | *.aps
84 | *.ncb
85 | *.opensdf
86 | *.sdf
87 | *.cachefile
88 |
89 | # Visual Studio profiler
90 | *.psess
91 | *.vsp
92 | *.vspx
93 |
94 | # Guidance Automation Toolkit
95 | *.gpState
96 |
97 | # ReSharper is a .NET coding add-in
98 | _ReSharper*/
99 | *.[Rr]e[Ss]harper
100 |
101 | # TeamCity is a build add-in
102 | _TeamCity*
103 |
104 | # DotCover is a Code Coverage Tool
105 | *.dotCover
106 |
107 | # NCrunch
108 | *.ncrunch*
109 | .*crunch*.local.xml
110 |
111 | # Installshield output folder
112 | [Ee]xpress/
113 |
114 | # DocProject is a documentation generator add-in
115 | DocProject/buildhelp/
116 | DocProject/Help/*.HxT
117 | DocProject/Help/*.HxC
118 | DocProject/Help/*.hhc
119 | DocProject/Help/*.hhk
120 | DocProject/Help/*.hhp
121 | DocProject/Help/Html2
122 | DocProject/Help/html
123 |
124 | # Click-Once directory
125 | publish/
126 |
127 | # Publish Web Output
128 | *.Publish.xml
129 | *.pubxml
130 |
131 | # NuGet Packages Directory
132 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line
133 | #packages/
134 |
135 | # Windows Azure Build Output
136 | csx
137 | *.build.csdef
138 |
139 | # Windows Store app package directory
140 | AppPackages/
141 |
142 | # Others
143 | sql/
144 | *.Cache
145 | ClientBin/
146 | [Ss]tyle[Cc]op.*
147 | ~$*
148 | *~
149 | *.dbmdl
150 | *.[Pp]ublish.xml
151 | *.pfx
152 | *.publishsettings
153 |
154 | # RIA/Silverlight projects
155 | Generated_Code/
156 |
157 | # Backup & report files from converting an old project file to a newer
158 | # Visual Studio version. Backup files are not needed, because we have git ;-)
159 | _UpgradeReport_Files/
160 | Backup*/
161 | UpgradeLog*.XML
162 | UpgradeLog*.htm
163 |
164 | # SQL Server files
165 | App_Data/*.mdf
166 | App_Data/*.ldf
167 |
168 | #############
169 | ## Windows detritus
170 | #############
171 |
172 | # Windows image file caches
173 | Thumbs.db
174 | ehthumbs.db
175 |
176 | # Folder config file
177 | Desktop.ini
178 |
179 | # Recycle Bin used on file shares
180 | $RECYCLE.BIN/
181 |
182 | # Mac crap
183 | .DS_Store
184 |
185 |
186 | #############
187 | ## Python
188 | #############
189 |
190 | *.py[co]
191 |
192 | # Packages
193 | *.egg
194 | *.egg-info
195 | dist/
196 | build/
197 | eggs/
198 | parts/
199 | var/
200 | sdist/
201 | develop-eggs/
202 | .installed.cfg
203 |
204 | # Installer logs
205 | pip-log.txt
206 |
207 | # Unit test / coverage reports
208 | .coverage
209 | .tox
210 |
211 | #Translations
212 | *.mo
213 |
214 | #Mr Developer
215 | .mr.developer.cfg
216 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Yusuf Shakeel
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | CSharp-Project
2 | ==============
3 |
4 | C# project
5 |
6 | By: Yusuf Shakeel
7 |
8 | Date: 12 April 2014 Saturday
9 |
10 | [facebook.com/yusufshakeel](https://www.facebook.com/yusufshakeel)
11 |
12 | [youtube.com/yusufshakeel](https://www.youtube.com/yusufshakeel)
13 |
14 | [github.com/yusufshakeel](https://www.github.com/yusufshakeel)
15 |
16 | [plus.google.com/+YusufShakeel](https://plus.google.com/+YusufShakeel/posts)
17 |
18 |
19 |
20 | ###License
21 |
22 | The MIT License (MIT)
23 |
24 | Copyright (c) 2014 Yusuf Shakeel
25 |
26 | Permission is hereby granted, free of charge, to any person obtaining a copy
27 | of this software and associated documentation files (the "Software"), to deal
28 | in the Software without restriction, including without limitation the rights
29 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
30 | copies of the Software, and to permit persons to whom the Software is
31 | furnished to do so, subject to the following conditions:
32 |
33 | The above copyright notice and this permission notice shall be included in all
34 | copies or substantial portions of the Software.
35 |
36 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
39 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
41 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
42 | SOFTWARE.
43 |
--------------------------------------------------------------------------------
/src/AnalogClock/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace AnalogClock
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.pictureBox1 = new System.Windows.Forms.PictureBox();
32 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
33 | this.SuspendLayout();
34 | //
35 | // pictureBox1
36 | //
37 | this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
38 | this.pictureBox1.Location = new System.Drawing.Point(0, 0);
39 | this.pictureBox1.Name = "pictureBox1";
40 | this.pictureBox1.Size = new System.Drawing.Size(392, 339);
41 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
42 | this.pictureBox1.TabIndex = 0;
43 | this.pictureBox1.TabStop = false;
44 | //
45 | // Form1
46 | //
47 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
48 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
49 | this.ClientSize = new System.Drawing.Size(392, 339);
50 | this.Controls.Add(this.pictureBox1);
51 | this.Name = "Form1";
52 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
53 | this.Text = "Analog Clock";
54 | this.Load += new System.EventHandler(this.Form1_Load);
55 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
56 | this.ResumeLayout(false);
57 |
58 | }
59 |
60 | #endregion
61 |
62 | private System.Windows.Forms.PictureBox pictureBox1;
63 | }
64 | }
65 |
66 |
--------------------------------------------------------------------------------
/src/AnalogClock/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace AnalogClock
12 | {
13 | public partial class Form1 : Form
14 | {
15 | Timer t = new Timer();
16 |
17 | int WIDTH = 300, HEIGHT = 300, secHAND = 140, minHAND = 110, hrHAND = 80;
18 |
19 | //center
20 | int cx, cy;
21 |
22 | Bitmap bmp;
23 | Graphics g;
24 |
25 | public Form1()
26 | {
27 | InitializeComponent();
28 | }
29 |
30 | private void Form1_Load(object sender, EventArgs e)
31 | {
32 | //create bitmap
33 | bmp = new Bitmap(WIDTH + 1, HEIGHT + 1);
34 |
35 | //center
36 | cx = WIDTH / 2;
37 | cy = HEIGHT / 2;
38 |
39 | //backcolor
40 | this.BackColor = Color.White;
41 |
42 | //timer
43 | t.Interval = 1000; //in millisecond
44 | t.Tick += new EventHandler(this.t_Tick);
45 | t.Start();
46 | }
47 |
48 | private void t_Tick(object sender, EventArgs e)
49 | {
50 | //create graphics
51 | g = Graphics.FromImage(bmp);
52 |
53 | //get time
54 | int ss = DateTime.Now.Second;
55 | int mm = DateTime.Now.Minute;
56 | int hh = DateTime.Now.Hour;
57 |
58 | int[] handCoord = new int[2];
59 |
60 | //clear
61 | g.Clear(Color.White);
62 |
63 | //draw circle
64 | g.DrawEllipse(new Pen(Color.Black, 1f), 0, 0, WIDTH, HEIGHT);
65 |
66 | //draw figure
67 | g.DrawString("12", new Font("Arial", 12), Brushes.Black, new PointF(140, 2));
68 | g.DrawString("3", new Font("Arial", 12), Brushes.Black, new PointF(286, 140));
69 | g.DrawString("6", new Font("Arial", 12), Brushes.Black, new PointF(142, 282));
70 | g.DrawString("9", new Font("Arial", 12), Brushes.Black, new PointF(0, 140));
71 |
72 | //second hand
73 | handCoord = msCoord(ss, secHAND);
74 | g.DrawLine(new Pen(Color.Red, 1f), new Point(cx, cy), new Point(handCoord[0], handCoord[1]));
75 |
76 | //minute hand
77 | handCoord = msCoord(mm, minHAND);
78 | g.DrawLine(new Pen(Color.Black, 2f), new Point(cx, cy), new Point(handCoord[0], handCoord[1]));
79 |
80 | //hour hand
81 | handCoord = hrCoord(hh%12, mm, hrHAND);
82 | g.DrawLine(new Pen(Color.Gray, 3f), new Point(cx, cy), new Point(handCoord[0], handCoord[1]));
83 |
84 | //load bmp in picturebox1
85 | pictureBox1.Image = bmp;
86 |
87 | //disp time
88 | this.Text = "Analog Clock - " + hh + ":" + mm + ":" + ss;
89 |
90 | //dispose
91 | g.Dispose();
92 | }
93 |
94 | //coord for minute and second hand
95 | private int[] msCoord(int val, int hlen)
96 | {
97 | int[] coord = new int[2];
98 | val *= 6; //each minute and second make 6 degree
99 |
100 | if (val >= 0 && val <= 180)
101 | {
102 | coord[0] = cx + (int)(hlen * Math.Sin(Math.PI * val / 180));
103 | coord[1] = cy - (int)(hlen * Math.Cos(Math.PI * val / 180));
104 | }
105 | else
106 | {
107 | coord[0] = cx - (int)(hlen * -Math.Sin(Math.PI * val / 180));
108 | coord[1] = cy - (int)(hlen * Math.Cos(Math.PI * val / 180));
109 | }
110 | return coord;
111 | }
112 |
113 | //coord for hour hand
114 | private int[] hrCoord(int hval, int mval, int hlen)
115 | {
116 | int[] coord = new int[2];
117 |
118 | //each hour makes 30 degree
119 | //each min makes 0.5 degree
120 | int val = (int)((hval * 30) + (mval * 0.5));
121 |
122 | if (val >= 0 && val <= 180)
123 | {
124 | coord[0] = cx + (int)(hlen * Math.Sin(Math.PI * val / 180));
125 | coord[1] = cy - (int)(hlen * Math.Cos(Math.PI * val / 180));
126 | }
127 | else
128 | {
129 | coord[0] = cx - (int)(hlen * -Math.Sin(Math.PI * val / 180));
130 | coord[1] = cy - (int)(hlen * Math.Cos(Math.PI * val / 180));
131 | }
132 | return coord;
133 | }
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/src/AnalogClock/ReadMe.txt:
--------------------------------------------------------------------------------
1 | For this project I am using Visual Studio 2012 Express Edition.
2 | You can use any other version of VS.
3 |
4 | Project video
5 | http://youtu.be/0dtbGKSF1R8
6 |
7 | Have fun coding.
8 |
9 | stay happy and keep smiling :-)
10 |
11 | yusufshakeel
12 |
13 | https://www.facebook.com/yusufshakeel
14 | https://www.youtube.com/yusufshakeel
15 | https://plus.google.com/+YusufShakeel
16 | http://yusufshakeelblog.blogspot.in
17 | https://github.com/yusufshakeel
--------------------------------------------------------------------------------
/src/CustomProgressBar/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace CustomProgressBar
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.picboxPB = new System.Windows.Forms.PictureBox();
32 | ((System.ComponentModel.ISupportInitialize)(this.picboxPB)).BeginInit();
33 | this.SuspendLayout();
34 | //
35 | // picboxPB
36 | //
37 | this.picboxPB.Location = new System.Drawing.Point(12, 9);
38 | this.picboxPB.Name = "picboxPB";
39 | this.picboxPB.Size = new System.Drawing.Size(470, 50);
40 | this.picboxPB.TabIndex = 0;
41 | this.picboxPB.TabStop = false;
42 | //
43 | // Form1
44 | //
45 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
46 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
47 | this.ClientSize = new System.Drawing.Size(494, 71);
48 | this.Controls.Add(this.picboxPB);
49 | this.Name = "Form1";
50 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
51 | this.Text = "Custom ProgressBar";
52 | this.Load += new System.EventHandler(this.Form1_Load);
53 | ((System.ComponentModel.ISupportInitialize)(this.picboxPB)).EndInit();
54 | this.ResumeLayout(false);
55 |
56 | }
57 |
58 | #endregion
59 |
60 | private System.Windows.Forms.PictureBox picboxPB;
61 | }
62 | }
63 |
64 |
--------------------------------------------------------------------------------
/src/CustomProgressBar/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace CustomProgressBar
12 | {
13 | public partial class Form1 : Form
14 | {
15 | Timer t = new Timer();
16 |
17 | //pb = ProgressBar
18 | double pbUnit;
19 | int pbWIDTH, pbHEIGHT, pbComplete;
20 |
21 | Bitmap bmp;
22 | Graphics g;
23 |
24 | public Form1()
25 | {
26 | InitializeComponent();
27 | }
28 |
29 | private void Form1_Load(object sender, EventArgs e)
30 | {
31 | //get picboxPB dimension
32 | pbWIDTH = picboxPB.Width;
33 | pbHEIGHT = picboxPB.Height;
34 |
35 | pbUnit = pbWIDTH / 100.0;
36 |
37 | //pbComplete - This is equal to work completed in % [min = 0 max = 100]
38 | pbComplete = 0;
39 |
40 | //create bitmap
41 | bmp = new Bitmap(pbWIDTH, pbHEIGHT);
42 |
43 | //timer
44 | t.Interval = 50; //in millisecond
45 | t.Tick += new EventHandler(this.t_Tick);
46 | t.Start();
47 | }
48 |
49 | private void t_Tick(object sender, EventArgs e)
50 | {
51 | //graphics
52 | g = Graphics.FromImage(bmp);
53 |
54 | //clear graphics
55 | g.Clear(Color.LightSkyBlue);
56 |
57 | //draw progressbar
58 | g.FillRectangle(Brushes.CornflowerBlue, new Rectangle(0, 0, (int)(pbComplete * pbUnit), pbHEIGHT));
59 |
60 | //draw % complete
61 | g.DrawString(pbComplete + "%", new Font("Arial", pbHEIGHT / 2), Brushes.Black, new PointF(pbWIDTH / 2 - pbHEIGHT, pbHEIGHT / 10));
62 |
63 | //load bitmap in picturebox picboxPB
64 | picboxPB.Image = bmp;
65 |
66 | //update pbComplete
67 | //Note!
68 | //To keep things simple I am adding +1 to pbComplete every 50ms
69 | //You can change this as per your requirement :)
70 | pbComplete++;
71 | if (pbComplete > 100)
72 | {
73 | //dispose
74 | g.Dispose();
75 | t.Stop();
76 | }
77 |
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/src/CustomProgressBar/ReadMe.txt:
--------------------------------------------------------------------------------
1 | For this project I am using Visual Studio 2012 Express Edition.
2 | You can use any other version of VS.
3 |
4 | Project video
5 | http://youtu.be/ASuz_R_FUgs
6 |
7 | Have fun coding.
8 |
9 | stay happy and keep smiling :-)
10 |
11 | yusufshakeel
12 |
13 | https://www.facebook.com/yusufshakeel
14 | https://www.youtube.com/yusufshakeel
15 | https://plus.google.com/+YusufShakeel
16 | http://yusufshakeelblog.blogspot.in
17 | https://github.com/yusufshakeel
--------------------------------------------------------------------------------
/src/DigitalClock/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace DigitalClock
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.label1 = new System.Windows.Forms.Label();
32 | this.SuspendLayout();
33 | //
34 | // label1
35 | //
36 | this.label1.AutoSize = true;
37 | this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
38 | this.label1.Location = new System.Drawing.Point(12, 9);
39 | this.label1.Name = "label1";
40 | this.label1.Size = new System.Drawing.Size(284, 73);
41 | this.label1.TabIndex = 0;
42 | this.label1.Text = "00:00:00";
43 | //
44 | // Form1
45 | //
46 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
47 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
48 | this.ClientSize = new System.Drawing.Size(305, 97);
49 | this.Controls.Add(this.label1);
50 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
51 | this.MaximizeBox = false;
52 | this.Name = "Form1";
53 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
54 | this.Text = "Digital Clock";
55 | this.Load += new System.EventHandler(this.Form1_Load);
56 | this.ResumeLayout(false);
57 | this.PerformLayout();
58 |
59 | }
60 |
61 | #endregion
62 |
63 | private System.Windows.Forms.Label label1;
64 | }
65 | }
66 |
67 |
--------------------------------------------------------------------------------
/src/DigitalClock/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace DigitalClock
12 | {
13 | public partial class Form1 : Form
14 | {
15 | Timer t = new Timer();
16 |
17 | public Form1()
18 | {
19 | InitializeComponent();
20 | }
21 |
22 | private void Form1_Load(object sender, EventArgs e)
23 | {
24 | //timer interval
25 | t.Interval = 1000; //in milliseconds
26 |
27 | t.Tick += new EventHandler(this.t_Tick);
28 |
29 | //start timer when form loads
30 | t.Start(); //this will use t_Tick() method
31 | }
32 |
33 | //timer eventhandler
34 | private void t_Tick(object sender, EventArgs e)
35 | {
36 | //get current time
37 | int hh = DateTime.Now.Hour;
38 | int mm = DateTime.Now.Minute;
39 | int ss = DateTime.Now.Second;
40 |
41 | //time
42 | string time = "";
43 |
44 | //padding leading zero
45 | if (hh < 10)
46 | {
47 | time += "0" + hh;
48 | }
49 | else
50 | {
51 | time += hh;
52 | }
53 | time += ":";
54 |
55 | if (mm < 10)
56 | {
57 | time += "0" + mm;
58 | }
59 | else
60 | {
61 | time += mm;
62 | }
63 | time += ":";
64 |
65 | if (ss < 10)
66 | {
67 | time += "0" + ss;
68 | }
69 | else
70 | {
71 | time += ss;
72 | }
73 |
74 | //update label
75 | label1.Text = time;
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/DigitalClock/ReadMe.txt:
--------------------------------------------------------------------------------
1 | For this project I am using Visual Studio 2012 Express Edition.
2 | You can use any other version of VS.
3 |
4 | Project video
5 | http://youtu.be/bglYDCdoBCg
6 |
7 | Have fun coding.
8 |
9 | stay happy and keep smiling :-)
10 |
11 | yusufshakeel
12 |
13 | https://www.facebook.com/yusufshakeel
14 | https://www.youtube.com/yusufshakeel
15 | https://plus.google.com/+YusufShakeel
16 | http://yusufshakeelblog.blogspot.in
17 | https://github.com/yusufshakeel
--------------------------------------------------------------------------------
/src/Grayscale/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Grayscale
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.pictureBox1 = new System.Windows.Forms.PictureBox();
32 | this.pictureBox2 = new System.Windows.Forms.PictureBox();
33 | this.label1 = new System.Windows.Forms.Label();
34 | this.label2 = new System.Windows.Forms.Label();
35 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
36 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
37 | this.SuspendLayout();
38 | //
39 | // pictureBox1
40 | //
41 | this.pictureBox1.Location = new System.Drawing.Point(12, 12);
42 | this.pictureBox1.Name = "pictureBox1";
43 | this.pictureBox1.Size = new System.Drawing.Size(285, 300);
44 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
45 | this.pictureBox1.TabIndex = 0;
46 | this.pictureBox1.TabStop = false;
47 | //
48 | // pictureBox2
49 | //
50 | this.pictureBox2.Location = new System.Drawing.Point(327, 12);
51 | this.pictureBox2.Name = "pictureBox2";
52 | this.pictureBox2.Size = new System.Drawing.Size(285, 300);
53 | this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
54 | this.pictureBox2.TabIndex = 1;
55 | this.pictureBox2.TabStop = false;
56 | //
57 | // label1
58 | //
59 | this.label1.AutoSize = true;
60 | this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
61 | this.label1.Location = new System.Drawing.Point(108, 330);
62 | this.label1.Name = "label1";
63 | this.label1.Size = new System.Drawing.Size(75, 24);
64 | this.label1.TabIndex = 2;
65 | this.label1.Text = "Original";
66 | //
67 | // label2
68 | //
69 | this.label2.AutoSize = true;
70 | this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
71 | this.label2.Location = new System.Drawing.Point(431, 330);
72 | this.label2.Name = "label2";
73 | this.label2.Size = new System.Drawing.Size(93, 24);
74 | this.label2.TabIndex = 3;
75 | this.label2.Text = "Grayscale";
76 | //
77 | // Form1
78 | //
79 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
80 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
81 | this.ClientSize = new System.Drawing.Size(624, 363);
82 | this.Controls.Add(this.label2);
83 | this.Controls.Add(this.label1);
84 | this.Controls.Add(this.pictureBox2);
85 | this.Controls.Add(this.pictureBox1);
86 | this.Name = "Form1";
87 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
88 | this.Text = "Grayscale";
89 | this.Load += new System.EventHandler(this.Form1_Load);
90 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
91 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
92 | this.ResumeLayout(false);
93 | this.PerformLayout();
94 |
95 | }
96 |
97 | #endregion
98 |
99 | private System.Windows.Forms.PictureBox pictureBox1;
100 | private System.Windows.Forms.PictureBox pictureBox2;
101 | private System.Windows.Forms.Label label1;
102 | private System.Windows.Forms.Label label2;
103 | }
104 | }
105 |
106 |
--------------------------------------------------------------------------------
/src/Grayscale/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Grayscale
12 | {
13 | public partial class Form1 : Form
14 | {
15 | public Form1()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | private void Form1_Load(object sender, EventArgs e)
21 | {
22 | //read image
23 | Bitmap bmp = new Bitmap("D:\\Image\\Taj.jpg");
24 |
25 | //load original image in picturebox1
26 | pictureBox1.Image = Image.FromFile("D:\\Image\\Taj.jpg");
27 |
28 | //get image dimension
29 | int width = bmp.Width;
30 | int height = bmp.Height;
31 |
32 | //color of pixel
33 | Color p;
34 |
35 | //grayscale
36 | for (int y = 0; y < height; y++)
37 | {
38 | for (int x = 0; x < width; x++)
39 | {
40 | //get pixel value
41 | p = bmp.GetPixel(x, y);
42 |
43 | //extract pixel component ARGB
44 | int a = p.A;
45 | int r = p.R;
46 | int g = p.G;
47 | int b = p.B;
48 |
49 | //find average
50 | int avg = (r + g + b) / 3;
51 |
52 | //set new pixel value
53 | bmp.SetPixel(x, y, Color.FromArgb(a, avg, avg, avg));
54 | }
55 | }
56 |
57 | //load grayscale image in picturebox2
58 | pictureBox2.Image = bmp;
59 |
60 | //write the grayscale image
61 | bmp.Save("D:\\Image\\Grayscale.png");
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/Grayscale/ReadMe.txt:
--------------------------------------------------------------------------------
1 | For this project I am using Visual Studio 2012 Express Edition.
2 | You can use any other version of VS.
3 |
4 | Project video
5 | http://youtu.be/N0b67Q-Djao
6 |
7 | Have fun coding.
8 |
9 | stay happy and keep smiling :-)
10 |
11 | yusufshakeel
12 |
13 | https://www.facebook.com/yusufshakeel
14 | https://www.youtube.com/yusufshakeel
15 | https://plus.google.com/+YusufShakeel
16 | http://yusufshakeelblog.blogspot.in
17 | https://github.com/yusufshakeel
--------------------------------------------------------------------------------
/src/ImageViewer/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ImageViewer
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.menuStrip1 = new System.Windows.Forms.MenuStrip();
32 | this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
33 | this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
34 | this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
35 | this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
36 | this.pictureBox1 = new System.Windows.Forms.PictureBox();
37 | this.menuStrip1.SuspendLayout();
38 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
39 | this.SuspendLayout();
40 | //
41 | // menuStrip1
42 | //
43 | this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
44 | this.fileToolStripMenuItem});
45 | this.menuStrip1.Location = new System.Drawing.Point(0, 0);
46 | this.menuStrip1.Name = "menuStrip1";
47 | this.menuStrip1.Size = new System.Drawing.Size(284, 24);
48 | this.menuStrip1.TabIndex = 0;
49 | this.menuStrip1.Text = "menuStrip1";
50 | //
51 | // fileToolStripMenuItem
52 | //
53 | this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
54 | this.openToolStripMenuItem,
55 | this.saveAsToolStripMenuItem,
56 | this.exitToolStripMenuItem});
57 | this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
58 | this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
59 | this.fileToolStripMenuItem.Text = "File";
60 | //
61 | // openToolStripMenuItem
62 | //
63 | this.openToolStripMenuItem.Name = "openToolStripMenuItem";
64 | this.openToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
65 | this.openToolStripMenuItem.Text = "Open";
66 | this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
67 | //
68 | // saveAsToolStripMenuItem
69 | //
70 | this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
71 | this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
72 | this.saveAsToolStripMenuItem.Text = "Save As";
73 | this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click);
74 | //
75 | // exitToolStripMenuItem
76 | //
77 | this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
78 | this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
79 | this.exitToolStripMenuItem.Text = "Exit";
80 | this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
81 | //
82 | // pictureBox1
83 | //
84 | this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
85 | this.pictureBox1.Location = new System.Drawing.Point(0, 24);
86 | this.pictureBox1.Name = "pictureBox1";
87 | this.pictureBox1.Size = new System.Drawing.Size(284, 238);
88 | this.pictureBox1.TabIndex = 1;
89 | this.pictureBox1.TabStop = false;
90 | //
91 | // Form1
92 | //
93 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
94 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
95 | this.ClientSize = new System.Drawing.Size(284, 262);
96 | this.Controls.Add(this.pictureBox1);
97 | this.Controls.Add(this.menuStrip1);
98 | this.MainMenuStrip = this.menuStrip1;
99 | this.Name = "Form1";
100 | this.Text = "ImageViewer";
101 | this.menuStrip1.ResumeLayout(false);
102 | this.menuStrip1.PerformLayout();
103 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
104 | this.ResumeLayout(false);
105 | this.PerformLayout();
106 |
107 | }
108 |
109 | #endregion
110 |
111 | private System.Windows.Forms.MenuStrip menuStrip1;
112 | private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
113 | private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
114 | private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem;
115 | private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
116 | private System.Windows.Forms.PictureBox pictureBox1;
117 | }
118 | }
119 |
120 |
--------------------------------------------------------------------------------
/src/ImageViewer/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace ImageViewer
12 | {
13 | public partial class Form1 : Form
14 | {
15 | public Form1()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | private void openToolStripMenuItem_Click(object sender, EventArgs e)
21 | {
22 | OpenFileDialog ofd = new OpenFileDialog();
23 | ofd.Filter = "jpg (*.jpg)|*.jpg|bmp (*.bmp)|*.bmp|png (*.png)|*.png";
24 |
25 | if (ofd.ShowDialog() == DialogResult.OK && ofd.FileName.Length > 0)
26 | {
27 | pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
28 | pictureBox1.Image = Image.FromFile(ofd.FileName);
29 | }
30 | }
31 |
32 | private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
33 | {
34 | SaveFileDialog sfd = new SaveFileDialog();
35 | sfd.Filter = "jpg (*.jpg)|*.jpg|bmp (*.bmp)|*.bmp|png (*.png)|*.png";
36 |
37 | if (sfd.ShowDialog() == DialogResult.OK && sfd.FileName.Length > 0)
38 | {
39 | pictureBox1.Image.Save(sfd.FileName);
40 | }
41 | }
42 |
43 | private void exitToolStripMenuItem_Click(object sender, EventArgs e)
44 | {
45 | Application.Exit();
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/ImageViewer/ReadMe.txt:
--------------------------------------------------------------------------------
1 | For this project I am using Visual Studio 2012 Express Edition.
2 | You can use any other version of VS.
3 |
4 | Project video
5 | https://www.youtube.com/watch?v=7kCXe-VGSZo&list=PLG6ePePp5vvYuLDHpvaT0YwqPG88P6MCd&index=3
6 |
7 | Have fun coding.
8 |
9 | stay happy and keep smiling :-)
10 |
11 | yusufshakeel
12 |
13 | https://www.facebook.com/yusufshakeel
14 | https://www.youtube.com/yusufshakeel
15 | https://plus.google.com/+YusufShakeel
16 | http://yusufshakeelblog.blogspot.in
17 | https://github.com/yusufshakeel
--------------------------------------------------------------------------------
/src/MatrixScreen/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace MatrixScreen
8 | {
9 | class Program
10 | {
11 | static void Main(string[] args)
12 | {
13 | //set text color
14 | Console.ForegroundColor = ConsoleColor.Green;
15 |
16 | //random number
17 | Random rand = new Random();
18 |
19 | //string pattern to print
20 | String str = "";
21 |
22 | Console.Write("Press ENTER to start...");
23 | Console.ReadKey();
24 |
25 | //loop to display string pattern
26 | //you can change the no. of times the loop execute
27 | for (int i = 0; i < 20000; i++)
28 | {
29 | //create new string pattern
30 | if (i % 2 == 0)
31 | {
32 | str = "";
33 | for (int j = 0; j < 79; j++)
34 | {
35 | int n = rand.Next(5);
36 | if (n < 2)
37 | {
38 | str += n.ToString();
39 | }
40 | else
41 | {
42 | str += " ";
43 | }
44 | }
45 | }
46 |
47 | //print str pattern
48 | Console.WriteLine(str);
49 | }
50 |
51 | //end of loop
52 | Console.WriteLine("End of screen...");
53 | Console.Write("Press any key to exit...");
54 | Console.ReadKey();
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/MatrixScreen/ReadMe.txt:
--------------------------------------------------------------------------------
1 | For this project I am using Visual Studio 2012 Express Edition.
2 | You can use any other version of VS.
3 |
4 | Project video
5 | http://youtu.be/fKpL-AzRVXw
6 |
7 | Have fun coding.
8 |
9 | stay happy and keep smiling :-)
10 |
11 | yusufshakeel
12 |
13 | https://www.facebook.com/yusufshakeel
14 | https://www.youtube.com/yusufshakeel
15 | https://plus.google.com/+YusufShakeel
16 | http://yusufshakeelblog.blogspot.in
17 | https://github.com/yusufshakeel
--------------------------------------------------------------------------------
/src/MatrixScreen2/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace MatrixScreen2
8 | {
9 | class Program
10 | {
11 | static void Main(string[] args)
12 | {
13 | Random rand = new Random();
14 | Console.Write("Press ENTER to start...");
15 | Console.ReadKey();
16 | for (int i = 0; i < 1000; i++)
17 | {
18 | for (int j = 1; j <= 7; j++)
19 | {
20 | for (int s = 1; s <= 8; s++)
21 | {
22 | if (rand.Next(10) > 5)
23 | {
24 | Console.ForegroundColor = ConsoleColor.Green;
25 | }
26 | else
27 | {
28 | Console.ForegroundColor = ConsoleColor.DarkGreen;
29 | }
30 |
31 | int n = rand.Next(2);
32 | Console.Write(n);
33 | }
34 | if (j != 7)
35 | {
36 | Console.Write(" ");
37 | }
38 | }
39 | }
40 | Console.ResetColor();
41 | Console.ReadKey();
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/MatrixScreen2/ReadMe.txt:
--------------------------------------------------------------------------------
1 | For this project I am using Visual Studio 2012 Express Edition.
2 | You can use any other version of VS.
3 |
4 | Project video
5 | http://youtu.be/xfwG0ZtMgcQ
6 |
7 | Have fun coding.
8 |
9 | stay happy and keep smiling :-)
10 |
11 | yusufshakeel
12 |
13 | https://www.facebook.com/yusufshakeel
14 | https://www.youtube.com/yusufshakeel
15 | https://plus.google.com/+YusufShakeel
16 | http://yusufshakeelblog.blogspot.in
17 | https://github.com/yusufshakeel
--------------------------------------------------------------------------------
/src/MirrorImage/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace MirrorImage
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.pictureBox1 = new System.Windows.Forms.PictureBox();
32 | this.pictureBox2 = new System.Windows.Forms.PictureBox();
33 | this.label1 = new System.Windows.Forms.Label();
34 | this.label2 = new System.Windows.Forms.Label();
35 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
36 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
37 | this.SuspendLayout();
38 | //
39 | // pictureBox1
40 | //
41 | this.pictureBox1.Location = new System.Drawing.Point(12, 12);
42 | this.pictureBox1.Name = "pictureBox1";
43 | this.pictureBox1.Size = new System.Drawing.Size(269, 325);
44 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
45 | this.pictureBox1.TabIndex = 0;
46 | this.pictureBox1.TabStop = false;
47 | //
48 | // pictureBox2
49 | //
50 | this.pictureBox2.Location = new System.Drawing.Point(287, 12);
51 | this.pictureBox2.Name = "pictureBox2";
52 | this.pictureBox2.Size = new System.Drawing.Size(467, 325);
53 | this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
54 | this.pictureBox2.TabIndex = 1;
55 | this.pictureBox2.TabStop = false;
56 | //
57 | // label1
58 | //
59 | this.label1.AutoSize = true;
60 | this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
61 | this.label1.Location = new System.Drawing.Point(97, 340);
62 | this.label1.Name = "label1";
63 | this.label1.Size = new System.Drawing.Size(86, 25);
64 | this.label1.TabIndex = 2;
65 | this.label1.Text = "Original";
66 | //
67 | // label2
68 | //
69 | this.label2.AutoSize = true;
70 | this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
71 | this.label2.Location = new System.Drawing.Point(481, 340);
72 | this.label2.Name = "label2";
73 | this.label2.Size = new System.Drawing.Size(68, 25);
74 | this.label2.TabIndex = 3;
75 | this.label2.Text = "Mirror";
76 | //
77 | // Form1
78 | //
79 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
80 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
81 | this.ClientSize = new System.Drawing.Size(766, 387);
82 | this.Controls.Add(this.label2);
83 | this.Controls.Add(this.label1);
84 | this.Controls.Add(this.pictureBox2);
85 | this.Controls.Add(this.pictureBox1);
86 | this.Name = "Form1";
87 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
88 | this.Text = "Mirror Image";
89 | this.Load += new System.EventHandler(this.Form1_Load);
90 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
91 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
92 | this.ResumeLayout(false);
93 | this.PerformLayout();
94 |
95 | }
96 |
97 | #endregion
98 |
99 | private System.Windows.Forms.PictureBox pictureBox1;
100 | private System.Windows.Forms.PictureBox pictureBox2;
101 | private System.Windows.Forms.Label label1;
102 | private System.Windows.Forms.Label label2;
103 | }
104 | }
105 |
106 |
--------------------------------------------------------------------------------
/src/MirrorImage/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace MirrorImage
12 | {
13 | public partial class Form1 : Form
14 | {
15 | public Form1()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | private void Form1_Load(object sender, EventArgs e)
21 | {
22 | //read source image
23 | Bitmap simg = new Bitmap("D:\\Image\\audrey.jpg");
24 |
25 | //get source image dimension
26 | int width = simg.Width;
27 | int height = simg.Height;
28 |
29 | //load source image in picturebox1
30 | pictureBox1.Image = Image.FromFile("D:\\Image\\audrey.jpg");
31 |
32 | //mirror image
33 | Bitmap mimg = new Bitmap(width * 2, height);
34 |
35 | for (int y = 0; y < height; y++)
36 | {
37 | for (int lx = 0, rx = width * 2 - 1; lx < width; lx++, rx--)
38 | {
39 | //get source pixel value
40 | Color p = simg.GetPixel(lx, y);
41 |
42 | //set mirror pixel value
43 | mimg.SetPixel(lx, y, p);
44 | mimg.SetPixel(rx, y, p);
45 | }
46 | }
47 |
48 | //load mirror image in picturebox2
49 | pictureBox2.Image = mimg;
50 |
51 | //save (write) mirror image
52 | mimg.Save("D:\\Image\\MirrorImage.png");
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/MirrorImage/ReadMe.txt:
--------------------------------------------------------------------------------
1 | For this project I am using Visual Studio 2012 Express Edition.
2 | You can use any other version of VS.
3 |
4 | Project video
5 | http://youtu.be/bq0jUjFgnEQ
6 |
7 |
8 | Have fun coding.
9 |
10 | stay happy and keep smiling :-)
11 |
12 | yusufshakeel
13 |
14 | https://www.facebook.com/yusufshakeel
15 | https://www.youtube.com/yusufshakeel
16 | https://plus.google.com/+YusufShakeel
17 | http://yusufshakeelblog.blogspot.in
18 | https://github.com/yusufshakeel
--------------------------------------------------------------------------------
/src/NegativeImage/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace NegativeImage
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.pictureBox1 = new System.Windows.Forms.PictureBox();
32 | this.pictureBox2 = new System.Windows.Forms.PictureBox();
33 | this.label1 = new System.Windows.Forms.Label();
34 | this.label2 = new System.Windows.Forms.Label();
35 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
36 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
37 | this.SuspendLayout();
38 | //
39 | // pictureBox1
40 | //
41 | this.pictureBox1.Location = new System.Drawing.Point(12, 12);
42 | this.pictureBox1.Name = "pictureBox1";
43 | this.pictureBox1.Size = new System.Drawing.Size(297, 343);
44 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
45 | this.pictureBox1.TabIndex = 0;
46 | this.pictureBox1.TabStop = false;
47 | //
48 | // pictureBox2
49 | //
50 | this.pictureBox2.Location = new System.Drawing.Point(329, 12);
51 | this.pictureBox2.Name = "pictureBox2";
52 | this.pictureBox2.Size = new System.Drawing.Size(297, 343);
53 | this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
54 | this.pictureBox2.TabIndex = 1;
55 | this.pictureBox2.TabStop = false;
56 | //
57 | // label1
58 | //
59 | this.label1.AutoSize = true;
60 | this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
61 | this.label1.Location = new System.Drawing.Point(122, 368);
62 | this.label1.Name = "label1";
63 | this.label1.Size = new System.Drawing.Size(75, 24);
64 | this.label1.TabIndex = 2;
65 | this.label1.Text = "Original";
66 | //
67 | // label2
68 | //
69 | this.label2.AutoSize = true;
70 | this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
71 | this.label2.Location = new System.Drawing.Point(431, 368);
72 | this.label2.Name = "label2";
73 | this.label2.Size = new System.Drawing.Size(84, 24);
74 | this.label2.TabIndex = 3;
75 | this.label2.Text = "Negative";
76 | //
77 | // Form1
78 | //
79 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
80 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
81 | this.ClientSize = new System.Drawing.Size(638, 410);
82 | this.Controls.Add(this.label2);
83 | this.Controls.Add(this.label1);
84 | this.Controls.Add(this.pictureBox2);
85 | this.Controls.Add(this.pictureBox1);
86 | this.Name = "Form1";
87 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
88 | this.Text = "Negative";
89 | this.Load += new System.EventHandler(this.Form1_Load);
90 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
91 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
92 | this.ResumeLayout(false);
93 | this.PerformLayout();
94 |
95 | }
96 |
97 | #endregion
98 |
99 | private System.Windows.Forms.PictureBox pictureBox1;
100 | private System.Windows.Forms.PictureBox pictureBox2;
101 | private System.Windows.Forms.Label label1;
102 | private System.Windows.Forms.Label label2;
103 | }
104 | }
105 |
106 |
--------------------------------------------------------------------------------
/src/NegativeImage/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace NegativeImage
12 | {
13 | public partial class Form1 : Form
14 | {
15 | public Form1()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | private void Form1_Load(object sender, EventArgs e)
21 | {
22 | //read image
23 | Bitmap bmp = new Bitmap("D:\\Image\\Taj.jpg");
24 |
25 | //load image in picturebox1
26 | pictureBox1.Image = Image.FromFile("D:\\Image\\Taj.jpg");
27 |
28 | //get image dimension
29 | int width = bmp.Width;
30 | int height = bmp.Height;
31 |
32 | //negative
33 | for (int y = 0; y < height; y++)
34 | {
35 | for (int x = 0; x < width; x++)
36 | {
37 | //get pixel value
38 | Color p = bmp.GetPixel(x, y);
39 |
40 | //extract ARGB value from p
41 | int a = p.A;
42 | int r = p.R;
43 | int g = p.G;
44 | int b = p.B;
45 |
46 | //find negative value
47 | r = 255 - r;
48 | g = 255 - g;
49 | b = 255 - b;
50 |
51 | //set new ARGB value in pixel
52 | bmp.SetPixel(x, y, Color.FromArgb(a, r, g, b));
53 | }
54 | }
55 |
56 | //load negative image in picturebox2
57 | pictureBox2.Image = bmp;
58 |
59 | //save negative image
60 | bmp.Save("D:\\Image\\Negative.png");
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/NegativeImage/ReadMe.txt:
--------------------------------------------------------------------------------
1 | For this project I am using Visual Studio 2012 Express Edition.
2 | You can use any other version of VS.
3 |
4 | Project video
5 | http://youtu.be/LfI8ltMmOAk
6 |
7 |
8 | Have fun coding.
9 |
10 | stay happy and keep smiling :-)
11 |
12 | yusufshakeel
13 |
14 | https://www.facebook.com/yusufshakeel
15 | https://www.youtube.com/yusufshakeel
16 | https://plus.google.com/+YusufShakeel
17 | http://yusufshakeelblog.blogspot.in
18 | https://github.com/yusufshakeel
--------------------------------------------------------------------------------
/src/RandomPixelImage/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace RandomPixelImage
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.pictureBox1 = new System.Windows.Forms.PictureBox();
32 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
33 | this.SuspendLayout();
34 | //
35 | // pictureBox1
36 | //
37 | this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
38 | this.pictureBox1.Location = new System.Drawing.Point(0, 0);
39 | this.pictureBox1.Name = "pictureBox1";
40 | this.pictureBox1.Size = new System.Drawing.Size(381, 327);
41 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
42 | this.pictureBox1.TabIndex = 0;
43 | this.pictureBox1.TabStop = false;
44 | //
45 | // Form1
46 | //
47 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
48 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
49 | this.ClientSize = new System.Drawing.Size(381, 327);
50 | this.Controls.Add(this.pictureBox1);
51 | this.Name = "Form1";
52 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
53 | this.Text = "Random Pixel Image";
54 | this.Load += new System.EventHandler(this.Form1_Load);
55 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
56 | this.ResumeLayout(false);
57 |
58 | }
59 |
60 | #endregion
61 |
62 | private System.Windows.Forms.PictureBox pictureBox1;
63 | }
64 | }
65 |
66 |
--------------------------------------------------------------------------------
/src/RandomPixelImage/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace RandomPixelImage
12 | {
13 | public partial class Form1 : Form
14 | {
15 | public Form1()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | private void Form1_Load(object sender, EventArgs e)
21 | {
22 | int width = 640, height = 320;
23 |
24 | //bitmap
25 | Bitmap bmp = new Bitmap(width, height);
26 |
27 | //random number
28 | Random rand = new Random();
29 |
30 | //create random pixels
31 | for (int y = 0; y < height; y++)
32 | {
33 | for (int x = 0; x < width; x++)
34 | {
35 | //generate random ARGB value
36 | int a = rand.Next(256);
37 | int r = rand.Next(256);
38 | int g = rand.Next(256);
39 | int b = rand.Next(256);
40 |
41 | //set ARGB value
42 | bmp.SetPixel(x, y, Color.FromArgb(a, r, g, b));
43 | }
44 | }
45 |
46 | //load bmp in picturebox1
47 | pictureBox1.Image = bmp;
48 |
49 | //save (write) random pixel image
50 | bmp.Save("D:\\Image\\RandomImage.png");
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/RandomPixelImage/ReadMe.txt:
--------------------------------------------------------------------------------
1 | For this project I am using Visual Studio 2012 Express Edition.
2 | You can use any other version of VS.
3 |
4 | Project video
5 | http://youtu.be/e-qltHrbqGE
6 |
7 |
8 | Have fun coding.
9 |
10 | stay happy and keep smiling :-)
11 |
12 | yusufshakeel
13 |
14 | https://www.facebook.com/yusufshakeel
15 | https://www.youtube.com/yusufshakeel
16 | https://plus.google.com/+YusufShakeel
17 | http://yusufshakeelblog.blogspot.in
18 | https://github.com/yusufshakeel
--------------------------------------------------------------------------------
/src/ReadWriteImage/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace ReadWriteImage
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.pictureBox1 = new System.Windows.Forms.PictureBox();
32 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
33 | this.SuspendLayout();
34 | //
35 | // pictureBox1
36 | //
37 | this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
38 | this.pictureBox1.Location = new System.Drawing.Point(0, 0);
39 | this.pictureBox1.Name = "pictureBox1";
40 | this.pictureBox1.Size = new System.Drawing.Size(495, 312);
41 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
42 | this.pictureBox1.TabIndex = 0;
43 | this.pictureBox1.TabStop = false;
44 | //
45 | // Form1
46 | //
47 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
48 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
49 | this.ClientSize = new System.Drawing.Size(495, 312);
50 | this.Controls.Add(this.pictureBox1);
51 | this.Name = "Form1";
52 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
53 | this.Text = "Read Write Image";
54 | this.Load += new System.EventHandler(this.Form1_Load);
55 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
56 | this.ResumeLayout(false);
57 |
58 | }
59 |
60 | #endregion
61 |
62 | private System.Windows.Forms.PictureBox pictureBox1;
63 | }
64 | }
65 |
66 |
--------------------------------------------------------------------------------
/src/ReadWriteImage/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace ReadWriteImage
12 | {
13 | public partial class Form1 : Form
14 | {
15 | public Form1()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | private void Form1_Load(object sender, EventArgs e)
21 | {
22 | //read image
23 | Bitmap bmp = new Bitmap("D:\\Image\\Taj.jpg");
24 |
25 | //load image in picturebox
26 | pictureBox1.Image = bmp;
27 |
28 | //write image
29 | bmp.Save("D:\\Image\\Output.png");
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/ReadWriteImage/ReadMe.txt:
--------------------------------------------------------------------------------
1 | For this project I am using Visual Studio 2012 Express Edition.
2 | You can use any other version of VS.
3 |
4 | Project video
5 | https://www.youtube.com/watch?v=EYf3Teh0nqM
6 |
7 |
8 | Have fun coding.
9 |
10 | stay happy and keep smiling :-)
11 |
12 | yusufshakeel
13 |
14 | https://www.facebook.com/yusufshakeel
15 | https://www.youtube.com/yusufshakeel
16 | https://plus.google.com/+YusufShakeel
17 | http://yusufshakeelblog.blogspot.in
18 | https://github.com/yusufshakeel
--------------------------------------------------------------------------------
/src/RedGreenBlueImage/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace RedGreenBlueImage
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.pictureBox1 = new System.Windows.Forms.PictureBox();
32 | this.pictureBox2 = new System.Windows.Forms.PictureBox();
33 | this.pictureBox3 = new System.Windows.Forms.PictureBox();
34 | this.pictureBox4 = new System.Windows.Forms.PictureBox();
35 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
36 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
37 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
38 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
39 | this.SuspendLayout();
40 | //
41 | // pictureBox1
42 | //
43 | this.pictureBox1.Location = new System.Drawing.Point(12, 12);
44 | this.pictureBox1.Name = "pictureBox1";
45 | this.pictureBox1.Size = new System.Drawing.Size(230, 184);
46 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
47 | this.pictureBox1.TabIndex = 0;
48 | this.pictureBox1.TabStop = false;
49 | //
50 | // pictureBox2
51 | //
52 | this.pictureBox2.Location = new System.Drawing.Point(248, 12);
53 | this.pictureBox2.Name = "pictureBox2";
54 | this.pictureBox2.Size = new System.Drawing.Size(230, 184);
55 | this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
56 | this.pictureBox2.TabIndex = 1;
57 | this.pictureBox2.TabStop = false;
58 | //
59 | // pictureBox3
60 | //
61 | this.pictureBox3.Location = new System.Drawing.Point(12, 202);
62 | this.pictureBox3.Name = "pictureBox3";
63 | this.pictureBox3.Size = new System.Drawing.Size(230, 184);
64 | this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
65 | this.pictureBox3.TabIndex = 2;
66 | this.pictureBox3.TabStop = false;
67 | //
68 | // pictureBox4
69 | //
70 | this.pictureBox4.Location = new System.Drawing.Point(248, 202);
71 | this.pictureBox4.Name = "pictureBox4";
72 | this.pictureBox4.Size = new System.Drawing.Size(230, 184);
73 | this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
74 | this.pictureBox4.TabIndex = 3;
75 | this.pictureBox4.TabStop = false;
76 | //
77 | // Form1
78 | //
79 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
80 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
81 | this.ClientSize = new System.Drawing.Size(493, 412);
82 | this.Controls.Add(this.pictureBox4);
83 | this.Controls.Add(this.pictureBox3);
84 | this.Controls.Add(this.pictureBox2);
85 | this.Controls.Add(this.pictureBox1);
86 | this.Name = "Form1";
87 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
88 | this.Text = "Red Green Blue Image";
89 | this.Load += new System.EventHandler(this.Form1_Load);
90 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
91 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
92 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
93 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
94 | this.ResumeLayout(false);
95 |
96 | }
97 |
98 | #endregion
99 |
100 | private System.Windows.Forms.PictureBox pictureBox1;
101 | private System.Windows.Forms.PictureBox pictureBox2;
102 | private System.Windows.Forms.PictureBox pictureBox3;
103 | private System.Windows.Forms.PictureBox pictureBox4;
104 | }
105 | }
106 |
107 |
--------------------------------------------------------------------------------
/src/RedGreenBlueImage/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace RedGreenBlueImage
12 | {
13 | public partial class Form1 : Form
14 | {
15 | public Form1()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | private void Form1_Load(object sender, EventArgs e)
21 | {
22 | //image path
23 | string img = "D:\\Image\\Taj.jpg";
24 |
25 | //read image
26 | Bitmap bmp = new Bitmap(img);
27 |
28 | //load original image in picturebox1
29 | pictureBox1.Image = Image.FromFile(img);
30 |
31 | //get image dimension
32 | int width = bmp.Width;
33 | int height = bmp.Height;
34 |
35 | //3 bitmap for red green blue image
36 | Bitmap rbmp = new Bitmap(bmp);
37 | Bitmap gbmp = new Bitmap(bmp);
38 | Bitmap bbmp = new Bitmap(bmp);
39 |
40 | //red green blue image
41 | for (int y = 0; y < height; y++)
42 | {
43 | for (int x = 0; x < width; x++)
44 | {
45 | //get pixel value
46 | Color p = bmp.GetPixel(x, y);
47 |
48 | //extract ARGB value from p
49 | int a = p.A;
50 | int r = p.R;
51 | int g = p.G;
52 | int b = p.B;
53 |
54 | //set red image pixel
55 | rbmp.SetPixel(x, y, Color.FromArgb(a, r, 0, 0));
56 |
57 | //set green image pixel
58 | gbmp.SetPixel(x, y, Color.FromArgb(a, 0, g, 0));
59 |
60 | //set blue image pixel
61 | bbmp.SetPixel(x, y, Color.FromArgb(a, 0, 0, b));
62 |
63 | }
64 | }
65 |
66 | //load red image in picturebox2
67 | pictureBox2.Image = rbmp;
68 |
69 | //load green image in picturebox3
70 | pictureBox3.Image = gbmp;
71 |
72 | //load blue image in picturebox4
73 | pictureBox4.Image = bbmp;
74 |
75 | //write (save) red image
76 | rbmp.Save("D:\\Image\\Red.png");
77 |
78 | //write(save) green image
79 | gbmp.Save("D:\\Image\\Green.png");
80 |
81 | //write (save) blue image
82 | bbmp.Save("D:\\Image\\Blue.png");
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/RedGreenBlueImage/ReadMe.txt:
--------------------------------------------------------------------------------
1 | For this project I am using Visual Studio 2012 Express Edition.
2 | You can use any other version of VS.
3 |
4 | Project video
5 | http://youtu.be/Sx0sTWKvkz4
6 |
7 |
8 | Have fun coding.
9 |
10 | stay happy and keep smiling :-)
11 |
12 | yusufshakeel
13 |
14 | https://www.facebook.com/yusufshakeel
15 | https://www.youtube.com/yusufshakeel
16 | https://plus.google.com/+YusufShakeel
17 | http://yusufshakeelblog.blogspot.in
18 | https://github.com/yusufshakeel
--------------------------------------------------------------------------------
/src/Sepia/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace Sepia
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.pictureBox1 = new System.Windows.Forms.PictureBox();
32 | this.pictureBox2 = new System.Windows.Forms.PictureBox();
33 | this.label1 = new System.Windows.Forms.Label();
34 | this.label2 = new System.Windows.Forms.Label();
35 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
36 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
37 | this.SuspendLayout();
38 | //
39 | // pictureBox1
40 | //
41 | this.pictureBox1.Location = new System.Drawing.Point(12, 12);
42 | this.pictureBox1.Name = "pictureBox1";
43 | this.pictureBox1.Size = new System.Drawing.Size(328, 368);
44 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
45 | this.pictureBox1.TabIndex = 0;
46 | this.pictureBox1.TabStop = false;
47 | //
48 | // pictureBox2
49 | //
50 | this.pictureBox2.Location = new System.Drawing.Point(363, 12);
51 | this.pictureBox2.Name = "pictureBox2";
52 | this.pictureBox2.Size = new System.Drawing.Size(328, 368);
53 | this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
54 | this.pictureBox2.TabIndex = 1;
55 | this.pictureBox2.TabStop = false;
56 | //
57 | // label1
58 | //
59 | this.label1.AutoSize = true;
60 | this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
61 | this.label1.Location = new System.Drawing.Point(112, 383);
62 | this.label1.Name = "label1";
63 | this.label1.Size = new System.Drawing.Size(75, 24);
64 | this.label1.TabIndex = 2;
65 | this.label1.Text = "Original";
66 | //
67 | // label2
68 | //
69 | this.label2.AutoSize = true;
70 | this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
71 | this.label2.Location = new System.Drawing.Point(499, 383);
72 | this.label2.Name = "label2";
73 | this.label2.Size = new System.Drawing.Size(58, 24);
74 | this.label2.TabIndex = 3;
75 | this.label2.Text = "Sepia";
76 | //
77 | // Form1
78 | //
79 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
80 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
81 | this.ClientSize = new System.Drawing.Size(703, 414);
82 | this.Controls.Add(this.label2);
83 | this.Controls.Add(this.label1);
84 | this.Controls.Add(this.pictureBox2);
85 | this.Controls.Add(this.pictureBox1);
86 | this.Name = "Form1";
87 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
88 | this.Text = "Sepia";
89 | this.Load += new System.EventHandler(this.Form1_Load);
90 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
91 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
92 | this.ResumeLayout(false);
93 | this.PerformLayout();
94 |
95 | }
96 |
97 | #endregion
98 |
99 | private System.Windows.Forms.PictureBox pictureBox1;
100 | private System.Windows.Forms.PictureBox pictureBox2;
101 | private System.Windows.Forms.Label label1;
102 | private System.Windows.Forms.Label label2;
103 | }
104 | }
105 |
106 |
--------------------------------------------------------------------------------
/src/Sepia/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace Sepia
12 | {
13 | public partial class Form1 : Form
14 | {
15 | public Form1()
16 | {
17 | InitializeComponent();
18 | }
19 |
20 | private void Form1_Load(object sender, EventArgs e)
21 | {
22 | //read image
23 | Bitmap bmp = new Bitmap("D:\\Image\\zeenat.jpg");
24 |
25 | //load original image in picturebox1
26 | pictureBox1.Image = Image.FromFile("D:\\Image\\zeenat.jpg");
27 |
28 | //get image dimension
29 | int width = bmp.Width;
30 | int height = bmp.Height;
31 |
32 | //color of pixel
33 | Color p;
34 |
35 | //sepia
36 | for (int y = 0; y < height; y++)
37 | {
38 | for (int x = 0; x < width; x++)
39 | {
40 | //get pixel value
41 | p = bmp.GetPixel(x, y);
42 |
43 | //extract pixel component ARGB
44 | int a = p.A;
45 | int r = p.R;
46 | int g = p.G;
47 | int b = p.B;
48 |
49 | //calculate temp value
50 | int tr = (int)(0.393 * r + 0.769 * g + 0.189 * b);
51 | int tg = (int)(0.349 * r + 0.686 * g + 0.168 * b);
52 | int tb = (int)(0.272 * r + 0.534 * g + 0.131 * b);
53 |
54 | //set new RGB value
55 | if (tr > 255)
56 | {
57 | r = 255;
58 | }
59 | else
60 | {
61 | r = tr;
62 | }
63 |
64 | if (tg > 255)
65 | {
66 | g = 255;
67 | }
68 | else
69 | {
70 | g = tg;
71 | }
72 |
73 | if (tb > 255)
74 | {
75 | b = 255;
76 | }
77 | else
78 | {
79 | b = tb;
80 | }
81 |
82 | //set the new RGB value in image pixel
83 | bmp.SetPixel(x, y, Color.FromArgb(a, r, g, b));
84 | }
85 | }
86 |
87 | //load sepia image in picturebox2
88 | pictureBox2.Image = bmp;
89 |
90 | //save (write) sepia image
91 | bmp.Save("D:\\Image\\Sepia.png");
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/src/Sepia/ReadMe.txt:
--------------------------------------------------------------------------------
1 | For this project I am using Visual Studio 2012 Express Edition.
2 | You can use any other version of VS.
3 |
4 | Project video
5 | http://youtu.be/ZgMtr1K92Uk
6 |
7 |
8 | Have fun coding.
9 |
10 | stay happy and keep smiling :-)
11 |
12 | yusufshakeel
13 |
14 | https://www.facebook.com/yusufshakeel
15 | https://www.youtube.com/yusufshakeel
16 | https://plus.google.com/+YusufShakeel
17 | http://yusufshakeelblog.blogspot.in
18 | https://github.com/yusufshakeel
--------------------------------------------------------------------------------
/src/SimpleRadar/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace SimpleRadar
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.pictureBox1 = new System.Windows.Forms.PictureBox();
32 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
33 | this.SuspendLayout();
34 | //
35 | // pictureBox1
36 | //
37 | this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
38 | this.pictureBox1.Location = new System.Drawing.Point(0, 0);
39 | this.pictureBox1.Name = "pictureBox1";
40 | this.pictureBox1.Size = new System.Drawing.Size(386, 325);
41 | this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
42 | this.pictureBox1.TabIndex = 0;
43 | this.pictureBox1.TabStop = false;
44 | //
45 | // Form1
46 | //
47 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
48 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
49 | this.ClientSize = new System.Drawing.Size(386, 325);
50 | this.Controls.Add(this.pictureBox1);
51 | this.Name = "Form1";
52 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
53 | this.Text = "RADAR";
54 | this.Load += new System.EventHandler(this.Form1_Load);
55 | ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
56 | this.ResumeLayout(false);
57 |
58 | }
59 |
60 | #endregion
61 |
62 | private System.Windows.Forms.PictureBox pictureBox1;
63 | }
64 | }
65 |
66 |
--------------------------------------------------------------------------------
/src/SimpleRadar/Form1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace SimpleRadar
12 | {
13 | public partial class Form1 : Form
14 | {
15 | Timer t = new Timer();
16 |
17 | int WIDTH = 300, HEIGHT = 300, HAND = 150;
18 |
19 | int u; //in degree
20 | int cx, cy; //center of the circle
21 | int x, y; //HAND coordinate
22 |
23 | int tx, ty, lim = 20;
24 |
25 | Bitmap bmp;
26 | Pen p;
27 | Graphics g;
28 |
29 | public Form1()
30 | {
31 | InitializeComponent();
32 | }
33 |
34 | private void Form1_Load(object sender, EventArgs e)
35 | {
36 | //create Bitmap
37 | bmp = new Bitmap(WIDTH + 1, HEIGHT + 1);
38 |
39 | //background color
40 | this.BackColor = Color.Black;
41 |
42 | //center
43 | cx = WIDTH / 2;
44 | cy = HEIGHT / 2;
45 |
46 | //initial degree of HAND
47 | u = 0;
48 |
49 | //timer
50 | t.Interval = 5; //in millisecond
51 | t.Tick += new EventHandler(this.t_Tick);
52 | t.Start();
53 | }
54 |
55 | private void t_Tick(object sender, EventArgs e)
56 | {
57 | //pen
58 | p = new Pen(Color.Green, 1f);
59 |
60 | //graphics
61 | g = Graphics.FromImage(bmp);
62 |
63 | //calculate x, y coordinate of HAND
64 | int tu = (u - lim) % 360;
65 |
66 | if (u >= 0 && u <= 180)
67 | {
68 | //right half
69 | //u in degree is converted into radian.
70 |
71 | x = cx + (int)(HAND * Math.Sin(Math.PI * u / 180));
72 | y = cy - (int)(HAND * Math.Cos(Math.PI * u / 180));
73 | }
74 | else
75 | {
76 | x = cx - (int)(HAND * -Math.Sin(Math.PI * u / 180));
77 | y = cy - (int)(HAND * Math.Cos(Math.PI * u / 180));
78 | }
79 |
80 | if (tu >= 0 && tu <= 180)
81 | {
82 | //right half
83 | //tu in degree is converted into radian.
84 |
85 | tx = cx + (int)(HAND * Math.Sin(Math.PI * tu / 180));
86 | ty = cy - (int)(HAND * Math.Cos(Math.PI * tu / 180));
87 | }
88 | else
89 | {
90 | tx = cx - (int)(HAND * -Math.Sin(Math.PI * tu / 180));
91 | ty = cy - (int)(HAND * Math.Cos(Math.PI * tu / 180));
92 | }
93 |
94 | //draw circle
95 | g.DrawEllipse(p, 0, 0, WIDTH, HEIGHT); //bigger circle
96 | g.DrawEllipse(p, 80, 80, WIDTH - 160, HEIGHT - 160); //smaller circle
97 |
98 | //draw perpendicular line
99 | g.DrawLine(p, new Point(cx, 0), new Point(cx, HEIGHT)); // UP-DOWN
100 | g.DrawLine(p, new Point(0, cy), new Point(WIDTH, cy)); //LEFT-RIGHT
101 |
102 | //draw HAND
103 | g.DrawLine(new Pen(Color.Black, 1f), new Point(cx, cy), new Point(tx, ty));
104 | g.DrawLine(p, new Point(cx, cy), new Point(x, y));
105 |
106 | //load bitmap in picturebox1
107 | pictureBox1.Image = bmp;
108 |
109 | //dispose
110 | p.Dispose();
111 | g.Dispose();
112 |
113 | //update
114 | u++;
115 | if (u == 360)
116 | {
117 | u = 0;
118 | }
119 | }
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/src/SimpleRadar/ReadMe.txt:
--------------------------------------------------------------------------------
1 | For this project I am using Visual Studio 2012 Express Edition.
2 | You can use any other version of VS.
3 |
4 | Project video
5 | http://youtu.be/8WhQATRycTU
6 |
7 |
8 | Have fun coding.
9 |
10 | stay happy and keep smiling :-)
11 |
12 | yusufshakeel
13 |
14 | https://www.facebook.com/yusufshakeel
15 | https://www.youtube.com/yusufshakeel
16 | https://plus.google.com/+YusufShakeel
17 | http://yusufshakeelblog.blogspot.in
18 | https://github.com/yusufshakeel
--------------------------------------------------------------------------------