This commit is contained in:
John Jenko 2011-03-02 14:06:58 +00:00
parent 089c50befa
commit b0c65d03ea
6 changed files with 1780 additions and 30 deletions

View File

@ -67,6 +67,69 @@ namespace Volian.Controls.Library.Properties {
} }
} }
internal static System.Drawing.Bitmap AlignGridCellBottomCenter {
get {
object obj = ResourceManager.GetObject("AlignGridCellBottomCenter", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap AlignGridCellBottomLeftJust {
get {
object obj = ResourceManager.GetObject("AlignGridCellBottomLeftJust", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap AlignGridCellBottomRight {
get {
object obj = ResourceManager.GetObject("AlignGridCellBottomRight", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap AlignGridCellCenterCenter {
get {
object obj = ResourceManager.GetObject("AlignGridCellCenterCenter", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap AlignGridCellCenterLeftJust {
get {
object obj = ResourceManager.GetObject("AlignGridCellCenterLeftJust", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap AlignGridCellCenterRight {
get {
object obj = ResourceManager.GetObject("AlignGridCellCenterRight", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap AlignGridCellTopCenter {
get {
object obj = ResourceManager.GetObject("AlignGridCellTopCenter", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap AlignGridCellTopLeftJust {
get {
object obj = ResourceManager.GetObject("AlignGridCellTopLeftJust", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap AlignGridCellTopRight {
get {
object obj = ResourceManager.GetObject("AlignGridCellTopRight", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap AlignJustify_Image { internal static System.Drawing.Bitmap AlignJustify_Image {
get { get {
object obj = ResourceManager.GetObject("AlignJustify_Image", resourceCulture); object obj = ResourceManager.GetObject("AlignJustify_Image", resourceCulture);

View File

@ -1761,6 +1761,195 @@
KMGckhevr3l8w5L/37Ys+n8/2On/BAPJFxQZCNJcX9Nfd3H+kv//u5r/Hwi0+USxgSAD5k3urT5VW/54 KMGckhevr3l8w5L/37Ys+n8/2On/BAPJFxQZCNJcX9Nfd3H+kv//u5r/Hwi0+USxgSAD5k3urT5VW/54
eqjHPKoYSCgyYPIEwxCXQcBCGSgFKUtBbBifKAORNaAbQJaBxHoXpA4AG4E67su8bvIAAAAASUVORK5C eqjHPKoYSCgyYPIEwxCXQcBCGSgFKUtBbBifKAORNaAbQJaBxHoXpA4AG4E67su8bvIAAAAASUVORK5C
YII= YII=
</value>
</data>
<data name="AlignGridCellBottomCenter" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAwBQTFRFBAIEBIIE
BIKEBAKEBP78BP4EhAKEhAIExMLE/AL8/P4EBAL8/P78hIIEhIKE/AIE////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////Tc5YRQAAAAlwSFlzAAASdAAA
EnQB3mYfeAAAACtJREFUKFNjYMAAPCgAKE0vAYRLeHiwWovsVOwqwBrBAOhobGag+5YDDQAAT6QHob9T
T5AAAAAASUVORK5CYII=
</value>
</data>
<data name="AlignGridCellBottomLeftJust" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAwBQTFRFBAIEBIIE
BIKEBAKEBP78BP4EhAKEhAIExMLE/AL8/P4EBAL8/P78hIIEhIKE/AIE////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////Tc5YRQAAAAlwSFlzAAASdAAA
EnQB3mYfeAAAACRJREFUKFNjYMAAPCgAKE0nAWSH8GC1lngVYCdjMwPdtxxoAABC8AeJzVtqzgAAAABJ
RU5ErkJggg==
</value>
</data>
<data name="AlignGridCellBottomRight" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAwBQTFRFBAIEBIIE
BIKEBAKEBP78BP4EhAKEhAIExMLE/AL8/P4EBAL8/P78hIIEhIKE/AIE////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////Tc5YRQAAAAlwSFlzAAASdAAA
EnQB3mYfeAAAAChJREFUKFNjYMAAPCgAKE03AYRTeLBai+xU7CpAToWpwqoC3bccaAAAUNwHofjO+1EA
AAAASUVORK5CYII=
</value>
</data>
<data name="AlignGridCellCenterCenter" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAwBQTFRFBAIEBIIE
BIKEBAKEBP78BP4EhAKEhAIExMLE/AL8/P4EBAL8/P78hIIEhIKE/AIE////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////Tc5YRQAAAAlwSFlzAAASdAAA
EnQB3mYfeAAAAC5JREFUKFNjYMAAPCgAKE2WAMJYHh6sZiDbi10FWCMYAF1ArjuQHY/pVwYONAAAB+wH
oSPPfLwAAAAASUVORK5CYII=
</value>
</data>
<data name="AlignGridCellCenterLeftJust" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAwBQTFRFBAIEBIIE
BIKEBAKEBP78BP4EhAKEhAIExMLE/AL8/P4EBAL8/P78hIIEhIKE/AIE////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////Tc5YRQAAAAlwSFlzAAASdAAA
EnQB3mYfeAAAACZJREFUKFNjYMAAPCgAKE2OALKpPFjNIF4F2H4y3YHuF3TfcqABAPZhB4lnYAbaAAAA
AElFTkSuQmCC
</value>
</data>
<data name="AlignGridCellCenterRight" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAwBQTFRFBAIEBIIE
BIKEBAKEBP78BP4EhAKEhAIExMLE/AL8/P4EBAL8/P78hIIEhIKE/AIE////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////Tc5YRQAAAAlwSFlzAAASdAAA
EnQB3mYfeAAAACxJREFUKFNjYMAAPCgAKE2eAMJcHqxmINuLXQXIXpgq3CrgriPKpei+5UADAAkkB6HU
tdtAAAAAAElFTkSuQmCC
</value>
</data>
<data name="AlignGridCellTopCenter" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAwBQTFRFBAIEBIIE
BIKEBAKEBP78BP4EhAKEhAIExMLE/AL8/P4EBAL8/P78hIIEhIKE/AIE////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////Tc5YRQAAAAlwSFlzAAASdAAA
EnQB3mYfeAAAAC5JREFUKFNjYMAAPCgAKM3Dg1ADZmOqQDYEuwqEIUDdWM3AtBZZhEpa0H3LgQYAwCUH
ofZjoJYAAAAASUVORK5CYII=
</value>
</data>
<data name="AlignGridCellTopLeftJust" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAwBQTFRFBAIEBIIE
BIKEBAKEBP78BP4EhAKEhAIExMLE/AL8/P4EBAL8/P78hIIEhIKE/AIE////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////Tc5YRQAAAAlwSFlzAAASdAAA
EnQB3mYfeAAAACVJREFUKFNjYMAAPCgAKM2DrATEoUQFWC9WMzCspYUAum850AAAqeEHiQjZxHwAAAAA
SUVORK5CYII=
</value>
</data>
<data name="AlignGridCellTopRight" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAwBQTFRFBAIEBIIE
BIKEBAKEBP78BP4EhAKEhAIExMLE/AL8/P4EBAL8/P78hIIEhIKE/AIE////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////Tc5YRQAAAAlwSFlzAAASdAAA
EnQB3mYfeAAAADNJREFUKFNjYMAAPCgAKA3kIxSBmJgqkA3BrgKkB6YKtwq4yVhtweIwJCGitKD7lgMN
AADBXQehB7bhZAAAAABJRU5ErkJggg==
</value> </value>
</data> </data>
</root> </root>

View File

@ -1559,6 +1559,21 @@ namespace Volian.Controls.Library
MyFlexGrid.InsertColumnAfter(); MyFlexGrid.InsertColumnAfter();
} }
private void ToggleTableDesignButtons(bool enable)
{
cpTblDgnHighlight.Enabled = enable;
btnTblDgnAlignText.Enabled = enable;
btnTblDgnClear.Enabled = enable;
btnTblDgnCopy.Enabled = enable;
btnTblDgnDelete.Enabled = enable;
btnTblDgnGridStyle.Enabled = enable;
btnTblDgnInsertColumn.Enabled = enable;
btnTblDgnInsertRow.Enabled = enable;
btnTblDgnMergeCells.Enabled = enable;
btnTblDgnPaste.Enabled = enable;
btnTblDgnSplitCells.Enabled = enable;
btnTblDgnTableBorder.Enabled = enable;
}
private void btnTblDgnAdjustSize_Click(object sender, EventArgs e) private void btnTblDgnAdjustSize_Click(object sender, EventArgs e)
{ {
if (MyFlexGrid.Cols.Fixed == 0) // allow change of size. if (MyFlexGrid.Cols.Fixed == 0) // allow change of size.
@ -1566,12 +1581,14 @@ namespace Volian.Controls.Library
// set all the rows and columns to Fixed so that user can adjust the row/column size // set all the rows and columns to Fixed so that user can adjust the row/column size
MyFlexGrid.Cols.Fixed = MyFlexGrid.Cols.Count; MyFlexGrid.Cols.Fixed = MyFlexGrid.Cols.Count;
MyFlexGrid.Rows.Fixed = MyFlexGrid.Rows.Count; MyFlexGrid.Rows.Fixed = MyFlexGrid.Rows.Count;
ToggleTableDesignButtons(false);
} }
else else
{ {
// set grid back to "normal" mode // set grid back to "normal" mode
MyFlexGrid.Cols.Fixed = 0; MyFlexGrid.Cols.Fixed = 0;
MyFlexGrid.Rows.Fixed = 0; MyFlexGrid.Rows.Fixed = 0;
ToggleTableDesignButtons(true);
} }
} }
#endregion #endregion
@ -1644,6 +1661,75 @@ namespace Volian.Controls.Library
} }
#endregion #endregion
private void btnTblDgnDeleteRow_Click_1(object sender, EventArgs e)
{
MyFlexGrid.RemoveSelectedRow();
}
private void btnTblDgnDeleteColumn_Click_1(object sender, EventArgs e)
{
MyFlexGrid.RemoveSelectedColumn();
}
private void btnTblDgnDeleteSelected_Click_1(object sender, EventArgs e)
{
MyFlexGrid.RemoveSelectedCells();
}
private void btnTblDgnAlgnTxTopLeft_Click(object sender, EventArgs e)
{
MyFlexGrid.VerticalTopText();
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left);
}
private void btnTblDgnAlgnTxTopCenter_Click(object sender, EventArgs e)
{
MyFlexGrid.VerticalTopText();
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center);
}
private void btnTblDgnAlgnTxTopRight_Click(object sender, EventArgs e)
{
MyFlexGrid.VerticalTopText();
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right);
}
private void btnTblDgnAlgnTxCenterLeft_Click(object sender, EventArgs e)
{
MyFlexGrid.VerticalCenterText();
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left);
}
private void btnTblDgnAlgnTxCenterCenter_Click(object sender, EventArgs e)
{
MyFlexGrid.VerticalCenterText();
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center);
}
private void btnTblDgnAlgnTxCenterRight_Click(object sender, EventArgs e)
{
MyFlexGrid.VerticalCenterText();
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right);
}
private void btnTblDgnAlgnTxBottomLeft_Click(object sender, EventArgs e)
{
MyFlexGrid.VerticalBottomText();
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left);
}
private void btnTblDgnAlgnTxBottomCenter_Click(object sender, EventArgs e)
{
MyFlexGrid.VerticalBottomText();
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center);
}
private void btnTblDgnAlgnTxBottomRight_Click(object sender, EventArgs e)
{
MyFlexGrid.VerticalBottomText();
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right);
}
} }
public enum E_FieldToEdit { StepText, Text, Number }; public enum E_FieldToEdit { StepText, Text, Number };

File diff suppressed because it is too large Load Diff

View File

@ -740,7 +740,115 @@ namespace Volian.Controls.Library
CellRange sel = this.Selection; CellRange sel = this.Selection;
//sel.UserData = trtb.ContentsRectangle.Height; //sel.UserData = trtb.ContentsRectangle.Height;
// Now see the the selected row,col is in the defined merge ranges // Now adjust the Height and Width in the defined merge ranges
AdjustMergeRangeHeightWidth(r, c, trtb, tstr, AllowWidthShrink);
//// Now see the the selected row,col is in the defined merge ranges
//bool mrgrows = false;
//bool mrgcols = false;
//foreach (CellRange cr in this.MergedRanges)
//{
// if (cr.Contains(r, c))
// {
// if (cr.c1 != cr.c2)
// mrgcols = true; // in a range of merged columns
// if (cr.r1 != cr.r2)
// mrgrows = true; // in a range of merged rows
// continue;
// }
//}
//if (!mrgcols || !mrgrows)
//{
// // IF the row of the selected cell is NOT in merged range
// // then go ahead and adjust the row height (if needed)
// if (!mrgrows)
// {
// // add adjustment for grid and cell borders
// int newheight = trtb.Height + 3;
// //Console.WriteLine("{0} {1} {2} '{3}'", r, c, newheight,trtb.Text);
// if (newheight > this.Rows[r].Height)
// {
// //Console.WriteLine("1 Row {0} Old Height = {1}, New Height = {2}", r, Rows[r].Height, newheight);
// this.Rows[r].Height = newheight;
// }
// }
// // IF the column of the selected cell is NOT in merged range
// // then go ahead and adjust the column width (if needed)
// if (!mrgcols)
// {
// // add adjustment for grid and cell borders
// int newwidth = trtb.Width + 2;
// if (newwidth > this.Cols[c].Width || AllowWidthShrink || r == 0)
// this.Cols[c].Width = newwidth;
// }
//}
//if (mrgrows && tstr != null)
//{
// CellRange cr = GetMergedRange(r, c);
// //Console.WriteLine("grid[{0},{1}] merge = {2}", r, c,cr);
// if (cr.r1 == r && cr.c1 == c)
// {
// // if in merged rows, then make sure the cell's height is large enough
// string[] strary = tstr.Split("\n".ToCharArray());
// // count number of lines of text
// int nlines = strary.Length;
// // count number of rows in merge range
// int nrows = (cr.r2 - cr.r1) + 1;
// //Console.WriteLine("2 Row {0} Height = {1}", cr.r1, Rows[cr.r1].Height);
// while (nlines > nrows)
// {
// // add length to first row in merged range
// int h = this.Rows[cr.r1].Height;
// int defH = Rows.DefaultSize - 3;
// //h = (h == -1) ? _minRowHeight * 2 : h + _minRowHeight;
// h = (h == -1) ? (defH * 2) + 3 : h + defH;
// //h = (h == -1) ? (Rows.DefaultSize + 2) * 2 : h + Rows.DefaultSize + 2;
// //Console.WriteLine("3 Row {0} Old Height = {1}, New Height = {2}", cr.r1, Rows[cr.r1].Height, h);
// this.Rows[cr.r1].Height = h;
// nrows++;
// }
// }
//}
}
private void AdjustCellHeightWidth(int r, int c)
{
StepRTB trtb = new StepRTB();
string tstr = null;
bool dummyCharWidth = false;
bool AllowWidthShrink = false;
trtb.SetTableGridCellRTFPrefix(this.Font);
trtb.Clear();
trtb.Font = this.Font;
trtb.Rtf = (string)this[r, c];
tstr = trtb.Text;
if (tstr != null && tstr.Length > 0)
AllowWidthShrink = tstr.Contains("#Link:");
else
{
trtb.Text = "X"; // this is to trick steprtf in giving a char width to fit one character
// note that a space character was too small.
dummyCharWidth = true;
}
// find the needed cell width
trtb.AdjustWidthForContent();
if (dummyCharWidth)
{
trtb.Text = ""; // clear out the dummy character before saving
dummyCharWidth = false;
}
this.Select(r, c, false);
CellRange sel = this.Selection;
// Now adjust the Height and Width in the defined merge ranges
AdjustMergeRangeHeightWidth(r, c, trtb, tstr, AllowWidthShrink);
}
private void AdjustMergeRangeHeightWidth(int r, int c, StepRTB trtb, string tstr, bool AllowWidthShrink)
{
bool mrgrows = false; bool mrgrows = false;
bool mrgcols = false; bool mrgcols = false;
foreach (CellRange cr in this.MergedRanges) foreach (CellRange cr in this.MergedRanges)
@ -784,7 +892,6 @@ namespace Volian.Controls.Library
if (mrgrows && tstr != null) if (mrgrows && tstr != null)
{ {
CellRange cr = GetMergedRange(r, c); CellRange cr = GetMergedRange(r, c);
//Console.WriteLine("grid[{0},{1}] merge = {2}", r, c,cr);
if (cr.r1 == r && cr.c1 == c) if (cr.r1 == r && cr.c1 == c)
{ {
// if in merged rows, then make sure the cell's height is large enough // if in merged rows, then make sure the cell's height is large enough
@ -799,21 +906,43 @@ namespace Volian.Controls.Library
// add length to first row in merged range // add length to first row in merged range
int h = this.Rows[cr.r1].Height; int h = this.Rows[cr.r1].Height;
int defH = Rows.DefaultSize - 3; int defH = Rows.DefaultSize - 3;
//h = (h == -1) ? _minRowHeight * 2 : h + _minRowHeight;
h = (h == -1) ? (defH * 2) + 3 : h + defH; h = (h == -1) ? (defH * 2) + 3 : h + defH;
//h = (h == -1) ? (Rows.DefaultSize + 2) * 2 : h + Rows.DefaultSize + 2;
//Console.WriteLine("3 Row {0} Old Height = {1}, New Height = {2}", cr.r1, Rows[cr.r1].Height, h);
this.Rows[cr.r1].Height = h; this.Rows[cr.r1].Height = h;
nrows++; nrows++;
} }
} }
} }
} }
//private void AdjustCellHeightWidth(int r, int c, StepRTB trtb) //private void AdjustCellHeightWidth(int r, int c)
//{ //{
// StepRTB trtb = new StepRTB();
// string tstr = null;
// bool dummyCharWidth = false;
// bool AllowWidthShrink = false;
// trtb.SetTableGridCellRTFPrefix(this.Font);
// trtb.Clear();
// trtb.Font = this.Font;
// trtb.Rtf = (string)this[r, c];
// tstr = trtb.Text;
// if (tstr != null && tstr.Length > 0)
// AllowWidthShrink = tstr.Contains("#Link:");
// else
// {
// trtb.Text = "X"; // this is to trick steprtf in giving a char width to fit one character
// // note that a space character was too small.
// dummyCharWidth = true;
// }
// // find the needed cell width
// trtb.AdjustWidthForContent();
// if (dummyCharWidth)
// {
// trtb.Text = ""; // clear out the dummy character before saving
// dummyCharWidth = false;
// }
// this.Select(r, c, false); // this.Select(r, c, false);
// CellRange sel = this.Selection; // CellRange sel = this.Selection;
// //sel.UserData = trtb.ContentsRectangle.Height;
// // Now see the the selected row,col is in the defined merge ranges // // Now see the the selected row,col is in the defined merge ranges
// bool mrgrows = false; // bool mrgrows = false;
@ -838,10 +967,12 @@ namespace Volian.Controls.Library
// // add adjustment for grid and cell borders // // add adjustment for grid and cell borders
// int newheight = trtb.Height + 3; // int newheight = trtb.Height + 3;
// //if (newheight > this.Rows[r].Height) // //Console.WriteLine("{0} {1} {2} '{3}'", r, c, newheight,trtb.Text);
// //{ // if (newheight > this.Rows[r].Height)
// {
// //Console.WriteLine("1 Row {0} Old Height = {1}, New Height = {2}", r, Rows[r].Height, newheight);
// this.Rows[r].Height = newheight; // this.Rows[r].Height = newheight;
// //} // }
// } // }
// // IF the column of the selected cell is NOT in merged range // // IF the column of the selected cell is NOT in merged range
// // then go ahead and adjust the column width (if needed) // // then go ahead and adjust the column width (if needed)
@ -850,7 +981,7 @@ namespace Volian.Controls.Library
// // add adjustment for grid and cell borders // // add adjustment for grid and cell borders
// int newwidth = trtb.Width + 2; // int newwidth = trtb.Width + 2;
// //if (newwidth > this.Cols[c].Width || AllowWidthShrink || r == 0) // if (newwidth > this.Cols[c].Width || AllowWidthShrink || r == 0)
// this.Cols[c].Width = newwidth; // this.Cols[c].Width = newwidth;
// } // }
// } // }
@ -865,6 +996,7 @@ namespace Volian.Controls.Library
// int nlines = strary.Length; // int nlines = strary.Length;
// // count number of rows in merge range // // count number of rows in merge range
// int nrows = (cr.r2 - cr.r1) + 1; // int nrows = (cr.r2 - cr.r1) + 1;
// //Console.WriteLine("2 Row {0} Height = {1}", cr.r1, Rows[cr.r1].Height);
// while (nlines > nrows) // while (nlines > nrows)
// { // {
// // add length to first row in merged range // // add length to first row in merged range
@ -1742,7 +1874,7 @@ namespace Volian.Controls.Library
} }
if (!didremove) if (!didremove)
MessageBox.Show("Cannot Removed Part of a Row or Column.", "Invalid Selection"); MessageBox.Show("Cannot Removed Part of a Row or Column.\n\nNote: This function allows you to delete one or more rows/columns at time.", "Invalid Selection",MessageBoxButtons.OK,MessageBoxIcon.Hand);
return; return;
} }
@ -1796,9 +1928,11 @@ namespace Volian.Controls.Library
trtb.AdjustWidthForContent(); trtb.AdjustWidthForContent();
} }
this[r, c] = trtb.Rtf; this[r, c] = trtb.Rtf;
this.ConvertTextCellToRTF(r, c); //this.ConvertTextCellToRTF(r, c);
this.AdjustCellHeightWidth(r, c);
} }
} }
FixTableCellsHeightWidth();
} }