- Removed Debug

- Don't resize grid when initializing
- Use LoadGrid which adjusts the Grid Font
- Only save contents if in edit mode
Changes to Comments
Added Property MySymbolFontName
- Setup GoTo button to handle ROTable Grids
- Support GoTo for ROTable Grids (MyFlexGrid.IsRoTable)
- Restored code to handle Vertical Alignment
- Added MyItemInfo property
- Removed commented-out debug in DPI property
- Support Font Override
- Use DisplayText to do ReplaceWords
- Set Text Color to Black (Change Links to Black)
Use DebugOutput property rather than _DebugOutput field
- Override Font for printing grids
- Override Font for printing text
This commit is contained in:
Rich 2011-03-11 15:49:39 +00:00
parent ddb2ea162f
commit 6029f6dd8b
8 changed files with 196 additions and 127 deletions

View File

@ -5,6 +5,7 @@ using System.Drawing;
using System.Data; using System.Data;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
//using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml; using System.Xml;
using VEPROMS.CSLA.Library; using VEPROMS.CSLA.Library;
@ -45,12 +46,6 @@ namespace Volian.Controls.Library
} }
void MyFlexGrid_Resize(object sender, EventArgs e) void MyFlexGrid_Resize(object sender, EventArgs e)
{ {
if (MyItemInfo != null && MyItemInfo.ItemID == 14)
{
//Console.WriteLine("{0},{1},{2}", MyFlexGrid.Height, MyStepRTB.ContentsRectangle.Height,MyFlexGrid.Rows[0].Height);
if (MyFlexGrid.Height < MyStepRTB.ContentsRectangle.Height)
MyFlexGrid.Height = 4 + MyStepRTB.ContentsRectangle.Height;
}
this.Size = new Size(MyFlexGrid.Width + GridMargin, MyFlexGrid.Height + GridMargin); this.Size = new Size(MyFlexGrid.Width + GridMargin, MyFlexGrid.Height + GridMargin);
AdjustTableWidthAndLocation(); AdjustTableWidthAndLocation();
AdjustLocation(); AdjustLocation();
@ -475,9 +470,8 @@ namespace Volian.Controls.Library
} }
private void ConvertTableToGrid(string valtext) private void ConvertTableToGrid(string valtext)
{ {
VE_Font vefont = this.MyItemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList.Table.Font; VE_Font vefont = MyItemInfo.GetItemFont();
Font GridFont = new Font(vefont.Family, (float)vefont.Size); MyFlexGrid.Font = vefont.WindowsFont;
MyFlexGrid.Font = GridFont;
MyFlexGrid.ParseTableFromText(valtext); MyFlexGrid.ParseTableFromText(valtext);
MyFlexGrid.AutoSizeCols(); MyFlexGrid.AutoSizeCols();
MyFlexGrid.AutoSizeRows(); MyFlexGrid.AutoSizeRows();
@ -776,15 +770,24 @@ namespace Volian.Controls.Library
get { return _Empty; } get { return _Empty; }
set { _Empty = value; } set { _Empty = value; }
} }
private bool _Initializing = false;
public bool Initializing
{
get { return _Initializing; }
set { _Initializing = value; }
}
private bool _ActiveMode = false; private bool _ActiveMode = false;
public override void RefreshDisplay(bool activeMode) public override void RefreshDisplay(bool activeMode)
{ {
_ActiveMode = activeMode; _ActiveMode = activeMode;
XmlDocument xd = new XmlDocument(); //XmlDocument xd = new XmlDocument();
xd.LoadXml(MyItemInfo.MyContent.MyGrid.Data); //xd.LoadXml(MyItemInfo.MyContent.MyGrid.Data);
//using (StringReader sr = new StringReader())
MyFlexGrid.Clear(); MyFlexGrid.Clear();
MyFlexGrid.MergedRanges.Clear(); MyFlexGrid.MergedRanges.Clear();
MyFlexGrid.ReadXml(xd); Initializing = true;
MyFlexGrid.LoadGrid(MyItemInfo);
Initializing = false;
MyFlexGrid.KeyActionTab = KeyActionEnum.MoveAcross; MyFlexGrid.KeyActionTab = KeyActionEnum.MoveAcross;
MyFlexGrid.AdjustGridControlSize(); MyFlexGrid.AdjustGridControlSize();
// When a grid is read from XML, all of the styles are updated to the values in the XML. // When a grid is read from XML, all of the styles are updated to the values in the XML.
@ -835,7 +838,7 @@ namespace Volian.Controls.Library
public override void SetExpandAndExpander(ItemInfo itemInfo) { CanExpand = false; } // can't expand a table public override void SetExpandAndExpander(ItemInfo itemInfo) { CanExpand = false; } // can't expand a table
public override void SaveCurrentAndContents() public override void SaveCurrentAndContents()
{ {
if (MyFlexGrid.Row >= 0 && MyFlexGrid.Col >= 0) // Only if a Cell is Selected if (MyFlexGrid.Row >= 0 && MyFlexGrid.Col >= 0 && MyStepRTB.EditMode) // Only if a Cell is Selected
{ {
int row = MyFlexGrid.Row; int row = MyFlexGrid.Row;
int col = MyFlexGrid.Col; int col = MyFlexGrid.Col;

View File

@ -375,7 +375,7 @@ namespace Volian.Controls.Library
{ {
Cursor tmp = Cursor.Current; Cursor tmp = Cursor.Current;
Cursor.Current = Cursors.WaitCursor; Cursor.Current = Cursors.WaitCursor;
int top = TopMostEditItem.Top;// This does'nt work - this is since the last time it was expanded. int top = TopMostEditItem.Top;// This doesn't work - this is since the last time it was expanded.
Colapsing = true; Colapsing = true;
// Hide Children // Hide Children
HideChildren(); HideChildren();

View File

@ -182,11 +182,35 @@ namespace Volian.Controls.Library
OnEditModeChanged(this, new EventArgs()); OnEditModeChanged(this, new EventArgs());
} }
} }
private static string _MySymbolFontName;
public static string MySymbolFontName
{
get { return StepRTB._MySymbolFontName; }
set { StepRTB._MySymbolFontName = value; }
}
private static FontFamily _MyFontFamily = null; private static FontFamily _MyFontFamily = null;
public static FontFamily MyFontFamily public static FontFamily MyFontFamily
{ {
get { return StepRTB._MyFontFamily; } get { return StepRTB._MyFontFamily; }
set { StepRTB._MyFontFamily = value; } set
{
_MyFontFamily = value;
if (value != null)
{
Font font;
if (value.IsStyleAvailable(FontStyle.Regular))
font = new Font(value, 10);
else if (value.IsStyleAvailable(FontStyle.Bold))
font = new Font(value, 10, FontStyle.Bold);
else // (value.IsStyleAvailable(FontStyle.Italic))
font = new Font(value, 10, FontStyle.Italic);
using (StepRTB srtb = new StepRTB())
{
if (srtb.FontIsFixed(font)) _MySymbolFontName = "VESymbFix";
else _MySymbolFontName = "Arial Unicode MS";
}
}
}
} }
// use newer rich text box.... // use newer rich text box....
//[DllImport("kernel32.dll", CharSet = CharSet.Auto)] //[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
@ -316,7 +340,7 @@ namespace Volian.Controls.Library
else else
{ {
if (VlnSettings.DebugMode || VlnSettings.ProductionMode) if (VlnSettings.DebugMode || VlnSettings.ProductionMode)
_FormatFont = new Font(_MyFontFamily == null ? formatFont.FontFamily : _MyFontFamily, formatFont.Size, formatFont.Style); _FormatFont = new Font(MyFontFamily == null ? formatFont.FontFamily : MyFontFamily, formatFont.Size, formatFont.Style);
else else
_FormatFont = new Font("Bookman Old Style", formatFont.Size, formatFont.Style); _FormatFont = new Font("Bookman Old Style", formatFont.Size, formatFont.Style);
// TODO: Release Mode // TODO: Release Mode

View File

@ -243,7 +243,7 @@ namespace Volian.Controls.Library
void _MyStepRTB_LinkChanged(object sender, StepPanelLinkEventArgs args) void _MyStepRTB_LinkChanged(object sender, StepPanelLinkEventArgs args)
{ {
// do all Transition and ReferencedObject menu items/buttons based on whether a 'link is selected' and the link type. // do all Transition and ReferencedObject menu items/buttons based on whether a 'link is selected' and the link type.
btnCMGoTo.Enabled = btnGoTo.Enabled = _MyStepRTB.IsSelectionLinked(_MyStepRTB.SelectionStart, _MyStepRTB.SelectionLength); SetupGoToButton();
if (btnCMGoTo.Enabled == true && _MyStepRTB.MyLinkText != null) // must have some link test, use it to set edit of transition or ro... if (btnCMGoTo.Enabled == true && _MyStepRTB.MyLinkText != null) // must have some link test, use it to set edit of transition or ro...
{ {
btnCMEditTran.Enabled = _MyStepRTB.MyLinkText.IndexOf("Transition") > -1; // selected link must be a transition btnCMEditTran.Enabled = _MyStepRTB.MyLinkText.IndexOf("Transition") > -1; // selected link must be a transition
@ -255,6 +255,13 @@ namespace Volian.Controls.Library
btnCMEditRO.Enabled = false; btnCMEditRO.Enabled = false;
} }
} }
private void SetupGoToButton()
{
if (MyEditItem is GridItem && (MyEditItem as GridItem).MyFlexGrid.IsRoTable)
btnCMGoTo.Enabled = btnGoTo.Enabled = true;
else
btnCMGoTo.Enabled = btnGoTo.Enabled = _MyStepRTB.IsSelectionLinked(_MyStepRTB.SelectionStart, _MyStepRTB.SelectionLength);
}
void _MyStepRTB_Leave(object sender, EventArgs e) void _MyStepRTB_Leave(object sender, EventArgs e)
{ {
// The following two lines were replaced by the third line so that the Ribbon KeyTips will work properly. // The following two lines were replaced by the third line so that the Ribbon KeyTips will work properly.
@ -418,7 +425,8 @@ namespace Volian.Controls.Library
SetPasteButtonEnabled(); SetPasteButtonEnabled();
// do all Transition and ReferencedObject menu items/buttons based on whether a 'link is selected' and the link type. // do all Transition and ReferencedObject menu items/buttons based on whether a 'link is selected' and the link type.
btnCMGoTo.Enabled = btnGoTo.Enabled = _MyStepRTB.IsSelectionLinked(_MyStepRTB.SelectionStart, _MyStepRTB.SelectionLength); //(_MyStepRTB.MyLinkText != null); //btnCMGoTo.Enabled = btnGoTo.Enabled = _MyStepRTB.IsSelectionLinked(_MyStepRTB.SelectionStart, _MyStepRTB.SelectionLength); //(_MyStepRTB.MyLinkText != null);
SetupGoToButton();
if (btnCMGoTo.Enabled == true && _MyStepRTB.MyLinkText != null) // must have some link test, use it to set edit of transition or ro... if (btnCMGoTo.Enabled == true && _MyStepRTB.MyLinkText != null) // must have some link test, use it to set edit of transition or ro...
{ {
btnCMEditTran.Enabled = _MyStepRTB.MyLinkText.IndexOf("Transition") > -1; // selected link must be a transition btnCMEditTran.Enabled = _MyStepRTB.MyLinkText.IndexOf("Transition") > -1; // selected link must be a transition
@ -847,18 +855,30 @@ namespace Volian.Controls.Library
{ {
// if on a transition, go to the selected transition 'to'. If on // if on a transition, go to the selected transition 'to'. If on
// a referenced object, bring up ReferencedObject Editor (for now, just put up a message box. // a referenced object, bring up ReferencedObject Editor (for now, just put up a message box.
if (_MyStepRTB.MyLinkText.IndexOf("Transition") > -1) if (_MyStepRTB.MyLinkText != null && _MyStepRTB.MyLinkText.IndexOf("Transition") > -1)
{ {
_MyEditItem.MyStepPanel.OnLinkClicked(sender, new StepPanelLinkEventArgs(_MyStepRTB.MyLinkText)); _MyEditItem.MyStepPanel.OnLinkClicked(sender, new StepPanelLinkEventArgs(_MyStepRTB.MyLinkText));
} }
else else
{ {
string roapp = Environment.GetEnvironmentVariable("roapp"); string myROID;
LinkText lt = new LinkText(_MyStepRTB.MyLinkText); RODbInfo myRODB;
string args = "\"" + lt.MyRoUsageInfo.MyRODb.FolderPath + "\" " + lt.MyRoUsageInfo.ROID.ToLower(); if (MyFlexGrid != null && MyFlexGrid.IsRoTable)
if (!Directory.Exists(lt.MyRoUsageInfo.MyRODb.FolderPath))
{ {
MessageBox.Show(string.Format("RO Database directory does not exist: {0}", lt.MyRoUsageInfo.MyRODb.FolderPath)); myROID = MyFlexGrid.ROID.ToLower();
myRODB = RODbInfo.Get(MyFlexGrid.RODbId);
}
else
{
LinkText lt = new LinkText(_MyStepRTB.MyLinkText);
myROID = lt.MyRoUsageInfo.ROID.ToLower();
myRODB = lt.MyRoUsageInfo.MyRODb;
}
string roapp = Environment.GetEnvironmentVariable("roapp");
string args = "\"" + myRODB.FolderPath + "\" " + myROID;
if (!Directory.Exists(myRODB.FolderPath))
{
MessageBox.Show(string.Format("RO Database directory does not exist: {0}", myRODB.FolderPath));
return; return;
} }
System.Diagnostics.Process.Start(roapp, args); System.Diagnostics.Process.Start(roapp, args);
@ -1555,55 +1575,55 @@ namespace Volian.Controls.Library
private void btnTblDgnAlgnTxTopLeft_Click(object sender, EventArgs e) private void btnTblDgnAlgnTxTopLeft_Click(object sender, EventArgs e)
{ {
MyFlexGrid.VerticalTopText(); MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.LeftTop);
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left); MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left);
} }
private void btnTblDgnAlgnTxTopCenter_Click(object sender, EventArgs e) private void btnTblDgnAlgnTxTopCenter_Click(object sender, EventArgs e)
{ {
MyFlexGrid.VerticalTopText(); MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.CenterTop);
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center); MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center);
} }
private void btnTblDgnAlgnTxTopRight_Click(object sender, EventArgs e) private void btnTblDgnAlgnTxTopRight_Click(object sender, EventArgs e)
{ {
MyFlexGrid.VerticalTopText(); MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.RightTop);
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right); MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right);
} }
private void btnTblDgnAlgnTxCenterLeft_Click(object sender, EventArgs e) private void btnTblDgnAlgnTxCenterLeft_Click(object sender, EventArgs e)
{ {
MyFlexGrid.VerticalCenterText(); MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.LeftCenter);
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left); MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left);
} }
private void btnTblDgnAlgnTxCenterCenter_Click(object sender, EventArgs e) private void btnTblDgnAlgnTxCenterCenter_Click(object sender, EventArgs e)
{ {
MyFlexGrid.VerticalCenterText(); MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.CenterCenter);
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center); MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center);
} }
private void btnTblDgnAlgnTxCenterRight_Click(object sender, EventArgs e) private void btnTblDgnAlgnTxCenterRight_Click(object sender, EventArgs e)
{ {
MyFlexGrid.VerticalCenterText(); MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.RightCenter);
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right); MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right);
} }
private void btnTblDgnAlgnTxBottomLeft_Click(object sender, EventArgs e) private void btnTblDgnAlgnTxBottomLeft_Click(object sender, EventArgs e)
{ {
MyFlexGrid.VerticalBottomText(); MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.LeftBottom);
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left); MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Left);
} }
private void btnTblDgnAlgnTxBottomCenter_Click(object sender, EventArgs e) private void btnTblDgnAlgnTxBottomCenter_Click(object sender, EventArgs e)
{ {
MyFlexGrid.VerticalBottomText(); MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.CenterBottom);
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center); MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Center);
} }
private void btnTblDgnAlgnTxBottomRight_Click(object sender, EventArgs e) private void btnTblDgnAlgnTxBottomRight_Click(object sender, EventArgs e)
{ {
MyFlexGrid.VerticalBottomText(); MyFlexGrid.ChangeCellAlign(MyFlexGrid.Selection, C1.Win.C1FlexGrid.TextAlignEnum.RightBottom);
MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right); MyFlexGrid.RTFTextAlignment(MyFlexGrid.Selection, HorizontalAlignment.Right);
} }

View File

@ -45,6 +45,12 @@ namespace Volian.Controls.Library
// get { return _MyBorderDetail; } // get { return _MyBorderDetail; }
// set { _MyBorderDetail = value; } // set { _MyBorderDetail = value; }
//} //}
private ItemInfo _MyItemInfo;
public ItemInfo MyItemInfo
{
get { return _MyItemInfo; }
set { _MyItemInfo = value; }
}
[XmlIgnore] [XmlIgnore]
public bool HasVScroll public bool HasVScroll
{ {
@ -129,10 +135,6 @@ namespace Volian.Controls.Library
{ {
_DPI = value; _DPI = value;
} }
//if (value == 120)
// Console.WriteLine("Test");
// if(!(TableCellEditor is StepRTB))
// Console.WriteLine("{0}",TableCellEditor.GetType().Name);
} }
} }
#region Grid Initialize #region Grid Initialize
@ -420,7 +422,26 @@ namespace Volian.Controls.Library
// CellRange cr = GetMergedRange(row, col); // CellRange cr = GetMergedRange(row, col);
// return (cr.r1 == row && cr.c1 == col); // return (cr.r1 == row && cr.c1 == col);
//} //}
private static Regex _ReplaceVESymbFix = new Regex(@"({\\f[0-9]+[^ ]* )(VESymbFix)(;})");
private static Regex _ReplaceArialUnicodeMS = new Regex(@"({\\f[0-9]+[^ ]* )(Arial Unicode MS)(;})");
private static Regex _ReplaceTextFont = new Regex(@"({\\f[0-9]+[^ ]* )(?((?!VESymbFix)(?!Arial Unicode MS))([^;]*)|(!!!!))(;})");
public void LoadGrid(ItemInfo itemInfo)
{
MyItemInfo = itemInfo;
string str = itemInfo.MyContent.MyGrid.Data;
VE_Font vefont = MyItemInfo.GetItemFont();
FontFamily ff = StepRTB.MyFontFamily ?? vefont.WindowsFont.FontFamily; // TODO: Does not change fixed font.
if (StepRTB.MySymbolFontName != "VESymbFix")
str = _ReplaceVESymbFix.Replace(str, "$1" + StepRTB.MySymbolFontName + "$3");
if (StepRTB.MySymbolFontName != "Arial Unicode MS")
str = _ReplaceArialUnicodeMS.Replace(str, "$1" + StepRTB.MySymbolFontName + "$3");
str = _ReplaceTextFont.Replace(str, "$1" + ff.Name + "$4");
using (StringReader sr = new StringReader(str))
{
ReadXml(sr);
sr.Close();
}
}
private void SetupGrid(int numrows, int numcols) //C1FlexGrid NewGrid() private void SetupGrid(int numrows, int numcols) //C1FlexGrid NewGrid()
{ {
// setup the default size of each cell in the table/grid // setup the default size of each cell in the table/grid
@ -458,26 +479,20 @@ namespace Volian.Controls.Library
_tableCellEditor = new TableCellEditor(this); _tableCellEditor = new TableCellEditor(this);
//_tableCellEditor.ContentsResized += new ContentsResizedEventHandler(_tableCellEditor_ContentsResized);
_tableCellEditor.HeightChanged += new StepRTBEvent(_tableCellEditor_HeightChanged); _tableCellEditor.HeightChanged += new StepRTBEvent(_tableCellEditor_HeightChanged);
_clpbrdCpyPste = new TableClipBoardFuncts(); _clpbrdCpyPste = new TableClipBoardFuncts();
//this.Enter += new System.EventHandler(this.Grid_Enter);
this.AfterResizeRow += new C1.Win.C1FlexGrid.RowColEventHandler(this.Grid_AfterResize); this.AfterResizeRow += new C1.Win.C1FlexGrid.RowColEventHandler(this.Grid_AfterResize);
this.StartEdit += new C1.Win.C1FlexGrid.RowColEventHandler(this._StartEdit); this.StartEdit += new C1.Win.C1FlexGrid.RowColEventHandler(this._StartEdit);
this.AfterEdit += new C1.Win.C1FlexGrid.RowColEventHandler(this._AfterEdit); this.AfterEdit += new C1.Win.C1FlexGrid.RowColEventHandler(this._AfterEdit);
//this.LeaveEdit += new RowColEventHandler(VlnFlexGrid_LeaveEdit);
this.AfterScroll += new C1.Win.C1FlexGrid.RangeEventHandler(this._AfterScroll); this.AfterScroll += new C1.Win.C1FlexGrid.RangeEventHandler(this._AfterScroll);
this.AfterResizeColumn += new C1.Win.C1FlexGrid.RowColEventHandler(this.Grid_AfterResize); this.AfterResizeColumn += new C1.Win.C1FlexGrid.RowColEventHandler(this.Grid_AfterResize);
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this._KeyPress); this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this._KeyPress);
this.OwnerDrawCell += new OwnerDrawCellEventHandler(this.Grid_OwnerDrawCell); this.OwnerDrawCell += new OwnerDrawCellEventHandler(this.Grid_OwnerDrawCell);
this.LeaveCell += new EventHandler(VlnFlexGrid_LeaveCell); this.LeaveCell += new EventHandler(VlnFlexGrid_LeaveCell);
//this.ValidateEdit += new ValidateEditEventHandler(VlnFlexGrid_ValidateEdit);
this.KeyDown += new KeyEventHandler(VlnFlexGrid_KeyDown); this.KeyDown += new KeyEventHandler(VlnFlexGrid_KeyDown);
this.KeyUp +=new KeyEventHandler(VlnFlexGrid_KeyUp); this.KeyUp +=new KeyEventHandler(VlnFlexGrid_KeyUp);
this.SelChange += new EventHandler(VlnFlexGrid_SelChange);
this.Resize += new EventHandler(VlnFlexGrid_Resize);
TableCellEditor.EditMode = TableCellEditor.Visible; // need to comment out for compile for only jsj - 07FEB2011 TableCellEditor.EditMode = TableCellEditor.Visible; // need to comment out for compile for only jsj - 07FEB2011
} }
@ -512,20 +527,6 @@ namespace Volian.Controls.Library
} }
} }
} }
void VlnFlexGrid_Resize(object sender, EventArgs e)
{
if (TableCellEditor.Visible)
Volian.Base.Library.vlnStackTrace.ShowStackLocal("VlnFlexGrid_Resize", 1);
}
void VlnFlexGrid_SelChange(object sender, EventArgs e)
{
// Possibilities
// Selection is a single cell
// It is part of a range
// It is
//Console.WriteLine("Where Am I {0} {1} {2}", Selection, GetMergedRange(Row, Col), Selection.Equals(GetMergedRange(Row, Col)));
}
void VlnFlexGrid_KeyUp(object sender, KeyEventArgs e) void VlnFlexGrid_KeyUp(object sender, KeyEventArgs e)
{ {
if (e.Control) if (e.Control)
@ -625,6 +626,12 @@ namespace Volian.Controls.Library
cr.UserData = _rtf.Height; cr.UserData = _rtf.Height;
int hAdjust = 0; int hAdjust = 0;
int hDiff = e.Bounds.Height - _rtf.Height; int hDiff = e.Bounds.Height - _rtf.Height;
if (hDiff < 0)
{
Rows[e.Row].Height = _rtf.Height + 4;
AdjustGridControlSize();
hDiff = 0;
}
if (e.Style != null) if (e.Style != null)
{ {
switch (e.Style.TextAlign) switch (e.Style.TextAlign)
@ -645,7 +652,14 @@ namespace Volian.Controls.Library
break; break;
} }
} }
_rtf.ForeColor = e.Style.ForeColor; if (IsRoTable)
{
_rtf.ForeColor = Color.Red;
}
else
{
_rtf.ForeColor = e.Style.ForeColor;
}
_rtf.BackColor = e.Style.BackColor; _rtf.BackColor = e.Style.BackColor;
_rtf.Render(e.Graphics, new Rectangle(e.Bounds.X+1,e.Bounds.Y + hAdjust,e.Bounds.Width-3,e.Bounds.Height)); _rtf.Render(e.Graphics, new Rectangle(e.Bounds.X+1,e.Bounds.Y + hAdjust,e.Bounds.Width-3,e.Bounds.Height));
//CellRange cr = GetCellRange(e.Row, e.Col); //CellRange cr = GetCellRange(e.Row, e.Col);
@ -740,7 +754,11 @@ namespace Volian.Controls.Library
{ {
CellRange tmp = this.GetCellRange(rw, col, rw, col); CellRange tmp = this.GetCellRange(rw, col, rw, col);
string StyleName = string.Format("R{0}C{1}Style", rw, col); string StyleName = string.Format("R{0}C{1}Style", rw, col);
CellStyle cs = this.Styles.Add(StyleName, tmp.Style); CellStyle cs = null;
if (Styles.Contains(StyleName))
cs = Styles[StyleName];
else
cs = this.Styles.Add(StyleName, tmp.Style);
cs.TextAlign = newAlign; cs.TextAlign = newAlign;
tmp.Style = cs; tmp.Style = cs;
} }
@ -773,64 +791,64 @@ namespace Volian.Controls.Library
} }
} }
} }
public void VerticalCenterText() //public void VerticalCenterText()
{ //{
StepRTB myStepRTB = new StepRTB(); // StepRTB myStepRTB = new StepRTB();
CellRange selRange = this.Selection; // CellRange selRange = this.Selection;
for (int r = selRange.r1; r <= selRange.r2; r++) // for (int r = selRange.r1; r <= selRange.r2; r++)
for (int c = selRange.c1; c <= selRange.c2; c++) // for (int c = selRange.c1; c <= selRange.c2; c++)
{ // {
CellRange mr = this.GetMergedRange(r, c); // CellRange mr = this.GetMergedRange(r, c);
if (mr.r1 == r) // if (mr.r1 == r)
{ // {
int editHeight = (int)mr.UserData; // int editHeight = (int)mr.UserData;
int cellHeight = GetCellHeight(mr.r1, mr.c1); // int cellHeight = GetCellHeight(mr.r1, mr.c1);
if (editHeight < cellHeight) // if (editHeight < cellHeight)
{ // {
myStepRTB.Rtf = (string)mr.Data; // myStepRTB.Rtf = (string)mr.Data;
RTBAPI.SetSpaceBefore(myStepRTB, (cellHeight - editHeight) / 2); // RTBAPI.SetSpaceBefore(myStepRTB, (cellHeight - editHeight) / 2);
PutCellRTFString(mr.r1, mr.c1, myStepRTB.Rtf); // PutCellRTFString(mr.r1, mr.c1, myStepRTB.Rtf);
} // }
} // }
} // }
} //}
public void VerticalTopText() //public void VerticalTopText()
{ //{
StepRTB myStepRTB = new StepRTB(); // StepRTB myStepRTB = new StepRTB();
CellRange selRange = this.Selection; // CellRange selRange = this.Selection;
for (int r = selRange.r1; r <= selRange.r2; r++) // for (int r = selRange.r1; r <= selRange.r2; r++)
for (int c = selRange.c1; c <= selRange.c2; c++) // for (int c = selRange.c1; c <= selRange.c2; c++)
{ // {
CellRange mr = this.GetMergedRange(r, c); // CellRange mr = this.GetMergedRange(r, c);
if (mr.r1 == r) // if (mr.r1 == r)
{ // {
myStepRTB.Rtf = (string)mr.Data; // myStepRTB.Rtf = (string)mr.Data;
RTBAPI.SetSpaceBefore(myStepRTB, 0); // RTBAPI.SetSpaceBefore(myStepRTB, 0);
PutCellRTFString(mr.r1, mr.c1, myStepRTB.Rtf); // PutCellRTFString(mr.r1, mr.c1, myStepRTB.Rtf);
} // }
} // }
} //}
public void VerticalBottomText() //public void VerticalBottomText()
{ //{
StepRTB myStepRTB = new StepRTB(); // StepRTB myStepRTB = new StepRTB();
CellRange selRange = this.Selection; // CellRange selRange = this.Selection;
for (int r = selRange.r1; r <= selRange.r2; r++) // for (int r = selRange.r1; r <= selRange.r2; r++)
for (int c = selRange.c1; c <= selRange.c2; c++) // for (int c = selRange.c1; c <= selRange.c2; c++)
{ // {
CellRange mr = this.GetMergedRange(r, c); // CellRange mr = this.GetMergedRange(r, c);
if (mr.r1 == r) // if (mr.r1 == r)
{ // {
int editHeight = (int)mr.UserData; // int editHeight = (int)mr.UserData;
int cellHeight = GetCellHeight(mr.r1, mr.c1); // int cellHeight = GetCellHeight(mr.r1, mr.c1);
if (editHeight < cellHeight) // if (editHeight < cellHeight)
{ // {
myStepRTB.Rtf = (string)mr.Data; // myStepRTB.Rtf = (string)mr.Data;
RTBAPI.SetSpaceBefore(myStepRTB, (cellHeight - editHeight)); // RTBAPI.SetSpaceBefore(myStepRTB, (cellHeight - editHeight));
PutCellRTFString(mr.r1, mr.c1, myStepRTB.Rtf); // PutCellRTFString(mr.r1, mr.c1, myStepRTB.Rtf);
} // }
} // }
} // }
} //}
//public void SetupCellStyles() //public void SetupCellStyles()
//{ //{
@ -871,6 +889,7 @@ namespace Volian.Controls.Library
/// </summary> /// </summary>
public void AdjustGridControlSize() public void AdjustGridControlSize()
{ {
if (Parent is GridItem ? (Parent as GridItem).Initializing : false ) return;
int difW = this.Width - this.ClientSize.Width; int difW = this.Width - this.ClientSize.Width;
int difH = this.Height - this.ClientSize.Height; int difH = this.Height - this.ClientSize.Height;
int wid = 0; int wid = 0;

View File

@ -135,6 +135,8 @@ namespace Volian.Print.Library
float w = MyTable.ColLeft[cr.c2 + 1] - MyTable.ColLeft[cr.c1]; float w = MyTable.ColLeft[cr.c2 + 1] - MyTable.ColLeft[cr.c1];
float h = MyTable.RowTop[cr.r2 + 1] - MyTable.RowTop[cr.r1]; float h = MyTable.RowTop[cr.r2 + 1] - MyTable.RowTop[cr.r1];
string str = MyFlexGrid.GetCellRTFString(r, c)??string.Empty; string str = MyFlexGrid.GetCellRTFString(r, c)??string.Empty;
DisplayText dt = new DisplayText(MyFlexGrid.MyItemInfo, str, false);
str = dt.StartText;
using (StepRTB myRTB = new StepRTB()) using (StepRTB myRTB = new StepRTB())
{ {
myRTB.Width = (int)w; myRTB.Width = (int)w;
@ -143,7 +145,8 @@ namespace Volian.Print.Library
myRTB.Rtf = str.Replace(@"\~", @"\u160?"); myRTB.Rtf = str.Replace(@"\~", @"\u160?");
else else
myRTB.Text = str; myRTB.Text = str;
//myRTB.ForeColor = System.Drawing.Color.Red; myRTB.SelectAll();
myRTB.SelectionColor = System.Drawing.Color.Black;
str = myRTB.Rtf; str = myRTB.Rtf;
} }
iTextSharp.text.Paragraph myPara = RtfToParagraph(str); iTextSharp.text.Paragraph myPara = RtfToParagraph(str);
@ -254,7 +257,8 @@ namespace Volian.Print.Library
if (cr.Style == null || cr.Style.Border.Style != BorderStyleEnum.None) if (cr.Style == null || cr.Style.Border.Style != BorderStyleEnum.None)
{ {
myColumnText.Canvas.Rectangle(left + x, top - y, w, -h); myColumnText.Canvas.Rectangle(left + x, top - y, w, -h);
myColumnText.Canvas.SetColorStroke(iTextSharp.text.Color.BLACK); iTextSharp.text.Color lineColor = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
myColumnText.Canvas.SetColorStroke(lineColor);
myColumnText.Canvas.SetLineWidth(.5F); myColumnText.Canvas.SetLineWidth(.5F);
if (cr.Style != null && cr.Style.Border.Style == BorderStyleEnum.Dotted) if (cr.Style != null && cr.Style.Border.Style == BorderStyleEnum.Dotted)
{ {

View File

@ -297,7 +297,7 @@ namespace Volian.Print.Library
_MyHelper.Rev = _Rev; _MyHelper.Rev = _Rev;
_MyHelper.RevDate = _RevDate; _MyHelper.RevDate = _RevDate;
_MyHelper.Watermark = _Watermark; _MyHelper.Watermark = _Watermark;
_MyHelper.DoZoomOMatic = _DebugOutput; _MyHelper.DoZoomOMatic = DebugOutput;
OnStatusChanged("After Set PageEvent", PromsPrinterStatusType.SetPageEvent); OnStatusChanged("After Set PageEvent", PromsPrinterStatusType.SetPageEvent);
} }
else else

View File

@ -769,11 +769,7 @@ namespace Volian.Print.Library
if (itemInfo.MyContent.MyGrid != null) if (itemInfo.MyContent.MyGrid != null)
{ {
VlnFlexGrid myFlexGrid = new VlnFlexGrid(1,1); VlnFlexGrid myFlexGrid = new VlnFlexGrid(1,1);
using (StringReader sr = new StringReader(itemInfo.MyContent.MyGrid.Data)) myFlexGrid.LoadGrid(itemInfo);
{
myFlexGrid.ReadXml(sr);
sr.Close();
}
MyGrid = new vlnTable(myFlexGrid, cb); MyGrid = new vlnTable(myFlexGrid, cb);
Height = MyGrid.Height; Height = MyGrid.Height;
Width = MyGrid.Width; Width = MyGrid.Width;
@ -1039,7 +1035,10 @@ namespace Volian.Print.Library
{ {
_RtfSB = new StringBuilder(); _RtfSB = new StringBuilder();
DisplayText vlntxt = new DisplayText(itemInfo, E_EditPrintMode.Print, E_ViewMode.View, true, E_FieldToEdit.StepText, false); DisplayText vlntxt = new DisplayText(itemInfo, E_EditPrintMode.Print, E_ViewMode.View, true, E_FieldToEdit.StepText, false);
_RtfSB.Append(AddFontTable(vlntxt.TextFont.WindowsFont)); System.Drawing.Font myFont = vlntxt.TextFont.WindowsFont;
if (!itemInfo.IsTable && StepRTB.MyFontFamily != null)
myFont = new System.Drawing.Font(StepRTB.MyFontFamily, myFont.Size, myFont.Style);
_RtfSB.Append(AddFontTable(myFont));
_RtfSB.Append(vlntxt.StartText); _RtfSB.Append(vlntxt.StartText);
_RtfSB.Append("}"); _RtfSB.Append("}");
return _RtfSB.ToString(); return _RtfSB.ToString();