DateChooser源码--RevealTransitionUI.cs
using System.IO;
using System.Reflection;
using System;
using System.ComponentModel;
using System.Design;
using System.Drawing;
using System.Drawing.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;
using CNBlogs.DCT.THIN;
namespace CNBlogs.DCT.THIN.Design
{
/// <summary>
/// RevealTransitionUI 的摘要说明。
/// </summary>
///
[ToolboxItem(false)]
public class RevealTransitionUI:Control
{
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.ComboBox comboBox1;
private IWindowsFormsEditorService edSvc;
private object value;
public object Value
{
get
{
return this.value;
}
}
public void Start(IWindowsFormsEditorService edSvc, object value)
{
this.edSvc = edSvc;
this.value = value;
int i = (int)((RevealTransitionType)value);
this.comboBox1.SelectedIndex = i;
this.comboBox1_SelectedIndexChanged(null,null);
}
public void End()
{
this.edSvc = null;
this.value = null;
}
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(RevealTransitionUI));
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Bitmap)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(0, 21);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(91, 124);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// comboBox1
//
this.comboBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.Location = new System.Drawing.Point(0, 0);
this.comboBox1.MaxDropDownItems = 24;
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(91, 21);
this.comboBox1.TabIndex = 0;
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
//
// button1
//
this.button1.BackColor = System.Drawing.Color.MidnightBlue;
this.button1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.button1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.button1.ForeColor = System.Drawing.Color.White;
this.button1.Location = new System.Drawing.Point(0, 145);
this.button1.FlatStyle = FlatStyle.Popup;
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(91, 24);
this.button1.TabIndex = 0;
this.button1.Text = "确定";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// RevealTransitionUI
//
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.comboBox1,
this.pictureBox1,
this.button1});
this.Size = new System.Drawing.Size(91, 169);
this.BackColor = SystemColors.Control;
base.TabStop = false;
this.SetStyle(ControlStyles.Selectable,false);
this.ResumeLayout(false);
}
public RevealTransitionUI()
{
this.InitializeComponent();
this.comboBox1.Items.Clear();
for(int i = 0 ; i < 25 ; i ++)
this.comboBox1.Items.Add((RevealTransitionType)i);
}
private void comboBox1_SelectedIndexChanged(object sender,EventArgs e)
{
//this.pictureBox1.Image = Image.FromFile(this.comboBox1.SelectedIndex.ToString()+".gif");
Assembly asm = Assembly.GetExecutingAssembly();
this.pictureBox1.Image = Image.FromStream(asm.GetManifestResourceStream(asm.GetName().Name +"."+ this.comboBox1.SelectedIndex.ToString() +".gif"));
this.value=(RevealTransitionType)this.comboBox1.SelectedIndex;
}
private void button1_Click(object sender, System.EventArgs e)
{
this.value = (RevealTransitionType)this.comboBox1.SelectedIndex;
this.edSvc.CloseDropDown();
}
}
}