0% found this document useful (0 votes)
68 views

Write A Program For Threading Demonstration in

The document discusses code samples for threading, image viewing, file viewing, dialog boxes, and mouse event handling in Windows CE.NET applications. It includes code snippets in C# for creating threads, navigating images, opening and saving files, and handling various mouse events. Dialog boxes demonstrated include font, color, save, open, folder browse, print preview, and print dialog boxes. The output describes the functionality and screenshots of each example application.

Uploaded by

Abdulla Shaik
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views

Write A Program For Threading Demonstration in

The document discusses code samples for threading, image viewing, file viewing, dialog boxes, and mouse event handling in Windows CE.NET applications. It includes code snippets in C# for creating threads, navigating images, opening and saving files, and handling various mouse events. Dialog boxes demonstrated include font, color, save, open, folder browse, print preview, and print dialog boxes. The output describes the functionality and screenshots of each example application.

Uploaded by

Abdulla Shaik
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 17

//1. Write a program for threading demonstration in Windows CE.NET.

using using using using System; System.Collections.Generic; System.Text; System.Threading;

namespace Threading { class MyThread { public int count; public Thread t; public MyThread(string name) { count = 0; t = new Thread(this.run); t.Name = name; t.Start(); } void run() { Console.WriteLine(t.Name + "starting"); do { Thread.Sleep(500); Console.WriteLine("In " + t.Name + " Count is " + count); count++; } while (count < 5); Console.WriteLine(t.Name + " terminated"); } } class ThreadDemo { public static void Main() { Console.WriteLine("Main Thread Started"); MyThread t1 = new MyThread("Child Thread #1"); MyThread t2 = new MyThread("Child Thread #2"); MyThread t3 = new MyThread("Child Thread #3"); t1.t.Join(); Console.WriteLine("Child #1 joined."); t2.t.Join(); Console.WriteLine("Child #2 joined."); t3.t.Join(); Console.WriteLine("Child #3 joined."); Console.WriteLine("Main Thread Ended"); Console.Read(); } } }

Output:

//2. Write for the Image Viewer in Windows CE.NET.


using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms;

namespace ImageViewer { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { if (label1.ImageIndex < imageList1.Images.Count - 1) label1.ImageIndex += 1; else label1.ImageIndex = 0; } private void button2_Click(object sender, EventArgs e) { if (label1.ImageIndex > 0) label1.ImageIndex -= 1; else label1.ImageIndex = imageList1.Images.Count - 1; } } }

Output:

Next Image

Previous Image

//3. Design a file viewer (Similar to explorer) for Windows CE.NET and 4. Give the demonstration for the various Dialog Box avail with C# Smart Device Application.
using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms;

namespace DialogBox { public partial class Form1 : Form { public Form1() { InitializeComponent(); } //Change The Font private void button1_Click(object sender, EventArgs e) { fontDialog1.ShowDialog(); textBox1.Font = fontDialog1.Font; } //Save The File private void button4_Click(object sender, EventArgs e) { saveFileDialog1.ShowDialog(); } //Open File private void button2_Click(object sender, EventArgs e) { openFileDialog1.ShowDialog(); } //Browse Folder private void button5_Click(object sender, EventArgs e) { folderBrowserDialog1.ShowDialog(); } //Change Color private void button3_Click(object sender, EventArgs e) { colorDialog1.ShowDialog(); textBox1.ForeColor = colorDialog1.Color; }

//Page setup private void button6_Click(object sender, EventArgs e) { pageSetupDialog1.ShowDialog(); } //Print Preview private void button7_Click(object sender, EventArgs e) { printPreviewDialog1.ShowDialog(); } //Print Document private void button8_Click(object sender, EventArgs e) { printDialog1.ShowDialog(); }

} } Output :

Fig. 1: Normal Screen

Fi g.2: Screen With Font Dialog

Fig. 3: Screen After Font Change With Coloe Dialog

Fig. 4: Screen with Save Dialog

Fig. 5: Screen After Color Change with Open Dialog

Fig. 6: Screen with Folder Browse

Fig. 7: Screen With Print Preview Dialog

Fig. 8: Screen with Print Dialog

//5. Write a program in C#.net for the smart device application for Mouse event handling.
using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Text; System.Windows.Forms;

namespace MouseEvent { public partial class Form1 : Form { public Form1() { InitializeComponent(); } //Mouse Enter private void Form1_MouseEnter(object sender, EventArgs e) { textBox1.Text = "Mouse Entered the Client Area."; } //Mouse Hover private void Form1_MouseHover(object sender, EventArgs e) { textBox1.Text = "Mouse is Hovering"; } //Mouse Down private void Form1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) textBox1.Text = "The Left Mouse Button is Down at " + MousePosition.X.ToString() + ", " + MousePosition.Y.ToString(); } //Mouse Move private void Form1_MouseMove(object sender, MouseEventArgs e) { textBox1.Text = "The Left Mouse Moved to: " + MousePosition.X.ToString() + ", " + MousePosition.Y.ToString(); } //Mouse Leave private void Form1_MouseLeave(object sender, EventArgs e) { textBox1.Text = "Mouse left the Client Area."; } //Mouse Click

private void button1_Click(object sender, EventArgs e) { textBox1.Text = "Mouse Clicked On Button."; } //Mouse Double Click private void label1_DoubleClick(object sender, EventArgs e) { textBox1.Text = "Mouse Double Clicked On Client Area."; } } Output: }

Mouse Enter

Mouse Hover

MOUSE DOWN

MOUSE MOVE

MOUSE LEAVE

MOUSE CLICK

MOUSE DOUBLECLICK

/* 6 Design Application like notepad in Windows OutPut:

CE.NET.*/

You might also like