Using DrawArea - Simplified

New to Gambas? Post your questions here. No question is too silly or too simple.
BruceSteers
Posts: 842
Joined: Thursday 23rd July 2020 5:20pm

Re: Using DrawArea - Simplified

Post by BruceSteers » Tuesday 12th July 2022 7:24pm

seany wrote:
Tuesday 12th July 2022 1:48pm
Hi

PS: Is there a web repo of all available controls, made by community? Thank you
We have been discussing on the gambas mailing list about expanding the Farm to include modules/classes/components/controls/etc as well as whole gambas applications (Benoit included).

Benoit has a million things to do though so it may take a while but something is happening towards gambas having it's own list of community based custom things :)

This forum has a Component Showcase section but there is currently not a lot on it: viewforum.php?f=17

Online
User avatar
Askjerry
Posts: 56
Joined: Saturday 18th August 2018 9:06pm
Location: Kyle, Texas, USA
Contact:

Re: Using DrawArea - Simplified

Post by Askjerry » Wednesday 13th July 2022 5:24am

Feel free to use anything I have created... I'm still learning.

If you know someone who has figured out the ADS1115 chip in Gambas... that would be incredibly helpful :-)

If you need me to zip up some files I can do that too.

Jerry

vuott
Posts: 120
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Using DrawArea - Simplified

Post by vuott » Wednesday 13th July 2022 6:17am

seany wrote:
Tuesday 12th July 2022 1:48pm
Is there a web repo of all available controls, made by community?
I suggest you also search the currently existing international forums of Gambas programmers.
I am a European.

Amare memorentes atque deflentes ad mortem silenter labimur.

Online
User avatar
Askjerry
Posts: 56
Joined: Saturday 18th August 2018 9:06pm
Location: Kyle, Texas, USA
Contact:

Re: Using DrawArea - Simplified

Post by Askjerry » Saturday 23rd July 2022 2:44am

When I read through the documentation, it said the PAINT functions could be used in a DRAWINGAREA and/or the following..
  • Picture
  • Image
  • DrawingArea
  • Printer
  • SvgImage

DRAWINGAREA works great... I make a PICTUREBOX and load in the SVG image... then I create a DRAWINGAREA and place it over the PICTUREBOX... think a sheet of glass laid on top of an image... then I can draw on it. But if I just create a PICTUREBOX and try to PAINT directly on it... I get errors.

Any ideas?

I mean for now... I'll keep dropping a DRAWINGAREA over the PICTUREBOX(s). I could have an array of them, with a single DRAWINGAREA over them all... then just adjust my math to draw where I like. I was just curious if someone got code working to do it without two separate layers.

vuott
Posts: 120
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Using DrawArea - Simplified

Post by vuott » Saturday 23rd July 2022 5:09pm

Do you mean that, if you use Class Paint directly with PictureBox, you get errors?
I am a European.

Amare memorentes atque deflentes ad mortem silenter labimur.

Online
User avatar
Askjerry
Posts: 56
Joined: Saturday 18th August 2018 9:06pm
Location: Kyle, Texas, USA
Contact:

Re: Using DrawArea - Simplified

Post by Askjerry » Saturday 23rd July 2022 6:46pm

If I create a DRAWINGAREA and paste some code on it... it works.

If I create a PICTUREBOX, then paste the exact same code... fails.

vuott
Posts: 120
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Using DrawArea - Simplified

Post by vuott » Saturday 23rd July 2022 7:29pm

I don't know if I have understood correctly; however, as you yourself reported (viewtopic.php?p=5889#p5889), it is not possible to use the Paint Class directly with a PictureBox.
So, you will need to use Paint with an Object of type "Image" or "Picture" (by using Paint.Begin() Method), and then load this Object into the PictureBox.
I am a European.

Amare memorentes atque deflentes ad mortem silenter labimur.

Online
User avatar
Askjerry
Posts: 56
Joined: Saturday 18th August 2018 9:06pm
Location: Kyle, Texas, USA
Contact:

Re: Using DrawArea - Simplified

Post by Askjerry » Saturday 23rd July 2022 9:21pm

Ok, I'll stick with DRAWINGAREA... it works and doesn't take much effort to drop in as an overlay.

Thanks,
Jerry

BruceSteers
Posts: 842
Joined: Thursday 23rd July 2020 5:20pm

Re: Using DrawArea - Simplified

Post by BruceSteers » Sunday 24th July 2022 9:39am

PictureBox is just not in the list of things Paint can operate on but the Picture it contains IS paintable so you must work on the picture not the PictureBox then set the PictureBox.Picture to your edit.

This will operate on a PictureBox.

it loads huge/color icon then superimposes the gambas icon on it.
then makes it the picturebox picture

Public pPic As Picture

Public Sub Button1_Click()

  pPic = Picture["icon:/huge/color"]

  Paint.Begin(pPic)
    Dim p As Picture = Picture["icon:/small/gambas"]
    Paint.DrawPicture(p, 10, 10, p.W, p.H)
  Paint.End

PictureBox1.Picture = pPic

End



Online
User avatar
Askjerry
Posts: 56
Joined: Saturday 18th August 2018 9:06pm
Location: Kyle, Texas, USA
Contact:

Re: Using DrawArea - Simplified

Post by Askjerry » Sunday 24th July 2022 2:16pm

BruceSteers... I'll tinker with this.
Thank you!

Post Reply