Problem with Border Thickness of DesktopRectangle

Hello,

I’m currently using Xojo mainly to create Windows programmes and am in the process of replacing some of my work-related database-driven VB.NET programmes with it (switching from Access to SQLite). As well as Xojo’s simplicity, it also suits us that we can create a macOS version for each programme, as we’re seeing more and more Mac laptops in our classes.

Unfortunately, I do get the impression that the Windows compiler is being somewhat neglected.

At the moment, I’m working on a problem with the Windows DesktopRectangle. I use this to group controls (no, the GroupBox is not an alternative!).

Unfortunately, the ‘Border’ property appears to be faulty. When I specify a border of 1 or 2 pixels, it appears differently on each of the four sides of the box.
I’ve also tried to solve this using a custom control with the DesktopCanvas. Unfortunately, the DesktopCanvas is very slow in the Paint method.
Does anyone have a solution to this problem?

Cheers

Boris

Hi Boris, do you have a little sample project showing the issue? And the canvas-paint should not be slow - far from it.

best, Thomas

long-standing issue between fill and draw for rounded rectangles

// DesktopCanvas CornerSize problem - OK

var mypen as double = 20
g.DrawingColor = color.green
g.FillRoundRectangle(0,0,canvas1.Width,canvas1.height,80,80)
g.PenSize = mypen
g.DrawingColor = color.black
g.drawRoundRectangle(0,0,canvas1.Width,canvas1.height,80-mypen,80-mypen)

This is a sample of the DesktopRectangle

I just tried it.

The frame appear onle when the windows is fully loaded.

That looks like a 3D depth effect?

Yes, but can I disable that?

Can you show your drawing code?

I use for the test the Code RudolfJ published above.

Have you reported it as a bug. Provide steps to reproduce and a small example that shows the problem.

https://tracker.xojo.com/xojoinc/xojo/-/work_items?sort=popularity&state=opened&first_page_size=20

May the right and bottom border got simply clipped? Did you try this?

// DesktopCanvas CornerSize problem - OK

var mypen as double = 20
g.DrawingColor = color.green
g.FillRoundRectangle(0,0,canvas1.Width-30,canvas1.height-30,80,80)
g.PenSize = mypen
g.DrawingColor = color.black
g.drawRoundRectangle(0,0,canvas1.Width-30,canvas1.height-30,80-mypen,80-mypen)

The picture I have posted is´the DesktopRectangle.

There is no way to paint the Border by yourself.

Of course, it’s possible to paint a border. You have code above.

Ther is no Paint Method in DesktopRectangle!

You can paint in a:

  • Window
  • Container
  • Canvas

even at the risk of repeating myself. Canvas is to slow!

Not for a simple rectangle. Or you are doing something seriously wrong.

What exactly do you mean with „Canvas to slow“?

Canvas is incredibly fast. If you skip ahead to 16 seconds in this video, this entire UI is one giant canvas. It’s handling audio waveforms, mouse clicks and drags, logical breaking up of track elements, animations and more all in a canvas. You’d probably be able to create a whole video game in a Canvas and get playable frame rates.

I’d highly encourage you to experiment more and see what is slowing down your code, because canvases are lightning fast when properly implemented.