From 8898aee6c70bde922ee5de2a6213a44798525a16 Mon Sep 17 00:00:00 2001 From: crupest Date: Wed, 5 Dec 2018 16:37:58 +0800 Subject: ... --- src/ui/controls/text_control.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/ui/controls/text_control.cpp') diff --git a/src/ui/controls/text_control.cpp b/src/ui/controls/text_control.cpp index 9a799916..6412eec9 100644 --- a/src/ui/controls/text_control.cpp +++ b/src/ui/controls/text_control.cpp @@ -56,14 +56,6 @@ namespace cru::ui::controls SetClipContent(true); - size_changed_event.AddHandler([this](events::SizeChangedEventArgs& args) - { - const auto content = GetRect(RectRange::Content); - ThrowIfFailed(text_layout_->SetMaxWidth(content.width)); - ThrowIfFailed(text_layout_->SetMaxHeight(content.height)); - InvalidateDraw(); - }); - draw_content_event.AddHandler([this](events::DrawEventArgs& args) { const auto device_context = args.GetDeviceContext(); @@ -196,6 +188,13 @@ namespace cru::ui::controls } + void TextControl::OnRectChange(const Rect& old_rect, const Rect& new_rect) + { + const auto content = GetRect(RectRange::Content); + ThrowIfFailed(text_layout_->SetMaxWidth(content.width)); + ThrowIfFailed(text_layout_->SetMaxHeight(content.height)); + } + void TextControl::OnTextChangedCore(const String& old_text, const String& new_text) { RecreateTextLayout(); -- cgit v1.2.3