mirror of
https://github.com/abdelkader/vCardEditor
synced 2025-12-12 08:27:19 +07:00
added UIToolbox to add removable component
start
This commit is contained in:
@@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
|
||||
namespace vCardEditor.View.Libs
|
||||
namespace vCardEditor.Model
|
||||
{
|
||||
public class PropertyComparer<T> : IComparer<T>
|
||||
{
|
||||
@@ -56,6 +56,12 @@ namespace VCFEditor.Presenter
|
||||
private void LoadFormHandler(object sender, EventArg<FormState> e)
|
||||
{
|
||||
e.Data = ConfigRepository.Instance.FormState;
|
||||
var paths = Environment.GetCommandLineArgs();
|
||||
if (paths.Length > 1)
|
||||
{
|
||||
var evt = new EventArg<string>(paths[1]);
|
||||
NewFileOpenedHandler(sender, evt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using vCardEditor.View.Libs;
|
||||
using vCardEditor.Model;
|
||||
|
||||
|
||||
namespace vCardEditor.View
|
||||
{
|
||||
|
||||
118
vCardEditor/View/UIToolbox/CollapseBox.cs
Normal file
118
vCardEditor/View/UIToolbox/CollapseBox.cs
Normal file
@@ -0,0 +1,118 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace UIToolbox
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for CollapseBox.
|
||||
/// </summary>
|
||||
public class CollapseBox : OwnerDrawButton
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
#region Internal variables
|
||||
private bool m_bIsPlus;
|
||||
#endregion Internal variables
|
||||
|
||||
public CollapseBox()
|
||||
{
|
||||
// This call is required by the Windows.Forms Form Designer.
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if(components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
//
|
||||
// CollapseBox
|
||||
//
|
||||
this.Click += new System.EventHandler(this.CollapseBox_Click);
|
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.CollapseBox_Paint);
|
||||
this.DoubleClick += new System.EventHandler(this.CollapseBox_DoubleClick);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
private void CollapseBox_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
IsPlus = !IsPlus;
|
||||
}
|
||||
|
||||
private void CollapseBox_DoubleClick(object sender, System.EventArgs e)
|
||||
{
|
||||
// fast clicking registers as double-clicking, so map a double-click
|
||||
// event into a single click.
|
||||
CollapseBox_Click(sender, e);
|
||||
}
|
||||
|
||||
private void CollapseBox_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
|
||||
{
|
||||
Graphics g = e.Graphics;
|
||||
|
||||
if(m_ButtonState == ButtonState.TrackingInside)
|
||||
g.FillRectangle(Brushes.LightGray, ClientRectangle);
|
||||
else
|
||||
g.FillRectangle(Brushes.White, ClientRectangle);
|
||||
|
||||
Rectangle theRec = new Rectangle();
|
||||
theRec = ClientRectangle;
|
||||
theRec.Width--;
|
||||
theRec.Height--;
|
||||
g.DrawRectangle(Pens.Black, theRec);
|
||||
g.DrawLine(Pens.Black, theRec.X + 2, theRec.Y + (this.Height/2),
|
||||
theRec.X + this.Width - 3, theRec.Y + (this.Height/2));
|
||||
if(m_bIsPlus)
|
||||
{
|
||||
g.DrawLine(Pens.Black, theRec.X + (this.Width/2), theRec.Y + 2,
|
||||
theRec.X + (this.Width/2), theRec.Y + this.Height - 3);
|
||||
}
|
||||
}
|
||||
#endregion Events
|
||||
|
||||
#region Accessors
|
||||
[DefaultValue(false)]
|
||||
public bool IsPlus
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_bIsPlus;
|
||||
}
|
||||
set
|
||||
{
|
||||
if(m_bIsPlus != value)
|
||||
{
|
||||
m_bIsPlus = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion Accessors
|
||||
}
|
||||
}
|
||||
109
vCardEditor/View/UIToolbox/CollapseBox.resx
Normal file
109
vCardEditor/View/UIToolbox/CollapseBox.resx
Normal file
@@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used forserialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Name">
|
||||
<value>CollapseBox</value>
|
||||
</data>
|
||||
</root>
|
||||
BIN
vCardEditor/View/UIToolbox/CollapsibleGroupBox.bmp
Normal file
BIN
vCardEditor/View/UIToolbox/CollapsibleGroupBox.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 824 B |
326
vCardEditor/View/UIToolbox/CollapsibleGroupBox.cs
Normal file
326
vCardEditor/View/UIToolbox/CollapsibleGroupBox.cs
Normal file
@@ -0,0 +1,326 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace UIToolbox
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for CollapsibleGroupBox.
|
||||
/// </summary>
|
||||
public class CollapsibleGroupBox : System.Windows.Forms.UserControl
|
||||
{
|
||||
public const int kCollapsedHeight = 20;
|
||||
#region Members
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
private CollapseBox m_CollapseBox;
|
||||
private ImageButton m_TrashIcon;
|
||||
public event CollapseBoxClickedEventHandler CollapseBoxClickedEvent;
|
||||
public event TrashCanClickedEventHandler TrashCanClickedEvent;
|
||||
|
||||
private string m_Caption;
|
||||
//private bool m_bContainsTrashCan;
|
||||
//private System.Windows.Forms.GroupBox m_GroupBox;
|
||||
private Size m_FullSize;
|
||||
private bool m_bResizingFromCollapse = false;
|
||||
#endregion Members
|
||||
|
||||
|
||||
public CollapsibleGroupBox()
|
||||
{
|
||||
// This call is required by the Windows.Forms Form Designer.
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if(components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(CollapsibleGroupBox));
|
||||
this.m_CollapseBox = new UIToolbox.CollapseBox();
|
||||
this.m_TrashIcon = new UIToolbox.ImageButton();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// m_CollapseBox
|
||||
//
|
||||
this.m_CollapseBox.IsPlus = false;
|
||||
this.m_CollapseBox.Location = new System.Drawing.Point(12, 1);
|
||||
this.m_CollapseBox.Name = "m_CollapseBox";
|
||||
this.m_CollapseBox.Size = new System.Drawing.Size(11, 11);
|
||||
this.m_CollapseBox.TabIndex = 1;
|
||||
this.m_CollapseBox.Click += new System.EventHandler(this.CollapseBox_Click);
|
||||
this.m_CollapseBox.DoubleClick += new System.EventHandler(this.CollapseBox_DoubleClick);
|
||||
//
|
||||
// m_TrashIcon
|
||||
//
|
||||
this.m_TrashIcon.Location = new System.Drawing.Point(88, 0);
|
||||
this.m_TrashIcon.Name = "m_TrashIcon";
|
||||
this.m_TrashIcon.NormalImage = ((System.Drawing.Image)(resources.GetObject("m_TrashIcon.NormalImage")));
|
||||
this.m_TrashIcon.PressedImage = ((System.Drawing.Image)(resources.GetObject("m_TrashIcon.PressedImage")));
|
||||
this.m_TrashIcon.Size = new System.Drawing.Size(16, 16);
|
||||
this.m_TrashIcon.TabIndex = 2;
|
||||
this.m_TrashIcon.TabStop = false;
|
||||
this.m_TrashIcon.Click += new System.EventHandler(this.TrashIcon_Click);
|
||||
//
|
||||
// CollapsibleGroupBox
|
||||
//
|
||||
this.Controls.Add(this.m_TrashIcon);
|
||||
this.Controls.Add(this.m_CollapseBox);
|
||||
this.Name = "CollapsibleGroupBox";
|
||||
this.Resize += new System.EventHandler(this.CollapsibleGroupBox_Resize);
|
||||
this.Load += new System.EventHandler(this.CollapsibleGroupBox_Load);
|
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.CollapsibleGroupBox_Paint);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
private void CollapsibleGroupBox_Load(object sender, System.EventArgs e)
|
||||
{
|
||||
SetGroupBoxCaption();
|
||||
}
|
||||
|
||||
private void CollapsibleGroupBox_Resize(object sender, System.EventArgs e)
|
||||
{
|
||||
if(m_bResizingFromCollapse != true)
|
||||
{
|
||||
m_FullSize = this.Size;
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
private void CollapsibleGroupBox_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
|
||||
{
|
||||
// UG! I originall added a GroupBox control but ran into problems...
|
||||
// Panes derived from CollapsibleGroupBox would "chew up" controls
|
||||
// added to them, so I had to get rid of the GroupBox and draw a fake
|
||||
// group box myself
|
||||
Graphics g = e.Graphics;
|
||||
Rectangle theRec = new Rectangle();
|
||||
theRec = this.ClientRectangle;
|
||||
|
||||
//Color theEdgeGrayColor = Color.FromArgb(170, 170, 156);
|
||||
//Pen thePen = new Pen(theEdgeGrayColor);
|
||||
Pen thePen = SystemPens.ControlDark;
|
||||
|
||||
|
||||
int theTextSize = (int)g.MeasureString(m_Caption, this.Font).Width;
|
||||
if(theTextSize < 1)
|
||||
theTextSize = 1;
|
||||
|
||||
int theCaptionPosition = (theRec.X + 8) + 2 + m_CollapseBox.Width + 2;
|
||||
int theEndPosition = theCaptionPosition + theTextSize + 1;
|
||||
if(m_TrashIcon.Visible)
|
||||
theEndPosition += (m_TrashIcon.Width + 2);
|
||||
|
||||
|
||||
g.DrawLine(thePen, theRec.X + 8, theRec.Y + 5,
|
||||
theRec.X, theRec.Y + 5);
|
||||
|
||||
g.DrawLine(thePen, theRec.X, theRec.Y + 5,
|
||||
theRec.X, theRec.Bottom - 2);
|
||||
|
||||
g.DrawLine(thePen, theRec.X, theRec.Bottom - 2,
|
||||
theRec.Right - 1, theRec.Bottom - 2);
|
||||
|
||||
g.DrawLine(thePen, theRec.Right - 2, theRec.Bottom - 2,
|
||||
theRec.Right - 2, theRec.Y + 5);
|
||||
|
||||
g.DrawLine(thePen, theRec.Right - 2, theRec.Y + 5,
|
||||
theRec.X + theEndPosition, theRec.Y + 5);
|
||||
|
||||
|
||||
|
||||
g.DrawLine(Pens.White, theRec.X + 8, theRec.Y + 6,
|
||||
theRec.X + 1, theRec.Y + 6);
|
||||
|
||||
g.DrawLine(Pens.White, theRec.X + 1, theRec.Y + 6,
|
||||
theRec.X + 1, theRec.Bottom - 3);
|
||||
|
||||
g.DrawLine(Pens.White, theRec.X, theRec.Bottom - 1,
|
||||
theRec.Right, theRec.Bottom - 1);
|
||||
|
||||
g.DrawLine(Pens.White, theRec.Right - 1, theRec.Bottom - 1,
|
||||
theRec.Right - 1, theRec.Y + 5);
|
||||
|
||||
g.DrawLine(Pens.White, theRec.Right - 3, theRec.Y + 6,
|
||||
theRec.X + theEndPosition, theRec.Y + 6);
|
||||
|
||||
StringFormat sf = new StringFormat();
|
||||
SolidBrush drawBrush = new SolidBrush(Color.Black);
|
||||
|
||||
g.DrawString(m_Caption, this.Font, drawBrush, theCaptionPosition, 0);
|
||||
}
|
||||
|
||||
public void CollapseBox_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
// at this point the control's value has changed but hasn't been
|
||||
// redrawn on the screen
|
||||
this.IsCollapsed = m_CollapseBox.IsPlus;
|
||||
|
||||
if(CollapseBoxClickedEvent != null)
|
||||
{
|
||||
CollapseBoxClickedEvent(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void CollapseBox_DoubleClick(object sender, System.EventArgs e)
|
||||
{
|
||||
// fast clicking registers as double-clicking, so map a double-click
|
||||
// event into a single click.
|
||||
CollapseBox_Click(sender, e);
|
||||
}
|
||||
|
||||
private void TrashIcon_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
if(TrashCanClickedEvent != null)
|
||||
{
|
||||
TrashCanClickedEvent(this);
|
||||
}
|
||||
}
|
||||
#endregion events
|
||||
|
||||
#region Accessors
|
||||
[DefaultValue("")]
|
||||
public string Caption
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_Caption;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_Caption = value;
|
||||
SetGroupBoxCaption();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(true)]
|
||||
public bool ContainsTrashCan
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_TrashIcon.Visible;
|
||||
}
|
||||
set
|
||||
{
|
||||
//m_bContainsTrashCan = value;
|
||||
m_TrashIcon.Visible = value;
|
||||
SetGroupBoxCaption();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public int FullHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_FullSize.Height;
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(false), Browsable(false)]
|
||||
public bool IsCollapsed
|
||||
{
|
||||
get
|
||||
{
|
||||
#if DEBUG
|
||||
if(m_CollapseBox.IsPlus)
|
||||
{
|
||||
Debug.Assert(this.Height == kCollapsedHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Assert(this.Height > kCollapsedHeight);
|
||||
}
|
||||
#endif
|
||||
return m_CollapseBox.IsPlus;
|
||||
}
|
||||
set
|
||||
{
|
||||
if(m_CollapseBox.IsPlus != value)
|
||||
{
|
||||
m_CollapseBox.IsPlus = value;
|
||||
}
|
||||
|
||||
if(m_CollapseBox.IsPlus != true)
|
||||
{
|
||||
//Expand();
|
||||
this.Size = m_FullSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
//Collapse();
|
||||
m_bResizingFromCollapse = true;
|
||||
Size smallSize = m_FullSize;
|
||||
smallSize.Height = kCollapsedHeight;
|
||||
this.Size = smallSize;
|
||||
m_bResizingFromCollapse = false;
|
||||
}
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
#endregion accessors
|
||||
|
||||
#region Methods
|
||||
private void SetGroupBoxCaption()
|
||||
{
|
||||
RepositionTrashCan();
|
||||
}
|
||||
|
||||
private void RepositionTrashCan()
|
||||
{
|
||||
if(m_TrashIcon.Visible)
|
||||
{
|
||||
// Since the trash icon's location is a function of the caption's width,
|
||||
// we also need to reposition the trash icon
|
||||
// first, find the width of the string
|
||||
Graphics g = CreateGraphics();
|
||||
SizeF theTextSize = new SizeF();
|
||||
theTextSize = g.MeasureString(m_Caption, this.Font);
|
||||
// Hmm... MeasureString() doesn't seem to be returning the
|
||||
// correct width. Close... but not exact
|
||||
|
||||
// 11 is the number of pixels from the beginning of the group box
|
||||
// to the beginning of text of the group box's caption
|
||||
//m_TrashIcon.Left = m_GroupBox.Location.X + 29 + (int)theTextSize.Width - 4;
|
||||
m_TrashIcon.Left = this.Location.X + 29 + (int)theTextSize.Width - 4;
|
||||
// -4 is a fudge factor. Hey, what can I say...
|
||||
}
|
||||
}
|
||||
#endregion Methods
|
||||
|
||||
|
||||
public delegate void CollapseBoxClickedEventHandler(object sender);
|
||||
public delegate void TrashCanClickedEventHandler(object sender);
|
||||
}
|
||||
}
|
||||
166
vCardEditor/View/UIToolbox/CollapsibleGroupBox.resx
Normal file
166
vCardEditor/View/UIToolbox/CollapsibleGroupBox.resx
Normal file
@@ -0,0 +1,166 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used forserialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="m_CollapseBox.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="m_CollapseBox.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="m_CollapseBox.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="m_TrashIcon.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="m_TrashIcon.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="m_TrashIcon.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="m_TrashIcon.NormalImage" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAJdJREFUOE+VkgEK
|
||||
wDAIA9ef92n9WYdlEbVR2aB0OM3O6Hj4s0l4JLkuLIV7rXUdiX8n1XFFpkDjlYj785xzyxES+25FGQYQ
|
||||
uxaYP0ePoaqofBeaygdNgInAx90ZeQhCn/8IIIAbyPHO5ugmAU9IcWriZaTtvTMQVOqD3YEwgZ7A4ict
|
||||
pOOkG2nw45Son+Uou3WOipXYyX0Bl4EdsYyOw8oAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="m_TrashIcon.PressedImage" type="System.Drawing.Bitmap, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAJhJREFUOE+VkgEK
|
||||
wDAIA9dP9gn9/w86LIuojcoGpcNpdkbHw59NwiPJdWEp3Gut60j8O6mOKzIFGq9E3J/nnFuOkNh3K8ow
|
||||
gNi1wPw5egxVReW70FQ+aAJMBD7uzshDEPr8RwAB3ECOdzZHNwl4QopTEy8jbe+dgaBSH+wOhAn0BBY/
|
||||
aSEdJ91Igx+nRP0sR9mtc1SsxE7uC3D26NQxC7BSAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>80</value>
|
||||
</data>
|
||||
<data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>(Default)</value>
|
||||
</data>
|
||||
<data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="$this.Name">
|
||||
<value>CollapsibleGroupBox</value>
|
||||
</data>
|
||||
<data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>8, 8</value>
|
||||
</data>
|
||||
</root>
|
||||
194
vCardEditor/View/UIToolbox/ExpandingPanel.cs
Normal file
194
vCardEditor/View/UIToolbox/ExpandingPanel.cs
Normal file
@@ -0,0 +1,194 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace UIToolbox
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for ExpandingPanel.
|
||||
/// </summary>
|
||||
public class ExpandingPanel : System.Windows.Forms.Panel
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
ArrayList m_GroupArray = null;
|
||||
|
||||
|
||||
public const int kGap = 6;
|
||||
public ExpandingPanel()
|
||||
{
|
||||
// This call is required by the Windows.Forms Form Designer.
|
||||
InitializeComponent();
|
||||
|
||||
m_GroupArray = new ArrayList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if(components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
//
|
||||
// ExpandingPanel
|
||||
//
|
||||
this.Move += new System.EventHandler(this.ExpandingPanel_Move);
|
||||
this.Resize += new System.EventHandler(this.ExpandingPanel_Resize);
|
||||
this.SizeChanged += new System.EventHandler(this.ExpandingPanel_SizeChanged);
|
||||
this.Layout += new System.Windows.Forms.LayoutEventHandler(this.ExpandingPanel_Layout);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
public void AddGroup(UIToolbox.CollapsibleGroupBox theGroupBox)
|
||||
{
|
||||
m_GroupArray.Add(theGroupBox);
|
||||
|
||||
|
||||
this.SuspendLayout();
|
||||
Size theSize = this.AutoScrollMinSize;
|
||||
theGroupBox.Location = new System.Drawing.Point(4, theSize.Height + 4);
|
||||
|
||||
|
||||
theSize.Height += (theGroupBox.Height + kGap);
|
||||
this.AutoScrollMinSize = theSize;
|
||||
theGroupBox.CollapseBoxClickedEvent += new CollapsibleGroupBox.CollapseBoxClickedEventHandler(this.CollapseBox_Click);
|
||||
theGroupBox.TrashCanClickedEvent += new CollapsibleGroupBox.TrashCanClickedEventHandler(this.TrashCan_Click);
|
||||
this.Controls.Add(theGroupBox);
|
||||
this.ResumeLayout(false);
|
||||
}
|
||||
|
||||
private void ExpandingPanel_Layout(object sender, System.Windows.Forms.LayoutEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void ExpandingPanel_Move(object sender, System.EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void ExpandingPanel_Resize(object sender, System.EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void ExpandingPanel_SizeChanged(object sender, System.EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void CollapseBox_Click(object sender)
|
||||
{
|
||||
int nIndex;
|
||||
nIndex = m_GroupArray.IndexOf(sender);
|
||||
|
||||
CollapsibleGroupBox theGroupBox;
|
||||
theGroupBox = (CollapsibleGroupBox)m_GroupArray[nIndex];
|
||||
|
||||
int nDelta;
|
||||
if(theGroupBox.Height == CollapsibleGroupBox.kCollapsedHeight)
|
||||
{
|
||||
nDelta = -(theGroupBox.FullHeight - CollapsibleGroupBox.kCollapsedHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
nDelta = (theGroupBox.FullHeight - CollapsibleGroupBox.kCollapsedHeight);
|
||||
}
|
||||
|
||||
for(int i=(nIndex + 1); i<m_GroupArray.Count; i++)
|
||||
{
|
||||
theGroupBox = (CollapsibleGroupBox)m_GroupArray[i];
|
||||
theGroupBox.Top += nDelta;
|
||||
}
|
||||
|
||||
Size theSize = this.AutoScrollMinSize;
|
||||
theSize.Height += nDelta;
|
||||
this.AutoScrollMinSize = theSize;
|
||||
}
|
||||
|
||||
private void TrashCan_Click(object sender)
|
||||
{
|
||||
int nIndex;
|
||||
nIndex = m_GroupArray.IndexOf(sender);
|
||||
|
||||
CollapsibleGroupBox theGroupBox;
|
||||
theGroupBox = (CollapsibleGroupBox)m_GroupArray[nIndex];
|
||||
|
||||
int nDelta;
|
||||
nDelta = theGroupBox.Height + kGap;
|
||||
|
||||
m_GroupArray.RemoveAt(nIndex);
|
||||
theGroupBox.Dispose();
|
||||
theGroupBox = null;
|
||||
|
||||
for(int i=nIndex; i<m_GroupArray.Count; i++)
|
||||
{
|
||||
theGroupBox = (CollapsibleGroupBox)m_GroupArray[i];
|
||||
theGroupBox.Top -= nDelta;
|
||||
}
|
||||
|
||||
Size theSize = this.AutoScrollMinSize;
|
||||
theSize.Height -= nDelta;
|
||||
this.AutoScrollMinSize = theSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region NOT USED
|
||||
class IndexerArray
|
||||
{
|
||||
protected ArrayList data = new ArrayList();
|
||||
|
||||
public object this[int idx]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (idx > -1 && idx < data.Count)
|
||||
{
|
||||
return (data[idx]);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("[IndexerArray.get_Item]Index out of range");
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
if (idx > -1 && idx < data.Count)
|
||||
{
|
||||
data[idx] = value;
|
||||
}
|
||||
else if (idx == data.Count)
|
||||
{
|
||||
data.Add(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("[IndexerArray.set_Item]Index out of range");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion NOT USED
|
||||
109
vCardEditor/View/UIToolbox/ExpandingPanel.resx
Normal file
109
vCardEditor/View/UIToolbox/ExpandingPanel.resx
Normal file
@@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used forserialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Name">
|
||||
<value>ExpandingPanel</value>
|
||||
</data>
|
||||
</root>
|
||||
110
vCardEditor/View/UIToolbox/ImageButton.cs
Normal file
110
vCardEditor/View/UIToolbox/ImageButton.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace UIToolbox
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for ImageButton.
|
||||
/// </summary>
|
||||
public class ImageButton : OwnerDrawButton
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
#region Internal variables
|
||||
private Image m_NormalImage = null;
|
||||
private Image m_PressedImage = null;
|
||||
#endregion Internal variables
|
||||
|
||||
public ImageButton()
|
||||
{
|
||||
// This call is required by the Windows.Forms Form Designer.
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if(components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
//
|
||||
// ImageButton
|
||||
//
|
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.ImageButton_Paint);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
private void ImageButton_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
|
||||
{
|
||||
Graphics g = e.Graphics;
|
||||
|
||||
if(m_ButtonState == ButtonState.TrackingInside)
|
||||
{
|
||||
if(m_PressedImage != null)
|
||||
{
|
||||
g.DrawImage(m_PressedImage, 0, 0, m_PressedImage.Width, m_PressedImage.Height);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_NormalImage != null)
|
||||
{
|
||||
g.DrawImage(m_NormalImage, 0, 0, m_NormalImage.Width, m_NormalImage.Height);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion Events
|
||||
|
||||
#region Accessors
|
||||
public Image NormalImage
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_NormalImage;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_NormalImage = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public Image PressedImage
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_PressedImage;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_PressedImage = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
#endregion Accessors
|
||||
}
|
||||
}
|
||||
42
vCardEditor/View/UIToolbox/ImageButton.resx
Normal file
42
vCardEditor/View/UIToolbox/ImageButton.resx
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="ResMimeType">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="Version">
|
||||
<value>1.0.0.0</value>
|
||||
</resheader>
|
||||
<resheader name="Reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="Writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
136
vCardEditor/View/UIToolbox/OwnerDrawButton.cs
Normal file
136
vCardEditor/View/UIToolbox/OwnerDrawButton.cs
Normal file
@@ -0,0 +1,136 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace UIToolbox
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for OwnerDrawButton.
|
||||
/// </summary>
|
||||
public class OwnerDrawButton : System.Windows.Forms.Control
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
#region Internal variables
|
||||
public enum ButtonState
|
||||
{
|
||||
Normal,
|
||||
TrackingInside,
|
||||
TrackingOutside
|
||||
}
|
||||
|
||||
protected ButtonState m_ButtonState = ButtonState.Normal;
|
||||
#endregion Internal variables
|
||||
|
||||
public OwnerDrawButton()
|
||||
{
|
||||
// This call is required by the Windows.Forms Form Designer.
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if(components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
//
|
||||
// OwnerDrawButton
|
||||
//
|
||||
this.Resize += new System.EventHandler(this.OwnerDrawButton_Resize);
|
||||
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OwnerDrawButton_MouseUp);
|
||||
this.Paint += new System.Windows.Forms.PaintEventHandler(this.OwnerDrawButton_Paint);
|
||||
this.MouseEnter += new System.EventHandler(this.OwnerDrawButton_MouseEnter);
|
||||
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.OwnerDrawButton_MouseMove);
|
||||
this.MouseLeave += new System.EventHandler(this.OwnerDrawButton_MouseLeave);
|
||||
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.OwnerDrawButton_MouseDown);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
private void OwnerDrawButton_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
|
||||
{
|
||||
// needs to be implemented by the derived class
|
||||
}
|
||||
|
||||
private void OwnerDrawButton_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
m_ButtonState = ButtonState.TrackingInside;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
private void OwnerDrawButton_MouseEnter(object sender, System.EventArgs e)
|
||||
{
|
||||
if(m_ButtonState == ButtonState.TrackingOutside)
|
||||
{
|
||||
m_ButtonState = ButtonState.TrackingInside;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void OwnerDrawButton_MouseLeave(object sender, System.EventArgs e)
|
||||
{
|
||||
if(m_ButtonState == ButtonState.TrackingInside)
|
||||
{
|
||||
m_ButtonState = ButtonState.TrackingOutside;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void OwnerDrawButton_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
if(m_ButtonState == ButtonState.Normal)
|
||||
return;
|
||||
|
||||
Rectangle bounds = new Rectangle(0, 0, this.Width, this.Height);
|
||||
if(m_ButtonState == ButtonState.TrackingInside)
|
||||
{
|
||||
if( !bounds.Contains(e.X, e.Y) )
|
||||
OwnerDrawButton_MouseLeave(sender, e);
|
||||
}
|
||||
else if(m_ButtonState == ButtonState.TrackingOutside)
|
||||
{
|
||||
if( bounds.Contains(e.X, e.Y) )
|
||||
OwnerDrawButton_MouseEnter(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void OwnerDrawButton_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
|
||||
{
|
||||
if(m_ButtonState != ButtonState.Normal)
|
||||
{
|
||||
m_ButtonState = ButtonState.Normal;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void OwnerDrawButton_Resize(object sender, System.EventArgs e)
|
||||
{
|
||||
Invalidate();
|
||||
}
|
||||
#endregion Events
|
||||
}
|
||||
}
|
||||
109
vCardEditor/View/UIToolbox/OwnerDrawButton.resx
Normal file
109
vCardEditor/View/UIToolbox/OwnerDrawButton.resx
Normal file
@@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used forserialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Name">
|
||||
<value>OwnerDrawButton</value>
|
||||
</data>
|
||||
</root>
|
||||
BIN
vCardEditor/View/UIToolbox/TRASH01.ICO
Normal file
BIN
vCardEditor/View/UIToolbox/TRASH01.ICO
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
vCardEditor/View/UIToolbox/TRASH01_Pressed.ICO
Normal file
BIN
vCardEditor/View/UIToolbox/TRASH01_Pressed.ICO
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -14,6 +14,7 @@
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
@@ -26,7 +27,6 @@
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
@@ -70,6 +70,7 @@
|
||||
<Compile Include="Model\FixedList.cs" />
|
||||
<Compile Include="Model\ObjectCopier.cs" />
|
||||
<Compile Include="Model\FormState.cs" />
|
||||
<Compile Include="Model\PropertyComparer.cs" />
|
||||
<Compile Include="Repository\ConfigRepository.cs" />
|
||||
<Compile Include="Repository\ContactRepository.cs" />
|
||||
<Compile Include="Repository\FileHandler.cs" />
|
||||
@@ -159,7 +160,6 @@
|
||||
</Compile>
|
||||
<Compile Include="View\EventArgs.cs" />
|
||||
<Compile Include="View\IMainView.cs" />
|
||||
<Compile Include="View\Libs\PropertyComparer.cs" />
|
||||
<Compile Include="View\MainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -170,6 +170,21 @@
|
||||
<Compile Include="View\StateTextBox.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="View\UIToolbox\CollapseBox.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="View\UIToolbox\CollapsibleGroupBox.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="View\UIToolbox\ExpandingPanel.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="View\UIToolbox\ImageButton.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="View\UIToolbox\OwnerDrawButton.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
@@ -199,6 +214,21 @@
|
||||
<EmbeddedResource Include="View\MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="View\UIToolbox\CollapseBox.resx">
|
||||
<DependentUpon>CollapseBox.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="View\UIToolbox\CollapsibleGroupBox.resx">
|
||||
<DependentUpon>CollapsibleGroupBox.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="View\UIToolbox\ExpandingPanel.resx">
|
||||
<DependentUpon>ExpandingPanel.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="View\UIToolbox\ImageButton.resx">
|
||||
<DependentUpon>ImageButton.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="View\UIToolbox\OwnerDrawButton.resx">
|
||||
<DependentUpon>OwnerDrawButton.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<None Include="app.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
@@ -225,6 +255,7 @@
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
Reference in New Issue
Block a user