[Gambas-user] Which container to use for Draw Image?

Алексей Беспалов bespalov.av at ...626...
Wed Jan 18 16:32:34 CET 2012


Thank you, this is what I need. I will try.

18 января 2012 г. 22:18 пользователь tobias <tobiasboe1 at ...20...> написал:

> Алексей Беспалов schrieb:
> > Thank you, tobias!
> > But I do not quite understand what you mean.
> > Could give an example of code?
> >
> > 18 января 2012 г. 21:58 пользователь tobias <tobiasboe1 at ...20...> написал:
> >
> >> Алексей Беспалов schrieb:
> >>> Hi!
> >>> Please help me.
> >>>
> >>>
> >>> Which container to use for Draw Image?
> >>> So you can determine which of Image Clicked.
> >>>
> >>> I used to DrawArea at HPanel. But I do not know how to identify the
> >> object in
> >>> the event DrawArea Click ().
> >>>
> >>> This is part my code:
> >>>
> >>> --------------------------------------------------
> >>> Public Sub DrawImages(mhImage As Image[], Parent As Container, SizeArea
> >> As
> >>> Integer)
> >>> Dim hImage As Image
> >>> Dim hArea As DrawingArea
> >>>
> >>> MVars.mAreas.Clear()
> >>> Parent.Children.Clear()
> >>>
> >>>   For Each hImage In mhImage
> >>>     hArea = New DrawingArea(Parent)
> >>>     Object.Attach(hArea, FMain, "hArea")
> >>>     MVars.mAreas.Add(hArea)
> >>>
> >>>     hArea.Cached = True
> >>>     hArea.Border = 2
> >>>
> >>>     DrawImage(hImage, hArea, SizeArea) 'Draw Image on hArea
> >>>     Next
> >>> End
> >>> ----------------------------------------------------
> >>>
> >>> In FMain code:
> >>>
> >>> ----------------------------------------------------
> >>> Public Sub hArea_DblClick()
> >>>     Message.Info("!!!")
> >>> End
> >>> ----------------------------------------------------
> >>> It is work. But can i determine which of Image i Clicked??
> >>>
> >> since you create multiple DrawingAreas with the same event name, so all
> >> objects individually will raise the hArea_DblClick event.
> >> but there is one trick: the object that raised a particular event can be
> >> referred to from within the event handler by using the Last object.
> >> consequently Last will be a reference to the particular DrawingArea
> >> dblclicked.
> >>
> >>
>
> i think source code was originally invented to break the language barrier
> ;)
>
> Public Sub hArea_DblClick()
>   Print Last.Cached
> End
>
> this will print out the value of the particular DrawingArea.Cached
> property. (sry, nothing useful came into my mind with the DrawingArea
> class...). see gambasdoc.org/help/lang/last?v3 for details.
>
>
> ------------------------------------------------------------------------------
> Keep Your Developer Skills Current with LearnDevNow!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-d2d
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



-- 
____
С уважением Алексей.



More information about the User mailing list