Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Basic4ppc Wishlist
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Basic4ppc Wishlist Missing any feature?


Drawing on image control


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-15-2008, 08:08 PM
Senior Member
 
Join Date: May 2007
Posts: 188
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default Drawing on image control

Erel
All the drawing commands like circle, line are limited to drawing on forms.
It will be useful to have them work on controls.
Thanks.
David
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 01-15-2008 at 08:17 PM.
Reply With Quote
  #2 (permalink)  
Old 01-16-2008, 06:01 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,141
Default

You could draw on image controls (and ImageButtons) with the ImageLib library.
Draw on a bitmap and set the bitmap to be the control's image.
Reply With Quote
  #3 (permalink)  
Old 01-16-2008, 11:42 AM
Senior Member
 
Join Date: Jul 2007
Posts: 147
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Erel, I know I understand what your saying but I'm not sure I understand how to implement it. Could you post a tiny example. Thanks in advance for your help.

__________________
Using 6.30
dennishea
Reply With Quote
  #4 (permalink)  
Old 01-16-2008, 11:50 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,141
Default

Example is attached.
Attached Files
File Type: zip DrawOnImage.zip (4.0 KB, 79 views)
Reply With Quote
  #5 (permalink)  
Old 01-16-2008, 12:09 PM
Senior Member
 
Join Date: Jul 2007
Posts: 147
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Many Thanks Erel

__________________
Using 6.30
dennishea
Reply With Quote
  #6 (permalink)  
Old 01-16-2008, 12:39 PM
Senior Member
 
Join Date: May 2007
Posts: 188
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default drawing on control

Erel
I do it with the use of dzimage.dll :
I draw on another form and then copy the part I need to the image control.
I just thought it can save some time and code.

example:

north_arrow(15,37,-rtrack)
form6.Circle(15,37,12,Rgb(255,255,255),f)
form6.Polygon(alX,0,alY,0,4,cBlack,f)
compass.Image = img.CopyImage(form6.Image,3,25,25,25)
__________________
David Erez
Ramat Hasharon, Israel
Reply With Quote
  #7 (permalink)  
Old 01-16-2008, 01:10 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 674
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Hello Erel,
could the polygon function and the circle function, which exists for forms, also be added to the Drawer object so we have all the drawing functions in one object ?
Otherwise if I want to draw a filled ellipse I have to use the Drawer function and if I want to add a filled polygon I must do it on the form and then combine both images.

Best regards
Klaus
Switzerland
Reply With Quote
  #8 (permalink)  
Old 01-16-2008, 01:15 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,141
Default

FillEllipse / DrawEllipse are suitable for circles too (when the rectangle is also a square).
Polygon will be added to the drawer functionality.
Reply With Quote
  #9 (permalink)  
Old 01-16-2008, 03:53 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 674
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Thank's Erel
I know that the circle is a particular case of an ellipse.
But from the drawing point of view:
- the circle is defined by it's center coordinates and the radius
- the ellipse is defined by it's outer rectangle
So why not include both ?

Best regards
Klaus
Reply With Quote
  #10 (permalink)  
Old 01-16-2008, 04:24 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,141
Default

I see your point and will consider it.

Generally speaking in order to keep the language simple I prefer not to overload it with almost duplicated functions.
You can also achieve it with:
Code:
Sub DrawCircle(drawerObject,x,y,r,color,fill)
    rect.New1(x-r,y-r,2*r,2*r)
    If fill Then
        brush.Color = color
        Control(drawerObject,Drawer).FillEllipse(brush.Value,rect.Value)
    Else
        pen.Color = color
        Control(drawerObject,Drawer).DrawEllipse(pen.Value,rect.Value)
    End If
    Control(drawerObject,Drawer).Refresh2(rect.Value)
End Sub

Calling this sub:
DrawCircle ("drawer1",100,100,30,cRed,True)
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Drawing a Image bigger then the screen Georg Questions & Help Needed 16 06-06-2008 05:36 PM
draw line into image control giannimaione Questions & Help Needed 4 06-03-2008 05:40 PM
Control IMAGE Joserra Spanish Forum 5 11-14-2007 06:58 PM
Drawing parts of a large image. Erel Code Samples & Tips 0 06-07-2007 09:07 AM
Move an image inside an image control Cableguy Questions & Help Needed 5 05-14-2007 08:40 PM


All times are GMT. The time now is 05:21 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0