This commit is contained in:
John Jenko 2010-03-25 14:46:19 +00:00
parent 54cc4b1322
commit b10ade8a14
2 changed files with 90 additions and 69 deletions

View File

@ -51,23 +51,26 @@ namespace Accentra.Controls
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.SuspendLayout();
// //
// TablePicker // TablePicker
// //
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
this.BackColor = System.Drawing.Color.WhiteSmoke; this.BackColor = System.Drawing.Color.LightYellow;
this.ClientSize = new System.Drawing.Size(304, 256); this.ClientSize = new System.Drawing.Size(304, 256);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "TablePicker"; this.Name = "TablePicker";
this.ShowInTaskbar = false; this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "TablePicker"; this.Text = "TablePicker";
this.Click += new System.EventHandler(this.TablePicker_Click);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.TablePicker_Paint);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.TablePicker_MouseMove);
this.MouseEnter += new System.EventHandler(this.TablePicker_MouseEnter);
this.MouseLeave += new System.EventHandler(this.TablePicker_MouseLeave);
this.Deactivate += new System.EventHandler(this.TablePicker_Deactivate); this.Deactivate += new System.EventHandler(this.TablePicker_Deactivate);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.TablePicker_Paint);
this.MouseEnter += new System.EventHandler(this.TablePicker_MouseEnter);
this.Click += new System.EventHandler(this.TablePicker_Click);
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TablePicker_KeyPress);
this.MouseLeave += new System.EventHandler(this.TablePicker_MouseLeave);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.TablePicker_MouseMove);
this.ResumeLayout(false);
} }
#endregion #endregion
@ -77,11 +80,17 @@ namespace Accentra.Controls
private Brush GrayBrush = System.Drawing.Brushes.Gray; private Brush GrayBrush = System.Drawing.Brushes.Gray;
private Brush BlackBrush = System.Drawing.Brushes.Black; private Brush BlackBrush = System.Drawing.Brushes.Black;
private Brush WhiteBrush = System.Drawing.Brushes.White; private Brush WhiteBrush = System.Drawing.Brushes.White;
private Brush Jbrush = System.Drawing.Brushes.LightBlue;
//private Brush Jbrush = System.Drawing.Brushes.LightSteelBlue;
//private Brush Jbrush = System.Drawing.Brushes.SteelBlue;
//private Brush Jbrush = System.Drawing.Brushes.PowderBlue;
private Pen BorderPen = new Pen(SystemColors.ControlDark); private Pen BorderPen = new Pen(SystemColors.ControlDark);
private Pen BluePen = new Pen(Color.SlateGray, 1); private Pen BluePen = new Pen(Color.SlateGray, 1);
private string DispText = "Cancel"; // Display text private string DispText = "Esc to Cancel"; // Display text
private int DispHeight = 20; // Display ("Table 1x1", "Cancel") private int DispHeight = 40;//20; // Display ("Table 1x1", "Cancel")
private Font DispFont = new Font("Tahoma", 8.25F); private Font DispFont = new Font("Tahoma", 8.25F);
private int SquareX = 20; // Width of squares private int SquareX = 20; // Width of squares
private int SquareY = 20; // Height of squares private int SquareY = 20; // Height of squares
@ -134,6 +143,9 @@ namespace Accentra.Controls
if (SelQX > SquareQX - 1) SquareQX = SelQX + 1; if (SelQX > SquareQX - 1) SquareQX = SelQX + 1;
if (SelQY > SquareQY - 1) SquareQY = SelQY + 1; if (SelQY > SquareQY - 1) SquareQY = SelQY + 1;
if (SquareQX < 7) SquareQX = 7;
if (SquareQY < 5) SquareQY = 5;
// Second, expand the dimensions of this form according to the // Second, expand the dimensions of this form according to the
// number of visible squares. // number of visible squares.
this.Width = (SquareX * (SquareQX)) + 5; this.Width = (SquareX * (SquareQX)) + 5;
@ -146,11 +158,14 @@ namespace Accentra.Controls
// the text is left-justified, only the Y (vertical) position // the text is left-justified, only the Y (vertical) position
// is calculated. // is calculated.
int dispY = ((SquareY - 1) * SquareQY) + SquareQY + 4; int dispY = ((SquareY - 1) * SquareQY) + SquareQY + 4;
if (this.Cancel) { //if (this.Cancel) {
DispText = "Cancel"; // DispText = "Esc Key to Cancel";
} else { //} else {
DispText = SelQX.ToString() + " by " + SelQY.ToString() + " Table"; // DispText = SelQX.ToString() + " by " + SelQY.ToString() + " Table";
} //}
//DispText = SelQX.ToString() + " by " + SelQY.ToString() + " Table\nEsc Key to Cancel";
//DispText = SelQY.ToString() + " Row"+((SelQY>1)?"s by ":" by ") + SelQX.ToString() + " Column"+((SelQX>1)?"s\nEsc Key to Cancel":"\nEsc Key to Cancel");
DispText = SelQY.ToString() + " Row" + ((SelQY > 1) ? "s" : "") + " " + SelQX.ToString() + " Column" + ((SelQX > 1) ? "s" : "")+ "\nEsc to Cancel";
g.DrawString(DispText, DispFont, BlackBrush, 3, dispY + 2); g.DrawString(DispText, DispFont, BlackBrush, 3, dispY + 2);
// Draw each of the squares and fill with the default color. // Draw each of the squares and fill with the default color.
@ -164,8 +179,9 @@ namespace Accentra.Controls
// Go back and paint the squares with selection colors. // Go back and paint the squares with selection colors.
for (int x=0; x<SelQX; x++) { for (int x=0; x<SelQX; x++) {
for (int y=0; y<SelQY; y++) { for (int y=0; y<SelQY; y++) {
g.FillRectangle(BeigeBrush, (x*SquareX) + 3, (y*SquareY) + 3, SquareX - 2, SquareY - 2); //g.FillRectangle(BeigeBrush, (x*SquareX) + 3, (y*SquareY) + 3, SquareX - 2, SquareY - 2);
g.DrawRectangle(BluePen, (x*SquareX) + 3, (y*SquareY) + 3, SquareX - 2, SquareY - 2); g.FillRectangle(Jbrush, (x * SquareX) + 3, (y * SquareY) + 3, SquareX - 2, SquareY - 2);
g.DrawRectangle(BluePen, (x * SquareX) + 3, (y * SquareY) + 3, SquareX - 2, SquareY - 2);
} }
} }
} }
@ -179,7 +195,7 @@ namespace Accentra.Controls
// and DialogResult = DialogResult.Cancel // and DialogResult = DialogResult.Cancel
// were previously already set in MouseLeave. // were previously already set in MouseLeave.
this.Hide(); //this.Hide();
} }
/// <summary> /// <summary>
@ -207,18 +223,20 @@ namespace Accentra.Controls
/// escaped (canceling) state. /// escaped (canceling) state.
/// </summary> /// </summary>
private void TablePicker_MouseLeave(object sender, System.EventArgs e) { private void TablePicker_MouseLeave(object sender, System.EventArgs e) {
if (!bHiding) bCancel = true; //if (!bHiding) bCancel = true;
//this.DialogResult = DialogResult.Cancel;
//this.Invalidate();
if (this.DialogResult == DialogResult.None)
this.DialogResult = DialogResult.Cancel; this.DialogResult = DialogResult.Cancel;
this.Invalidate();
} }
/// <summary> /// <summary>
/// Cancels the prior cancellation caused by MouseLeave. /// Cancels the prior cancellation caused by MouseLeave.
/// </summary> /// </summary>
private void TablePicker_MouseEnter(object sender, System.EventArgs e) { private void TablePicker_MouseEnter(object sender, System.EventArgs e) {
bHiding = false; //bHiding = false;
bCancel = false; //bCancel = false;
this.DialogResult = DialogResult.OK; //this.DialogResult = DialogResult.OK;
this.Invalidate(); this.Invalidate();
} }
@ -226,10 +244,23 @@ namespace Accentra.Controls
/// Detects that the user made a selection by clicking. /// Detects that the user made a selection by clicking.
/// </summary> /// </summary>
private void TablePicker_Click(object sender, System.EventArgs e) { private void TablePicker_Click(object sender, System.EventArgs e) {
bHiding = true; // Not the same as Visible == false //bHiding = true; // Not the same as Visible == false
// because bHiding suggests that the control // // because bHiding suggests that the control
// is still "active" (not canceled). // // is still "active" (not canceled).
this.Hide(); //this.Hide();
this.DialogResult = DialogResult.OK;
}
private void TablePicker_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Escape)
{
//bHiding = true; // Not the same as Visible == false
//// because bHiding suggests that the control
//// is still "active" (not canceled).
//this.Hide();
this.DialogResult = DialogResult.Cancel;
}
} }
} }
} }

View File

@ -3,7 +3,7 @@
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 1.3 Version 2.0
The primary goals of this format is to allow a simple XML format The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the that is mostly human readable. The generation and parsing of the
@ -14,16 +14,17 @@
... ado.net/XML headers & schema ... ... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader> <resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, 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="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object] <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <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] <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data> </data>
There are any number of "resheader" rows that contain simple There are any number of "resheader" rows that contain simple
@ -35,7 +36,7 @@
Classes that don't support this are serialized and stored with the Classes that don't support this are serialized and stored with the
mimetype set. mimetype set.
The mimetype is used forserialized objects, and tells the The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly: extensible. For a given mimetype the value must be set accordingly:
@ -45,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
@ -59,18 +60,37 @@
: and then encoded with base64 encoding. : 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:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType> <xsd:complexType>
<xsd:choice maxOccurs="unbounded"> <xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data"> <xsd:element name="data">
<xsd:complexType> <xsd:complexType>
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <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:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence> </xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="resheader"> <xsd:element name="resheader">
@ -89,42 +109,12 @@
<value>text/microsoft-resx</value> <value>text/microsoft-resx</value>
</resheader> </resheader>
<resheader name="version"> <resheader name="version">
<value>1.3</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</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.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</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.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>8, 8</value>
</data>
<data name="$this.Name">
<value>TablePicker</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.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</data>
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>Private</value>
</data>
</root> </root>