Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[System.Windows.Forms] Label issues #13384

@gthzrsfk

Description

@gthzrsfk

Steps to Reproduce

using System;
using System.Windows.Forms;
using System.Drawing;

class Form1 : Form {
    static void Main() {
        Application.Run(new Form1());
    }
    public Form1() {
        var label1 = new Label {
            Parent = this,
            Height = 10,
            BorderStyle = BorderStyle.FixedSingle,
            Text = "a",
        };
        var label2 = new Label {
            MinimumSize = new Size(2, 2),
            Text = "a",
        };
        var label3 = new Label {
            Text = "a",
        };
        Console.WriteLine(label2.PreferredSize);
        Console.WriteLine(label3.PreferredSize);
    }
}

Current Behavior

  • If the height is too short and with BorderStyle.FixedSingle or Fixed3D, the text will not be drawn.
    img

  • If the MinimumSize is set, the PreferredSize returns incorrect value.

output:

{Width=5, Height=24}
{Width=9, Height=14}

Expected Behavior

The text should be drawn partially.
PreferredSize should return the correct value.

On which platforms did you notice this

[ ] macOS
[x] Linux
[ ] Windows

Version Used:

Mono JIT compiler version 5.18.0.268 (tarball Thu Feb 28 15:29:06 UTC 2019)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: yes(600)
Suspend: preemptive
GC: sgen (concurrent by default)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions