New topic: 

Canvas paint event behavior changed after upgrade to 2011r1

<http://forums.realsoftware.com/viewtopic.php?t=38223>

         Page 1 of 1
   [ 6 posts ]                 Previous topic | Next topic          Author  
Message        roychan          Post subject: Canvas paint event behavior 
changed after upgrade to 2011r1Posted: Sun Mar 20, 2011 5:07 am                 
                
Joined: Sun Aug 08, 2010 12:26 am
Posts: 12                Dear All,

I am using RB2010r4 before I upgrade to RB2011r1. I used canvas to create a new 
class which is a picturebutton. So I put the following code into the Paint 
event.

Code:  
 if PictureList.Ubound >-1  then
  if  pictureindex <=picturelist.ubound then
   'picturelist(pictureindex) which is a transparent PNG picture
  g.DrawPicture PictureList(PictureIndex), 0, 0
   
  if len(caption) >0 then
    g.TextFont=TextFont
    g.TextUnit=textunit
    g.TextSize=TextSize
    g.ForeColor=TextColor
    g.Bold=bold
    g.Underline=Underline
    g.Italic=Italic
    
    if texttop>0 then
    
    select case CaptionAlign
    case 0
    g.drawstring caption, 2, texttop
    case 1
    g.drawstring caption, g.width/2-g.stringwidth(caption)/2, TextTop
    case 2
    g.drawstring caption, g.width-g.stringwidth(caption), texttop
    end select
    
    else
    select case CaptionAlign
    case 0
    g.drawstring caption, 2, g.TextAscent
    case 1
    g.drawstring caption, g.width/2-g.stringwidth(caption)/2, g.TextAscent
    case 2
    g.drawstring caption, g.width-g.stringwidth(caption), g.TextAscent
    end select
    
    end if
    
  end if
  
  end if
  end if
  
  // call the original event handler for the instance ..
  paint g

After I upgrade realbasic to new verison, every time I press the picturebutton 
the text become bigger and ugly.
It looks like it used the new graphic as the new background. So every time I 
call the paint event to draw a transparent picture in the canvas.
The picutrebutton become more bigger and darker.

How can I solve this new release problem ?      
_________________
Roy Chan
iniSoft System Technology Limited
Lenovo ThinkPad SL410 4GB Ram, Windows XP SP3 RB2010R3  
                             Top                 jefftullin          Post 
subject: Re: Canvas paint event behavior changed after upgrade to 201Posted: 
Sun Mar 20, 2011 5:51 am                                 
Joined: Wed Nov 15, 2006 3:50 pm
Posts: 2206
Location: England                Your button picture is transparent, so it 
doesnt reset the whole area when it paints.
Maybe the letters draw a little lower every click?

In any event, this is probably sortable by clearing the drawing space before 
you start.
Code:g.forecolor = &cffffff
g.fillrect 0,0,g.width,g.height
g.DrawPicture PictureList(PictureIndex), 0, 0   
                             Top                roychan          Post subject: 
Re: Canvas paint event behavior changed after upgrade to 201Posted: Sun Mar 20, 
2011 6:37 am                                 
Joined: Sun Aug 08, 2010 12:26 am
Posts: 12                I have tried your solution. But It will clear the 
background of the picturebutton. I just want to draw the transparent picture 
over the original window background.
Because there is some special effect within the picturebutton edge.So I need to 
keep the original background. 


Thank you for your reply.      
_________________
Roy Chan
iniSoft System Technology Limited
Lenovo ThinkPad SL410 4GB Ram, Windows XP SP3 RB2010R3  
                             Top                 mjh          Post subject: Re: 
Canvas paint event behavior changed after upgrade to 201Posted: Sun Mar 20, 
2011 6:52 am                                 
Joined: Sun Feb 19, 2006 3:10 pm
Posts: 1151
Location: Hamburg, Germany                roychan wrote:I have tried your 
solution. But It will clear the background of the picturebutton. I just want to 
draw the transparent picture over the original window background.
You could paint the background picture in the Paint event (instead of erasing 
the background); you wouldn’t need to use the background property at all 
then.      
_________________
Michael J. Hußmann 
http://digicam-experts.de  
                             Top                roychan          Post subject: 
Re: Canvas paint event behavior changed after upgrade to 201Posted: Sun Mar 20, 
2011 7:04 am                                 
Joined: Sun Aug 08, 2010 12:26 am
Posts: 12                I tried the following code to paint the original 
background first and then paint the transparent picutre. But I got the same 
result.
Code:g.drawpicture 
self.Backdrop,0,0,g.width,g.Height,me.left,me.top,g.Width,g.Height
g.DrawPicture PictureList(PictureIndex), 0, 0
 

Thank you very much.      
_________________
Roy Chan
iniSoft System Technology Limited
Lenovo ThinkPad SL410 4GB Ram, Windows XP SP3 RB2010R3  
                             Top                 Jym          Post subject: Re: 
Canvas paint event behavior changed after upgrade to 201Posted: Sun Mar 20, 
2011 2:37 pm                         
Joined: Sat Oct 01, 2005 5:19 pm
Posts: 2304                What does g.TextSize equal when it's big and ugly?   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 6 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to