Solved

Drill down Reports. Using controls or drawing strings

Posted on 2009-05-05
7
275 Views
Last Modified: 2012-05-06
I have several Window Forms that display economical reports in my application. Due to the lack of speed of adding controls when the form is created, I draw the report values in the pain event in the forms.

Now, I'd like to add a drill down function and wonder what's the best way to go about. The reports normally displayes about 20 rows in 12 columns, (sometimes up to 36 columns though), so there are quite a few values.

Is there a way to add controls to a form in a quicker way?

If this is not possible, I guess I have to make my own table of positions to determine where the mouse is and to change the cursor when it is over a drawn string. The easiest way I can think of is to have an array(formposX,formposY) containing null or drilldownvalue depending on the strings. Anyone have a better solution?

Thanks in advance

Tomas
0
Comment
Question by:ekenman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 24310903
What reporting tool?

mlmcc
0
 

Author Comment

by:ekenman
ID: 24311951
No reporting tool, just Winform
/Tomas
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24312164
Are you just painting some labels on the form? Paint event is not the best place to do so. Can you show us some code? Is using Crystal Reports a viable option for you? These come free with .NET
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

Author Comment

by:ekenman
ID: 24323672
CodeCruiser, I'm just painting text, no labels since it is to slow to add controls. When the user change an option in the report, there might be more fields to display, so Crystal will not do it for me.

Below is some of the code from the paint event. I also paint rectangles and headers, but it's done in the same manner.

Reportarray holds the values from my sql-data. Canvas is the forms painteventargs.

Best Regards

Tomas

            For Each item As Reportvalue In ReportArray
                If Not item Is Nothing Then
                    If item.Type <> ReportFieldType.CRLF Then
                        Dim temploc As Point
                        temploc.X = item.Location.X - hscrollpos - ColRightMargin
                        temploc.Y = item.Location.Y - vscrollpos
                        canvas.DrawString(item.Text, item.Font, Brushes.Black, temploc, format1)
                        temploc.X = item.Location.X - vscrollpos
 
                        If item.Type = ReportFieldType.CalculatedValue And item.Location.X = 342 Then
                            'Add a line
                            canvas.DrawLine(Pens.Black, 15 - hscrollpos, item.Location.Y - 2 - vscrollpos, (Reportperiods) * ColDistance + HeaderLeftMargin + HeaderWidth - 1 - hscrollpos, item.Location.Y - 2 - vscrollpos)
                        End If
                    End If
                End If
            Next

Open in new window

0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 24323753
Then the way to implement drilldown is to store the bounds of each text in a collection and on mouse move event, you would be matching the current x, y with stored bounds and if it happens to be within the bounds of a drill down enabled field then change the cursor to hand. Same would go for mouse click event.
0
 

Author Comment

by:ekenman
ID: 24324738
So what kind of object would I use for the collection? Should I make my own object containing x,y, width and height and how do I compare it? Is there an object width a withinbounds method?
/Tomas
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 24325048
You would use a collection of rectangles. So lets say a text is occupying x1 = 10, y1 = 10, x2 = 20, y2 = 80
So you would put a condition like this

If (x>x1 and x<x2) and (y>y1 and y<y2) then
'within bounds.
end if
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question