Using DrawArea - Simplified

New to Gambas? Post your questions here. No question is too silly or too simple.
User avatar
BruceSteers
Posts: 1523
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Using DrawArea - Simplified

Post by BruceSteers »

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
If at first you don't succeed , try doing something differently.
BruceS
User avatar
Askjerry
Posts: 64
Joined: Saturday 18th August 2018 9:06pm
Location: Kyle, Texas, USA
Contact:

Re: Using DrawArea - Simplified

Post by Askjerry »

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: 262
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Using DrawArea - Simplified

Post by vuott »

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

Amare memorentes atque deflentes ad mortem silenter labimur.
User avatar
Askjerry
Posts: 64
Joined: Saturday 18th August 2018 9:06pm
Location: Kyle, Texas, USA
Contact:

Re: Using DrawArea - Simplified

Post by Askjerry »

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: 262
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Using DrawArea - Simplified

Post by vuott »

Do you mean that, if you use Class Paint directly with PictureBox, you get errors?
Europaeus sum !

Amare memorentes atque deflentes ad mortem silenter labimur.
User avatar
Askjerry
Posts: 64
Joined: Saturday 18th August 2018 9:06pm
Location: Kyle, Texas, USA
Contact:

Re: Using DrawArea - Simplified

Post by Askjerry »

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: 262
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Using DrawArea - Simplified

Post by vuott »

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.
Europaeus sum !

Amare memorentes atque deflentes ad mortem silenter labimur.
User avatar
Askjerry
Posts: 64
Joined: Saturday 18th August 2018 9:06pm
Location: Kyle, Texas, USA
Contact:

Re: Using DrawArea - Simplified

Post by Askjerry »

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

Thanks,
Jerry
User avatar
BruceSteers
Posts: 1523
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Using DrawArea - Simplified

Post by BruceSteers »

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


If at first you don't succeed , try doing something differently.
BruceS
User avatar
Askjerry
Posts: 64
Joined: Saturday 18th August 2018 9:06pm
Location: Kyle, Texas, USA
Contact:

Re: Using DrawArea - Simplified

Post by Askjerry »

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