User (Legacy) Posted April 8, 2003 Report Share Posted April 8, 2003 Hi, I'm using ChartFX in MS Access XP and am having two problems using the Paint method. I'm trying to paint the chart to a dc in memory which I can then use a background and paint a selection marque over the top. The first problem is that when blting the chart on to the form, it appears to shrink slightly. The second problem is that the axis and point labels produced by muPointLabel and AxisLabel events are ignored and the chart appears with a default set of labels. Any ideas, anyone. Regards, James Sample code creating the dc: Private Function MakeMemDcForChart(Chart As Object) As Long Dim hMemDc As Long Dim hMemBm As Long Dim hChartDc As Long Dim hCbBm As Long Dim rc As RECT ' get the chart dc hChartDc = GetDC(Chart.hWnd) GetClientRect Chart.hWnd, rc ' create and initialise a compatible dc and bm hMemDc = CreateCompatibleDC(hChartDc) hMemBm = CreateCompatibleBitmap(hChartDc, _ rc.Right - rc.Left, _ rc.Bottom - rc.Top) SetBkMode hMemDc, TRANSPARENT SelectObject hMemDc, hMemBm Chart.Paint hMemDc, 0, 0, rc.Right, rc.Bottom, CPAINT_BKGND, 0 ReleaseDC Chart.hWnd, hChartDc ' return the memory dc MakeMemDcForChart = hMemDc End Sub Link to comment Share on other sites More sharing options...
Software FX Posted April 8, 2003 Report Share Posted April 8, 2003 > The first problem is that when blting the chart on to the form, it appears > to shrink slightly The Paint method receives the coordinates in which the chart is to be drawn, maybe this coordinates where calculated to be too small ? > The second problem is that the axis and point labels produced by > muPointLabel and AxisLabel events are ignored and the chart appears with a > default set of labels. I believe events are disabled in Access while you are in the middle of a code execution, I don;t think you will be able to have the Paint method fire any event as by the time you call it, events are disabled. I'm not 100% sure about this but this is what I've experienced, I've never found documentation that either proves me wrong or proves me right but the fact is that the events, even though they are fired by the component, never reach your code. This also happen when creating Reports. -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.