43422

Top-Left box alignment on a multi-line CheckBox with a large font

Working on a WinForms .Net 2.0 project, I need a checkbox to support multiple lines such that the box itself will be aligned to the top-left corner. This is done using CheckAlign = System.Drawing.ContentAlignment.TopLeft, which different from the default (MiddleLeft).

When working with the default font this looks OK, but when the font becomes larger - what happens is that the gap above the text increases, yet the gap above the box itself remains constant. The result is that the box appears above the text (see illustration below).

Any ideas?

I'd like to note that:

<ol> <li>I already tried a few option, such as using a custom designer, a TableLayoutPanel, etc., but didn't get far.</li> <li>.Net 2.0 is forced - upgrading is not an option.</li> </ol>

Thanks in advance.

<img src="https://i.stack.imgur.com/uSG2c.png" alt="CheckBox Issues">

Answer1:

The checkbox is actually aligned to the text. But in a way that could only please a typographer. It is just that a large font has more ascender height, the space where the diacritics go. Try "Ĥere's the problem". That's not something you can tinker. CheckedListBox also doesn't support owner draw, it is in general a pretty flawed control. If you don't want to use an ownerdraw ListBox then MiddleLeft or smaller fonts are the only decent options.

<img src="https://i.stack.imgur.com/8f26d.png" alt="enter image description here">

Recommend

  • How can I make the text of checkbox wraps automatically with changing form width?
  • How to display images or information from database with a for looped radiobutton? in c#
  • Gecko - CSS layout border radius - Javascript conversion
  • Dragging image from one layout to another layout - android
  • How to show created ToolTipControl from ToolTip Component?
  • Putting incomplete nested lists in a rectangular ndarray
  • Apple Reachability Notifications for Network OR Wi-Fi
  • Handle Authentication and Authorization in jax-rs webservice with cxf
  • Will cin recognize \\n typed in from keyboard as a newline character?
  • cast stl::vector containing pointers to stl::vector containing constant pointers
  • Touch events over two dom elements?
  • limited threads in soapUI free version
  • Pass nested C++ vector as built-in style multi-dimensional array
  • Use allowDiskUse in criteria query with Grails and the MongoDB plugin?
  • How to write string.Contains(someText) in expression Tree
  • What do I do with this error when I run tests in rails?
  • Custom Nav Title offset ios 11
  • c# winform DrawToBitmap offscreen
  • NUnit 3.0 TestCase const custom object arguments
  • Android Activity.onWindowFocusChanged doesn't get called from within TabHost
  • Zoom in and out of jPanel
  • Graphics.CopyFromScreen [Web application] + The handle is invalid
  • Debug.DrawLine not showing in the GameView
  • Time complexity of a program which involves multiple variables
  • Highlight and Bold text in JTextPane
  • Paperclip, set path outside of rails root folder
  • Xamarin Forms - UWP Fonts
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • Spray.io: When (not) to use non-blocking route handling?
  • Modifying destination and filename of gulp-svg-sprite
  • How to apply VCL Styles to DLL-based forms in Inno Setup?
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • Change an a tag attribute in JavaScript based on screen width
  • GridView Sorting works once only
  • R: gsub and capture
  • Unanticipated behavior
  • Matrix multiplication with MKL
  • Hits per day in Google Big Query
  • File not found error Google Drive API
  • Converting MP3 duration time