|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using mytray.Properties;
namespace mytray
{
public partial class Form_Settings : Form
{
public Form_Main FMain = null;
public Form_Settings()
{
InitializeComponent();
}
private void checkBox_StartUp_CheckedChanged(object sender, EventArgs e)
{
RegistryKey run = Registry.CurrentUser.OpenSubKey("Software", true);
run = run.OpenSubKey(@"Microsoft", true);
run = run.OpenSubKey(@"Windows", true);
run = run.OpenSubKey(@"CurrentVersion", true);
run = run.OpenSubKey(@"Run", true);
if (checkBox_StartUp.Checked == true)
run.SetValue("PersianCalendar", Application.ExecutablePath);
else
try
{
run.DeleteValue("PersianCalendar");
}
catch (Exception exp)
{
}
}
private void Form_Settings_Load(object sender, EventArgs e)
{
checkBox_StartUp.Checked=Settings.Default.StartUp;
try
{
trackBar_Trans.Value = Settings.Default.Transparency;
numericUpDown_Trans.Value = Settings.Default.Transparency * 10;
}
catch
{
}
CPersianCalender theCalender = new CPersianCalender();
for (int i = -2; i <= 2; i++)
{
theCalender.SetGhamariAdjust(i);
int[] GhamariDate = theCalender.GetGhamariDate();
string s = Convert.ToString(GhamariDate[2]) + " "
+ theCalender.GetGamariMonthName(GhamariDate[1]) + " " + Convert.ToString(GhamariDate[0]);
comboBox_Ghamari.Items.Add(s);
}
comboBox_Ghamari.SelectedIndex = Settings.Default.GhamariAdjust+2;
}
private void Form_Settings_FormClosed(object sender, FormClosedEventArgs e)
{
// Properties.Settings.Default.Save();
}
private void Form_Settings_FormClosing(object sender, FormClosingEventArgs e)
{
}
private void trackBar_Trans_Scroll(object sender, EventArgs e)
{
}
private void trackBar_Trans_ValueChanged(object sender, EventArgs e)
{
numericUpDown_Trans.Value = trackBar_Trans.Value * 10;
}
private void numericUpDown_Trans_ValueChanged(object sender, EventArgs e)
{
trackBar_Trans.Value = (int)numericUpDown_Trans.Value / 10;
// this.Opacity = (double)numericUpDown_Trans.Value;
}
private void buttonOk_Click(object sender, EventArgs e)
{
Settings.Default.StartUp = checkBox_StartUp.Checked;
Settings.Default.Transparency = trackBar_Trans.Value;
Settings.Default.GhamariAdjust = comboBox_Ghamari.SelectedIndex-2;
Properties.Settings.Default.Save();
foreach( Form f in Application.OpenForms)
if (f != this)
{
f.Opacity = ((float)trackBar_Trans.Value) / 10;
}
if (FMain != null)
FMain.GhamariAdjust= Settings.Default.GhamariAdjust;
Close();
}
private void buttonCancel_Click(object sender, EventArgs e)
{
Close();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I had worked as programmer,project manager,web developer for more than 3 years, and have worked on programming personaly for more than 10 years.
I have worked in university as a teacher for 8 years.
my favorite langueges are : VC++,C#,ASP.NET,PHP