Corner radius does not cover the filled background

The next funny display I can not get around?

If I create a rectangle with a rounded border the borders external radius differs from the rectangles radius so I get some “ears” around the rectangle. Easy to reproduce and visible also in the IDE.

Once again my question: Did I do anything wrong or stange? I regard effects like that as not normal. I can see the border has the given “thickness” everywhere - and may be it would look strange if it would stick to the outside border of the rectangle. It works only with 1 or two pixel borders - more or less by accident.

So what can I do to get a “correct” display with more than 2 pixel border - except playing painterman? Is there any other entry in this forum or any feedback already (did not find) … ?

Thanks again!

How does the code look like?

No code. Just IDE :face_with_hand_over_mouth:

Gavin: Not Mac-OS only, it is the same with Windows and Linux. May be you should move it back?

Is it so hard to give some steps to reproduce:

  • Give the window a darker background color.
  • Add a round rectangle to the window.
  • Set the corner size to 40 and the border thickness to 10.

Yikes, that looks odd. This is a bug.

The canvas is better:

But there is another bug because I had to adjust the y offset:

g.PenSize = 10
g.DrawRoundRectangle(0, 5, g.Width, g.Height - 10, 40, 40)

This is what I meant with painterman :paintbrush:. Of course it is possible to get it “somehow” looking reasonable. Problem here is that those items are moving with drag and drop and I would have to paint all items of that control.

Isn’t there a way to get that with the on-board stuff? Again - what would a beginner think here?

Thanks Beatrix - and sorry for not being enough helpful here :face_with_diagonal_mouth:

Right now you have to use a canvas and draw everything yourself. Did you do a Feedback case? I’ll also need to do a Feedback for the issue I found.

I did 2 Feedback cases for the problems I found.

Super, Danke :wink:

That saves me the time to do that, thanks! :grinning: Would you please be so kind to share the feedback-numbers, so I can participate and vote?

<https://xojo.com/issue/67497>: Y Offset require when drawing round rectangle
<https://xojo.com/issue/67496>: White gaps when drawing rectangle

Interestingly, someone shared a tweet about properly drawing this quite recently.

1 Like

image

z is the outer radius
x is the inner radius
y = z - x
x = z - y

**I would recommend sticking to using your own Canvas based rounded-rectangle. In all honesty - there is no “native control” for rectangle…

On Windows, using Windows APIs to create controls - one would use the CreateWindowEX system API to create any control (on windows - ironically, all controls are actually windows within windows, having unique classes associated with them (can even be custom controls)). Anyway - the underlying Xojo Rectangle control is in essence just a canvas, doing the DrawRoundRectangle function for you… replacing rectangle with a canvas based rounded rectangle should yield the same desired outcome, without needing any bugs fixed. Honestly - the rectangle control should have be removed long ago (if it wasn’t for backward compatibility :-()

It’s like throwing in a free box of mediocre cookies to a bakery that makes cookies with every bag of flour purchased… just give us the ingredients, and we’ll make the cookies thanks! :slight_smile:

This is not the fun area, is it? :crazy_face:

  • I buy a development system
  • I use the integrated IDE
  • It offers a rounded rectangle
  • I use the rectangle
  • It gives strange results
  • I write a forum entry
  • I see others know about it
  • I get the advice NOT to use it

Seriously - I could use C++ or Java to stitch me a rounded rectangle. But I do not want to. I want to work with Xojo. Xojo offers something which obviously does not work because they use a formula for the border which is a bit strange. Correct formla above thanks to Rick and Tim. Feedback case opened thanks to Beatrix. Now I will wait and use 2-point borders first. The fat ones later, may be.

The reason why I’ve choosen Xojo is because I want to concentrate on the most important issues of our app and not care about UI or interoperability. And I believe that I will be finally right with this approach.

Cheers! :tumbler_glass:

3 Likes

Sigh… you do what you have to do to get the software running.

The most stupid bugs I had where I had to replace something:

  • §$%& dates crashed. Got Christian to make me some function. 100€ and finished. Nobody else had a problem line mine.

  • Can’t get more simple than labels. One is like 4 levels of containers. §$%& thing was supposed to have red color. No dice.

  • Labels again: a group of them was supposed to be size adjustable. They would not do that. After a couple of hours I gave up and made labels from canvases. 10 minutes and the problem was solved.

See attached Demo -

**The example re-usable custom control can completely replace any existing rectangle controls in an application, just change the super to "XDSRectangle. The properties are the same and may be altered in the property inspector just as with the standard Rectangle Control.

In the example paint event, I included the method that Xojo is using under the hood (at least it renders the exact same output as the current rectangle control issues and all)… Below the commented out Xojo painting method is a work-around for the issue to draw the rectangle “as expected.” :slight_smile:
rect

2 Likes

Wow, very nice, thank you very much! :vulcan_salute:

Isn’t it easy for Xojo to replace their code with yours? I will put that into the feedback case and we will see.

I am sorry about your frustration, though I understand you very deeply. I have had very similar problems with Visual Studio, WinDev and Clarion. All the same. You never will get the perfect situation if you rely on others. The only decision you have to make is: Is this tool suitable for just this project I am working on?

We will see. :thinking: