Jump to content
Software FX Community

Painting to dc


User (Legacy)
 Share

Recommended Posts

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

> 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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...