diff --git a/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml b/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml index 984b0e4b..90d94685 100644 --- a/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml +++ b/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml @@ -17,10 +17,11 @@ x:Name="txtContent" Grid.Row="1" Width="300" + MaxHeight="100" Margin="{StaticResource MarginTb8}" VerticalAlignment="Center" IsReadOnly="True" - MaxLines="1" /> + TextWrapping="WrapWithOverflow" /> diff --git a/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml.cs index 64cdced5..8eec2726 100644 --- a/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml.cs @@ -1,5 +1,6 @@ using Avalonia.Controls; using Avalonia.Media.Imaging; +using Avalonia.Threading; namespace v2rayN.Desktop.Views { @@ -17,7 +18,7 @@ namespace v2rayN.Desktop.Views txtContent.Text = url; imgQrcode.Source = GetQRCode(url); - // btnCancel.Click += (s, e) => this.Close(); + txtContent.GotFocus += (_, _) => Dispatcher.UIThread.Post(() => { txtContent.SelectAll(); }); } private Bitmap? GetQRCode(string? url) @@ -29,7 +30,9 @@ namespace v2rayN.Desktop.Views private Bitmap? ByteToBitmap(byte[]? bytes) { if (bytes is null) + { return null; + } using var ms = new MemoryStream(bytes); return new Bitmap(ms);