public class CustomPopForm : Form, IStickyWindowSupport
{
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private System.Windows.Forms.Button button3;
private void InitializeComponent()
{
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.button3 = new System.Windows.Forms.Button();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 3;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 147F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 154F));
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.textBox1, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.label3, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.button2, 2, 3);
this.tableLayoutPanel1.Controls.Add(this.button1, 1, 3);
this.tableLayoutPanel1.Controls.Add(this.dateTimePicker1, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.button3, 1, 1);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 4;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(401, 138);
this.tableLayoutPanel1.TabIndex = 0;
//
// label1
//
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(3, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(94, 30);
this.label1.TabIndex = 0;
this.label1.Text = "Event";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textBox1
//
this.tableLayoutPanel1.SetColumnSpan(this.textBox1, 2);
this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.textBox1.Location = new System.Drawing.Point(105, 5);
this.textBox1.Margin = new System.Windows.Forms.Padding(5);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(291, 20);
this.textBox1.TabIndex = 1;
//
// label2
//
this.label2.Dock = System.Windows.Forms.DockStyle.Fill;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(3, 30);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(94, 30);
this.label2.TabIndex = 2;
this.label2.Text = "MarkColor";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label3
//
this.label3.Dock = System.Windows.Forms.DockStyle.Fill;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(3, 60);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(94, 30);
this.label3.TabIndex = 4;
this.label3.Text = "TargetDate";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// button2
//
this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button2.Dock = System.Windows.Forms.DockStyle.Fill;
this.button2.Location = new System.Drawing.Point(262, 100);
this.button2.Margin = new System.Windows.Forms.Padding(15, 10, 15, 10);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(124, 30);
this.button2.TabIndex = 7;
this.button2.Text = "Cancel";
this.button2.UseVisualStyleBackColor = true;
//
// button1
//
this.button1.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button1.Dock = System.Windows.Forms.DockStyle.Fill;
this.button1.Location = new System.Drawing.Point(115, 100);
this.button1.Margin = new System.Windows.Forms.Padding(15, 10, 15, 10);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(117, 30);
this.button1.TabIndex = 6;
this.button1.Text = "Ok";
this.button1.UseVisualStyleBackColor = true;
//
// dateTimePicker1
//
this.tableLayoutPanel1.SetColumnSpan(this.dateTimePicker1, 2);
this.dateTimePicker1.Location = new System.Drawing.Point(103, 63);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.Size = new System.Drawing.Size(293, 20);
this.dateTimePicker1.TabIndex = 5;
//
// button3
//
this.button3.BackColor = System.Drawing.Color.Red;
this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button3.Location = new System.Drawing.Point(103, 33);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(71, 23);
this.button3.TabIndex = 3;
this.button3.Text = "EditColor...";
this.button3.UseVisualStyleBackColor = false;
this.button3.Click += new System.EventHandler(this.EditColorClick);
//
// Form1
//
this.AcceptButton = this.button1;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.button2;
this.ClientSize = new System.Drawing.Size(401, 138);
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "Form1";
this.Text = "Form1";
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
}
private Color _selectedColor;
public CustomPopForm()
{
InitializeComponent();
}
public Color MarkColor
{
get
{
return _selectedColor;
}
set
{
_selectedColor = value;
this.button3.BackColor = value;
}
}
public string Content
{
get
{
return this.textBox1.Text;
}
set
{
this.textBox1.Text = value;
}
}
public DateTime TargetDate
{
get
{
return this.dateTimePicker1.Value;
}
set
{
this.dateTimePicker1.Value = value;
}
}
public Color[] CandidateColors
{
get;
set;
}
private void EditColorClick(object sender, EventArgs e)
{
ColorDialog dialog = new ColorDialog();
DialogResult result= dialog.ShowDialog();
if(result == System.Windows.Forms.DialogResult.OK)
{
_selectedColor = dialog.Color;
}
this.button3.BackColor = _selectedColor;
}
public bool UseTargetDate
{
get;
set;
}
}
Public Class CustomPopForm
Inherits Form
Implements IStickyWindowSupport
Private tableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel
Private label1 As System.Windows.Forms.Label
Private textBox1 As System.Windows.Forms.TextBox
Private label2 As System.Windows.Forms.Label
Private label3 As System.Windows.Forms.Label
Private button2 As System.Windows.Forms.Button
Private button1 As System.Windows.Forms.Button
Private dateTimePicker1 As System.Windows.Forms.DateTimePicker
Private button3 As System.Windows.Forms.Button
Private Sub InitializeComponent()
Me.tableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel()
Me.label1 = New System.Windows.Forms.Label()
Me.textBox1 = New System.Windows.Forms.TextBox()
Me.label2 = New System.Windows.Forms.Label()
Me.label3 = New System.Windows.Forms.Label()
Me.button2 = New System.Windows.Forms.Button()
Me.button1 = New System.Windows.Forms.Button()
Me.dateTimePicker1 = New System.Windows.Forms.DateTimePicker()
Me.button3 = New System.Windows.Forms.Button()
Me.tableLayoutPanel1.SuspendLayout()
Me.SuspendLayout()
'
' tableLayoutPanel1
'
Me.tableLayoutPanel1.ColumnCount = 3
Me.tableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100.0F))
Me.tableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 147.0F))
Me.tableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 154.0F))
Me.tableLayoutPanel1.Controls.Add(Me.label1, 0, 0)
Me.tableLayoutPanel1.Controls.Add(Me.textBox1, 1, 0)
Me.tableLayoutPanel1.Controls.Add(Me.label2, 0, 1)
Me.tableLayoutPanel1.Controls.Add(Me.label3, 0, 2)
Me.tableLayoutPanel1.Controls.Add(Me.button2, 2, 3)
Me.tableLayoutPanel1.Controls.Add(Me.button1, 1, 3)
Me.tableLayoutPanel1.Controls.Add(Me.dateTimePicker1, 1, 2)
Me.tableLayoutPanel1.Controls.Add(Me.button3, 1, 1)
Me.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill
Me.tableLayoutPanel1.Location = New System.Drawing.Point(0, 0)
Me.tableLayoutPanel1.Name = "tableLayoutPanel1"
Me.tableLayoutPanel1.RowCount = 4
Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30.0F))
Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30.0F))
Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30.0F))
Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 50.0F))
Me.tableLayoutPanel1.Size = New System.Drawing.Size(401, 138)
Me.tableLayoutPanel1.TabIndex = 0
'
' label1
'
Me.label1.Dock = System.Windows.Forms.DockStyle.Fill
Me.label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CByte(0))
Me.label1.Location = New System.Drawing.Point(3, 0)
Me.label1.Name = "label1"
Me.label1.Size = New System.Drawing.Size(94, 30)
Me.label1.TabIndex = 0
Me.label1.Text = "Event"
Me.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
' textBox1
'
Me.tableLayoutPanel1.SetColumnSpan(Me.textBox1, 2)
Me.textBox1.Dock = System.Windows.Forms.DockStyle.Fill
Me.textBox1.Location = New System.Drawing.Point(105, 5)
Me.textBox1.Margin = New System.Windows.Forms.Padding(5)
Me.textBox1.Name = "textBox1"
Me.textBox1.Size = New System.Drawing.Size(291, 20)
Me.textBox1.TabIndex = 1
'
' label2
'
Me.label2.Dock = System.Windows.Forms.DockStyle.Fill
Me.label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CByte(0))
Me.label2.Location = New System.Drawing.Point(3, 30)
Me.label2.Name = "label2"
Me.label2.Size = New System.Drawing.Size(94, 30)
Me.label2.TabIndex = 2
Me.label2.Text = "MarkColor"
Me.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
' label3
'
Me.label3.Dock = System.Windows.Forms.DockStyle.Fill
Me.label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CByte(0))
Me.label3.Location = New System.Drawing.Point(3, 60)
Me.label3.Name = "label3"
Me.label3.Size = New System.Drawing.Size(94, 30)
Me.label3.TabIndex = 4
Me.label3.Text = "TargetDate"
Me.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
' button2
'
Me.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.button2.Dock = System.Windows.Forms.DockStyle.Fill
Me.button2.Location = New System.Drawing.Point(262, 100)
Me.button2.Margin = New System.Windows.Forms.Padding(15, 10, 15, 10)
Me.button2.Name = "button2"
Me.button2.Size = New System.Drawing.Size(124, 30)
Me.button2.TabIndex = 7
Me.button2.Text = "Cancel"
Me.button2.UseVisualStyleBackColor = True
'
' button1
'
Me.button1.DialogResult = System.Windows.Forms.DialogResult.OK
Me.button1.Dock = System.Windows.Forms.DockStyle.Fill
Me.button1.Location = New System.Drawing.Point(115, 100)
Me.button1.Margin = New System.Windows.Forms.Padding(15, 10, 15, 10)
Me.button1.Name = "button1"
Me.button1.Size = New System.Drawing.Size(117, 30)
Me.button1.TabIndex = 6
Me.button1.Text = "Ok"
Me.button1.UseVisualStyleBackColor = True
'
' dateTimePicker1
'
Me.tableLayoutPanel1.SetColumnSpan(Me.dateTimePicker1, 2)
Me.dateTimePicker1.Location = New System.Drawing.Point(103, 63)
Me.dateTimePicker1.Name = "dateTimePicker1"
Me.dateTimePicker1.Size = New System.Drawing.Size(293, 20)
Me.dateTimePicker1.TabIndex = 5
'
' button3
'
Me.button3.BackColor = System.Drawing.Color.Red
Me.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.button3.Location = New System.Drawing.Point(103, 33)
Me.button3.Name = "button3"
Me.button3.Size = New System.Drawing.Size(71, 23)
Me.button3.TabIndex = 3
Me.button3.Text = "EditColor..."
Me.button3.UseVisualStyleBackColor = False
AddHandler Me.button3.Click, New System.EventHandler(AddressOf Me.EditColorClick)
'
' Form1
'
Me.AcceptButton = Me.button1
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0F, 13.0F)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.CancelButton = Me.button2
Me.ClientSize = New System.Drawing.Size(401, 138)
Me.Controls.Add(Me.tableLayoutPanel1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.tableLayoutPanel1.ResumeLayout(False)
Me.tableLayoutPanel1.PerformLayout()
Me.ResumeLayout(False)
End Sub
Private _selectedColor As Color
Public Sub New()
InitializeComponent()
End Sub
Public Property MarkColor As Color Implements IStickyWindowSupport.MarkColor
Get
Return _selectedColor
End Get
Set(value As Color)
_selectedColor = value
Me.button3.BackColor = value
End Set
End Property
Public Property Content As String Implements IStickyWindowSupport.Content
Get
Return Me.textBox1.Text
End Get
Set(value As String)
Me.textBox1.Text = value
End Set
End Property
Public Property TargetDate As DateTime Implements IStickyWindowSupport.TargetDate
Get
Return Me.dateTimePicker1.Value
End Get
Set(value As DateTime)
Me.dateTimePicker1.Value = value
End Set
End Property
Public Property CandidateColors As Color() Implements IStickyWindowSupport.CandidateColors
Get
Return m_CandidateColors
End Get
Set(value As Color())
m_CandidateColors = value
End Set
End Property
Private m_CandidateColors As Color()
Private Sub EditColorClick(sender As Object, e As EventArgs)
Dim dialog As New ColorDialog()
Dim result As DialogResult = dialog.ShowDialog()
If result = System.Windows.Forms.DialogResult.OK Then
_selectedColor = dialog.Color
End If
Me.button3.BackColor = _selectedColor
End Sub
Public Property UseTargetDate As Boolean Implements IStickyWindowSupport.UseTargetDate
Get
Return m_UseTargetDate
End Get
Set(value As Boolean)
m_UseTargetDate = value
End Set
End Property
Private m_UseTargetDate As Boolean
End Class