This is mnoGoSearch's cache of https://lists.gambas-basic.org/pipermail/user/2012-November/042303.html. It is a snapshot of the page as it appeared during last crawling. The current page could have changed in the meantime.

Last modified: Fri, 30 Nov 2012, 16:17:02 CET    Size: 4835
[Gambas-user] Problem clearing picture in a PictureBox

[Gambas-user] Problem clearing picture in a PictureBox

Willy Raets willy at ...2734...
Fri Nov 30 16:17:02 CET 2012


On Fri, 2012-11-30 at 16:06 +0100, Benoît Minisini wrote:
> Le 30/11/2012 16:04, Willy Raets a écrit :
> > Hi,
> >
> > I've this form with a Panel and in there some TextBoxes, PictureBoxes
> > and some Buttons.
> > Button opens a Dialog to browse for PNG files and when selected show use
> > the Dialog.Path to load the PNG into PictureBox (using PicBox.Picture =
> > Picture.Load(Dialog.Path))
> >
> > At a certain moment I want to clear the form and have this little
> > rountine:
> >
> > Public Sub PanelClear()
> >
> >     TextBox1.Clear
> >     TextBox2.Clear
> >     PictureBox1.Picture.Clear
> >     PictureBox2.Picture.Clear
> >     Me.Refresh
> >
> > End
> >
> > TextBoxes clear properly, but PictureBoxes don't.
> > The loaded PNG stays visible in the PictureBox.
> >
> > If one of the PictureBoxes has no loaded picture in there on clearing an
> > error is generated because of it being Null.
> >
> > 1. How do I get the PictureBoxes cleared of the shown picture?
> > Am I using Clear wrongly? Also tried PictureBox1.Picture.Flush with no
> > success.
> >
> > 2. How test for a empty PictureBox?
> > I tried testing with IsNull(PictureBox.Picture), but that doesn't seem
> > to do the job.
> >
> > Any suggestions that might get me on the road again?
> >
> > Running Gambas 3.3.4 on Linux Mint 13 - Mate desktop
> > Using gb.qt4 in the project.
> >
> > Willy
> >
> 
> PictureBox1.Picture = Null
> 
> PictureBox1.Picture.Clear only clears the contents of the picture 
> returned by the property, which is somewhat a copy of the internal 
> picture of the PictureBox which stays unchanged.

Simple and effective :)
Works as a charm.

Thank you,

Willy






More information about the User mailing list