bottomRightPos = bottomRightPos.Scale(scale);
#endif
#if WPF
- System.Windows.Point topLeftPos = this.textbox.GetPostionFromTextPoint(topLeft);
- System.Windows.Point bottomRightPos = this.textbox.GetPostionFromTextPoint(bottomRight);
+ Point topLeftPos = this.textbox.GetPostionFromTextPoint(topLeft);
+ Point bottomRightPos = this.textbox.GetPostionFromTextPoint(bottomRight);
topLeftPos = this.textbox.PointToScreen(topLeftPos);
bottomRightPos = this.textbox.PointToScreen(bottomRightPos);
#endif
width = 1;
Rectangle rect = new Rectangle(topLeftPos.X, topLeftPos.Y,
width,
- bottomRightPos.Y - topLeftPos.Y + layoutLineCollection.GetLayout(bottomRight.row).Height);
+ bottomRightPos.Y - topLeftPos.Y + layoutLineCollection.GetLineHeight(bottomRight));
#if METRO || WINDOWS_UWP
rectangles = new double[4]{
newCaret = ctrl.GetNextCaret(caret, count, MoveFlow.Word, out moved);
break;
case TextUnit.Line:
+ newCaret = ctrl.GetNextCaret(caret, count, MoveFlow.Line, out moved);
+ break;
case TextUnit.Paragraph:
newCaret = ctrl.GetNextCaret(caret, count, MoveFlow.Paragraph, out moved);
break;
{
for (int i = Math.Abs(count); i > 0; i--)
{
- caret = this.MoveCaretVertical(caret, count > 0);
+ caret = this.MoveCaretVertical(caret, count > 0, method == MoveFlow.Paragraph);
moved++;
}
}
/// </summary>
/// <param name="count">移動量</param>
/// <param name="current">現在のキャレット位置</param>
+ /// <param name="move_pargraph">パラグラフ単位で移動するなら真</param>
/// <returns>移動後のキャレット位置</returns>
- public TextPoint GetTextPointAfterMoveLine(int count, TextPoint current)
+ public TextPoint GetTextPointAfterMoveLine(int count, TextPoint current, bool move_pargraph = false)
{
- if(this.Document.LineBreak == LineBreakMethod.None)
+ if(this.Document.LineBreak == LineBreakMethod.None || move_pargraph == true)
{
int row = current.row + count;
/// キャレットを行方向に移動させる
/// </summary>
/// <param name="isMoveNext">プラス方向に移動するなら真</param>
+ /// <param name="move_pargraph">パラグラフ単位で移動するするなら真</param>
/// <remarks>このメソッドを呼び出した後でScrollToCaretメソッドとSelectWithMoveCaretメソッドを呼び出す必要があります</remarks>
- TextPoint MoveCaretVertical(TextPoint caret,bool isMoveNext)
+ TextPoint MoveCaretVertical(TextPoint caret,bool isMoveNext, bool move_pargraph = false)
{
if (this.Document.FireUpdateEvent == false)
throw new InvalidOperationException("");
- return this.GetTextPointAfterMoveLine(isMoveNext ? 1 : -1, this.Document.CaretPostion);
+ return this.GetTextPointAfterMoveLine(isMoveNext ? 1 : -1, this.Document.CaretPostion, move_pargraph);
}
private void ReplaceBeforeSelectionArea(SelectCollection Selections, int removeLength, string insertStr)
return this.Lines[row].Dirty;
}
+ /// <summary>
+ /// 行の高さを返す
+ /// </summary>
+ /// <param name="tp">テキストポイント</param>
+ /// <returns>テキストポイントで指定された行の高さを返します</returns>
+ public double GetLineHeight(TextPoint tp)
+ {
+ return this.render.emSize.Height;
+ }
+
internal ITextLayout GetLayout(int row)
{
if (this.Lines[row].Layout != null && this.Lines[row].Layout.Invaild)
{
if (this.Document.FireUpdateEvent == false)
throw new InvalidOperationException("");
- return this.View.GetPostionFromTextPoint(tp);
+ return this.image.TranslatePoint(this.View.GetPostionFromTextPoint(tp),this);
}
/// <summary>
{
if (this.Document.FireUpdateEvent == false)
throw new InvalidOperationException("");
+ System.Windows.Point relP = this.TranslatePoint(p, this.image);
return this.View.GetTextPointFromPostion(p);
}