Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Drawing in Resource view problem (Read 3258 times)
AaronTobiason
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 10
Joined: Jul 8th, 2014
Drawing in Resource view problem
Aug 29th, 2014 at 8:33pm
Print Post  
I am using customdrawevents to draw the resource. This works initially, but when I click on the scrollbar, the resource text moves up into the time line field. I am using the following code:

Code (Java)
Select All
        public void draw(DrawEvent e)
        {
          try
          {
            Brush brush;
            if (e.getElement() == CustomDrawElements.ResourceViewRowHeader)
            {
              Pen pen = new Pen(Colors.Black);
              Rectangle bounds = new Rectangle(e.getBounds().getX(), e.getBounds().getY(),
              e.getBounds().getWidth() - 1, e.getBounds().getHeight() - 1);
              e.getGraphics().drawRectangle(pen, bounds);

              String T_Text = this.getText(e);
              Color Clr = Colors.Black;
              Color BClr = Colors.White;
              bounds = new Rectangle(bounds.getX() + 1, bounds.getY() + 1,
              bounds.getWidth() - 1, bounds.getHeight() - 1);
              brush = new SolidBrush(BClr);
              e.getGraphics().fillRectangle(brush,  bounds);
              brush = new SolidBrush(Clr);
              e.getGraphics().drawString(T_Text, new Font("Verdana", 7.5, FontStyles.Bold), brush, new PointD(0, 0));
              brush.dispose();
              pen.dispose();
 



When I click on the scroll bar the planner displays:


  

RV1.png (Attachment deleted)
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Drawing in Resource view problem
Reply #1 - Sep 1st, 2014 at 8:24am
Print Post  
Hi,

Try substituting the (0, 0) point in the drawString call with the actual top-left corner of the bounding rectangle: new PointD(bounds.getX(), bounds.getY()).

Regards,
Meppy
  
Back to top
 
IP Logged
 
AaronTobiason
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 10
Joined: Jul 8th, 2014
Re: Drawing in Resource view problem
Reply #2 - Sep 2nd, 2014 at 4:17pm
Print Post  
Thanks Meppy, that worked.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint