AdjustBuildRevision, FlexMsgBx, Formats, LBWordLib, VlnStatus, RoAccessToSql, TablePicker, VG
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Accentra.Controls
|
||||
@@ -11,11 +8,6 @@ namespace Accentra.Controls
|
||||
/// </summary>
|
||||
public class TablePicker : System.Windows.Forms.Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
public TablePicker()
|
||||
{
|
||||
// Activates double buffering
|
||||
@@ -29,21 +21,6 @@ namespace Accentra.Controls
|
||||
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 Windows Form Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
@@ -75,82 +52,41 @@ namespace Accentra.Controls
|
||||
}
|
||||
#endregion
|
||||
|
||||
private Pen BeigePen = new Pen(Color.Beige, 1);
|
||||
private Brush BeigeBrush = System.Drawing.Brushes.Beige;
|
||||
private Brush GrayBrush = System.Drawing.Brushes.Gray;
|
||||
private Brush BlackBrush = System.Drawing.Brushes.Black;
|
||||
private Brush WhiteBrush = System.Drawing.Brushes.White;
|
||||
private readonly Brush BlackBrush = System.Drawing.Brushes.Black;
|
||||
private readonly 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 readonly Brush Jbrush = System.Drawing.Brushes.LightBlue;
|
||||
|
||||
private Pen BorderPen = new Pen(SystemColors.ControlDark);
|
||||
private Pen BluePen = new Pen(Color.SlateGray, 1);
|
||||
private readonly Pen BorderPen = new Pen(SystemColors.ControlDark);
|
||||
private readonly Pen BluePen = new Pen(Color.SlateGray, 1);
|
||||
|
||||
private string DispText = "Esc to Cancel"; // Display text
|
||||
private int DispHeight = 40;//20; // Display ("Table 1x1", "Cancel")
|
||||
private Font DispFont = new Font("Tahoma", 8.25F);
|
||||
private int SquareX = 20; // Width of squares
|
||||
private int SquareY = 20; // Height of squares
|
||||
private readonly int DispHeight = 40; // Display ("Table 1x1", "Cancel")
|
||||
private readonly Font DispFont = new Font("Tahoma", 8.25F);
|
||||
private readonly int SquareX = 20; // Width of squares
|
||||
private readonly int SquareY = 20; // Height of squares
|
||||
private int SquareQX = 3; // Number of visible squares (X)
|
||||
private int SquareQY = 3; // Number of visible squares (Y)
|
||||
private int SelQX = 1; // Number of selected squares (x)
|
||||
private int SelQY = 1; // Number of selected squares (y)
|
||||
|
||||
private bool bHiding = false;
|
||||
private bool bCancel = true; // Determines whether to Cancel
|
||||
public int MaxRows { get; set; } = -1;
|
||||
|
||||
// Added my Volian 4/27/11
|
||||
private int _MaxRows = -1;
|
||||
public int MaxCols { get; set; } = -1;
|
||||
|
||||
public int MaxRows
|
||||
{
|
||||
get { return _MaxRows; }
|
||||
set { _MaxRows = value; }
|
||||
}
|
||||
private int _MaxCols = -1;
|
||||
/// <summary>
|
||||
/// Returns the number of columns, or the horizontal / X count,
|
||||
/// of the selection.
|
||||
/// </summary>
|
||||
public int SelectedColumns => SelQX;
|
||||
|
||||
public int MaxCols
|
||||
{
|
||||
get { return _MaxCols; }
|
||||
set { _MaxCols = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns the number of rows, or the vertical / Y count,
|
||||
/// of the selection.
|
||||
/// </summary>
|
||||
public int SelectedRows => SelQY;
|
||||
|
||||
/// <summary>
|
||||
/// Similar to <code><see cref="DialogResult"/>
|
||||
/// == <see cref="DialogResult.Cancel"/></code>,
|
||||
/// but is used as a state value before the form
|
||||
/// is hidden and cancellation is finalized.
|
||||
/// </summary>
|
||||
public bool Cancel {
|
||||
get {
|
||||
return bCancel;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the number of columns, or the horizontal / X count,
|
||||
/// of the selection.
|
||||
/// </summary>
|
||||
public int SelectedColumns {
|
||||
get {
|
||||
return SelQX;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the number of rows, or the vertical / Y count,
|
||||
/// of the selection.
|
||||
/// </summary>
|
||||
public int SelectedRows {
|
||||
get {
|
||||
return SelQY;
|
||||
}
|
||||
}
|
||||
|
||||
private void TablePicker_Paint(object sender, System.Windows.Forms.PaintEventArgs e) {
|
||||
private void TablePicker_Paint(object sender, System.Windows.Forms.PaintEventArgs e) {
|
||||
Graphics g = e.Graphics;
|
||||
|
||||
// First, increment the number of visible squares if the
|
||||
@@ -162,8 +98,8 @@ namespace Accentra.Controls
|
||||
if (SquareQX < 7) SquareQX = 7;
|
||||
if (SquareQY < 5) SquareQY = 5;
|
||||
|
||||
if (_MaxRows > 0 && SquareQY > _MaxRows) SquareQY = _MaxRows;
|
||||
if (_MaxCols > 0 && SquareQX > _MaxCols) SquareQX = _MaxCols;
|
||||
if (MaxRows > 0 && SquareQY > MaxRows) SquareQY = MaxRows;
|
||||
if (MaxCols > 0 && SquareQX > MaxCols) SquareQX = MaxCols;
|
||||
|
||||
// Second, expand the dimensions of this form according to the
|
||||
// number of visible squares.
|
||||
@@ -177,14 +113,7 @@ namespace Accentra.Controls
|
||||
// the text is left-justified, only the Y (vertical) position
|
||||
// is calculated.
|
||||
int dispY = ((SquareY - 1) * SquareQY) + SquareQY + 4;
|
||||
//if (this.Cancel) {
|
||||
// DispText = "Esc Key to Cancel";
|
||||
//} else {
|
||||
// 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";
|
||||
DispText = $"{SelQY} Row{((SelQY > 1) ? "s" : "")} {SelQX} Column{((SelQX > 1) ? "s" : "")}\nEsc to Cancel";
|
||||
g.DrawString(DispText, DispFont, BlackBrush, 3, dispY + 2);
|
||||
|
||||
// Draw each of the squares and fill with the default color.
|
||||
@@ -198,7 +127,6 @@ namespace Accentra.Controls
|
||||
// Go back and paint the squares with selection colors.
|
||||
for (int x=0; x<SelQX; x++) {
|
||||
for (int y=0; y<SelQY; y++) {
|
||||
//g.FillRectangle(BeigeBrush, (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);
|
||||
}
|
||||
@@ -210,11 +138,6 @@ namespace Accentra.Controls
|
||||
/// </summary>
|
||||
private void TablePicker_Deactivate(object sender, System.EventArgs e) {
|
||||
|
||||
// bCancel = true
|
||||
// and DialogResult = DialogResult.Cancel
|
||||
// were previously already set in MouseLeave.
|
||||
|
||||
//this.Hide();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -242,42 +165,24 @@ namespace Accentra.Controls
|
||||
/// escaped (canceling) state.
|
||||
/// </summary>
|
||||
private void TablePicker_MouseLeave(object sender, System.EventArgs e) {
|
||||
//if (!bHiding) bCancel = true;
|
||||
//this.DialogResult = DialogResult.Cancel;
|
||||
//this.Invalidate();
|
||||
if (this.DialogResult == DialogResult.None)
|
||||
this.DialogResult = DialogResult.Cancel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cancels the prior cancellation caused by MouseLeave.
|
||||
/// </summary>
|
||||
private void TablePicker_MouseEnter(object sender, System.EventArgs e) {
|
||||
//bHiding = false;
|
||||
//bCancel = false;
|
||||
//this.DialogResult = DialogResult.OK;
|
||||
this.Invalidate();
|
||||
}
|
||||
/// <summary>
|
||||
/// Cancels the prior cancellation caused by MouseLeave.
|
||||
/// </summary>
|
||||
private void TablePicker_MouseEnter(object sender, System.EventArgs e) => this.Invalidate();
|
||||
|
||||
/// <summary>
|
||||
/// Detects that the user made a selection by clicking.
|
||||
/// </summary>
|
||||
private void TablePicker_Click(object sender, System.EventArgs e) {
|
||||
//bHiding = true; // Not the same as Visible == false
|
||||
// // because bHiding suggests that the control
|
||||
// // is still "active" (not canceled).
|
||||
//this.Hide();
|
||||
this.DialogResult = DialogResult.OK;
|
||||
}
|
||||
/// <summary>
|
||||
/// Detects that the user made a selection by clicking.
|
||||
/// </summary>
|
||||
private void TablePicker_Click(object sender, System.EventArgs e) => this.DialogResult = DialogResult.OK;
|
||||
|
||||
private void TablePicker_KeyPress(object sender, KeyPressEventArgs e)
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user