#endif
bool nowCaretMove = false;
bool nowCompstion = false;
+ bool requestSizeChange = false;
Document _Document;
DispatcherTimer timer = new DispatcherTimer();
- const int Interval = 96;
+ const int Interval = 32;
const int IntervalWhenLostFocus = 160;
/// <summary>
/// <summary>
/// 再描写する
/// </summary>
- public void Refresh()
+ public void Refresh(bool immidately=true)
{
- this.Refresh(this.View.PageBound);
+ if(immidately)
+ this.Refresh(this.View.PageBound);
+ else
+ this.Document.RequestRedraw();
}
/// <summary>
this.View.IsFocused = true;
this.timer.Interval = new TimeSpan(0, 0, 0, 0, Interval);
- this.Refresh();
+ this.Refresh(false);
}
private void TextServiceManager_InputLanguageChanged(CoreTextServicesManager sender, object args)
System.Diagnostics.Debug.WriteLine("lost focus");
this.View.IsFocused = false;
- this.Refresh(this.View.PageBound);
+ this.Refresh(false);
this.timer.Interval = new TimeSpan(0, 0, 0, 0, IntervalWhenLostFocus);
}
void FooTextBox_SizeChanged(object sender, SizeChangedEventArgs e)
{
- if (this.Resize(this.rectangle.ActualWidth, this.rectangle.ActualHeight))
- {
- //普通に再描写するとちらつく
- this.Refresh(this.View.PageBound);
- }
+ //LostFocusやGotFocusなどと競合するとDirect2Dでエラーが起きるので、timer_tickイベントでサイズ変更を行うことにした
+ this.requestSizeChange = true;
}
void horizontalScrollBar_Scroll(object sender, ScrollEventArgs e)
void timer_Tick(object sender, object e)
{
this.timer.Stop();
- if (this.View.LayoutLines.HilightAll() || this.View.LayoutLines.GenerateFolding() || this.Document.IsRequestRedraw)
+ if(this.requestSizeChange)
+ {
+ if (this.Resize(this.rectangle.ActualWidth, this.rectangle.ActualHeight))
+ {
+ //普通に再描写するとちらつく
+ this.Refresh(this.View.PageBound);
+ }
+ this.requestSizeChange = false;
+ }
+ else if (this.View.LayoutLines.HilightAll() || this.View.LayoutLines.GenerateFolding() || this.Document.IsRequestRedraw)
{
this.Refresh(this.View.PageBound);
}