diff --git a/PROMS/Volian.Controls.Library/BorderSelectionPanel.cs b/PROMS/Volian.Controls.Library/BorderSelectionPanel.cs index e3dbdcbd..e662d5a0 100644 --- a/PROMS/Volian.Controls.Library/BorderSelectionPanel.cs +++ b/PROMS/Volian.Controls.Library/BorderSelectionPanel.cs @@ -156,7 +156,7 @@ namespace Volian.Controls.Library public void InitializeBorder(VlnFlexGrid myFlexGrid, CellRange myRange) { if (myRange.r1 == 0 && myRange.c1 == 0 && myRange.r2 == 2 && myRange.c2 == 2) - Console.WriteLine("here"); + //Console.WriteLine("here"); _TopBorder = GridLinePattern.Unknown; _InsideHorizontalBorder = GridLinePattern.Unknown; _BottomBorder = GridLinePattern.Unknown; @@ -219,20 +219,20 @@ namespace Volian.Controls.Library #region Event Handlers private void BorderSelectionPanel_MouseDown(object sender, MouseEventArgs e) { - if (e.X < 20 && e.Y > 20 && e.Y < Height - 20) + if (e.X < 20) LeftBorder = SelectedBorder; - else if (e.X > Width - 20 && e.Y > 20 && e.Y < Height - 20) + else if (e.X > Width - 20) RightBorder = SelectedBorder; - else if (e.Y < 20 && e.X > 20 && e.X < Width - 20) + if (e.Y < 20) TopBorder = SelectedBorder; - else if (e.Y > Height - 20 && e.X > 20 && e.X < Width - 20) + else if (e.Y > Height - 20) BottomBorder = SelectedBorder; - else if (HasRows && ( e.X < (Width / 2) - 2 || e.X > (Width / 2) + 2)) - InsideHorizontalBorder = SelectedBorder; - else if (HasColumns && ( e.Y < (Height / 2) - 2 || e.Y > (Height / 2) + 2)) - InsideVerticalBorder = SelectedBorder; - else if(HasRows && HasColumns) - InsideVerticalBorder = InsideHorizontalBorder = SelectedBorder; + int dx = Math.Abs(e.X - Width / 2); + int dy = Math.Abs(e.Y - Height / 2); + if (HasRows && dy < 10) + InsideHorizontalBorder = SelectedBorder; + if (HasColumns && dx < 10) + InsideVerticalBorder = SelectedBorder; } private void BorderSelectionPanel_Paint(object sender, PaintEventArgs e) { diff --git a/PROMS/Volian.Controls.Library/GridItem.cs b/PROMS/Volian.Controls.Library/GridItem.cs index 8b33de3f..7276eecd 100644 --- a/PROMS/Volian.Controls.Library/GridItem.cs +++ b/PROMS/Volian.Controls.Library/GridItem.cs @@ -163,6 +163,7 @@ namespace Volian.Controls.Library void MyStepRTB_VisibleChanged(object sender, EventArgs e) { MyStepRTB.EditMode = MyStepRTB.Visible; + //Console.WriteLine("MyStepRTB_VisibleChanged {0}", MyStepRTB.Width); //Console.WriteLine("GridItem: EditMode = {0}", MyStepRTB.EditMode); } void MyStepRTB_ReturnToEditor(object sender, EventArgs args) @@ -270,7 +271,21 @@ namespace Volian.Controls.Library this.MyStepRTB.GotFocus += new EventHandler(MyStepRTB_GotFocus); this.MyStepRTB.RoInsert += new StepRTBRoEvent(MyStepRTB_RoInsert); this.MyFlexGrid.AdjustPastedText += new VlnFlexGridPasteEvent(MyFlexGrid_AdjustPastedText); + // This Resize event has been useful for debugging purposes numerous times + // + //this.MyStepRTB.Resize += new EventHandler(MyStepRTB_Resize); } + + // This Resize event been useful for debugging purposes numerous times + // + //void MyStepRTB_Resize(object sender, EventArgs e) + //{ + // if (MyStepRTB.Visible) + // { + // //Volian.Base.Library.vlnStackTrace.ShowStack("MyStepRTB_Resize"); + // Console.WriteLine("MyStepRTB_Resize {0}", MyStepRTB.Width); + // } + //} void MyStepRTB_RoInsert(object sender, StepRTBRoEventArgs args) { if (MyFlexGrid.IsRoTable) diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs index 2a682cf5..a3a90826 100644 --- a/PROMS/Volian.Controls.Library/StepRTB.cs +++ b/PROMS/Volian.Controls.Library/StepRTB.cs @@ -1035,14 +1035,19 @@ namespace Volian.Controls.Library if (!_InitializingRTB) { Size offset = Size - ClientSize; - int widthNew = ContentsSize.Width + offset.Width + AdjustSize.Width ; + int widthNew = (this is TableCellEditor) ? Width : (ContentsSize.Width + offset.Width + AdjustSize.Width); + //int widthNew = Width; + //if (!(this is TableCellEditor)) + // widthNew = ContentsSize.Width + offset.Width + AdjustSize.Width; int heightNew = ContentsSize.Height + offset.Height + AdjustSize.Height; // Don't make the window narrower unless it has text - RHM - 20100107 Size szNew = new Size(((Text != "" && adjustWidth) ? widthNew : (widthNew > Width ? widthNew : Width)), heightNew); if (this.Size != szNew) { int heightOld = Height; + //Console.WriteLine("before {0}, {1}, {2}, {3}, {4}", Size, szNew, widthNew, Width, this.GetType().Name); this.Size = szNew; + //Console.WriteLine("after {0}, {1}, {2}, {3}", Size, szNew, widthNew, Width); if (heightOld != Height) OnHeightChanged(this, new EventArgs()); } diff --git a/PROMS/Volian.Controls.Library/VlnFlexGrid.cs b/PROMS/Volian.Controls.Library/VlnFlexGrid.cs index 0d81699e..6392c1ca 100644 --- a/PROMS/Volian.Controls.Library/VlnFlexGrid.cs +++ b/PROMS/Volian.Controls.Library/VlnFlexGrid.cs @@ -615,7 +615,9 @@ namespace Volian.Controls.Library // Console.WriteLine("r {0}, nh {1}, curh{2}", Row, nH, curHeight); if (Hadj != 0) { - Rows[Row].Height += Hadj;//= curHeight; + int newHeight = Hadj + ((Rows[Row].Height < 0) ? Rows.DefaultSize : Rows[Row].Height); + //Rows[Row].Height += Hadj;//= curHeight; + Rows[Row].Height = newHeight; AdjustGridControlSize(); } }