|
Rounding frame directive conflicts with windows background fills |
Posted by DC Kelley on Mar-25-2011 01:16 |
|
What other controls in the VS Net C++ environment can effect the way the corner rounding in CD works (or how it fills)? I have a very simple chart, based off the hello world example, where I have enabled corner rounding. That part works fine but I do not seem to be able to obtain a transparent background and I think some other setting in VS may be in conflict (see below image)
The key code is simply:
XYChart *c = new XYChart(chartWidth, chartHeight, 0xeeeeff, Chart::Transparent, 0);
c->setRoundedFrame(0xffffff, 130,-1,-1,-1);
(the huge rounding is to emphasize the issue, the height and width are calculated from the controls current size each time the chart is drawn and the window can be re-sized)
In the properties of the IPictEditor control I see nothing of note. False values for client edge, static edge, sunken, and transparent. I do have 'real size image' set true as I want to stop the 1st redraw when I re-size the window.
For the short term I could fake a solution by setting the background to match the windows default 'grey' but this would be a brittle solution as the next user may have set some odd preference on me.
And it does not occur on the shipped MFC examples, and those control properties seem similar.
Seen this before?
|
Re: Rounding frame directive conflicts with windows background fills |
Posted by Peter Kwan on Mar-25-2011 14:12 |
|
Hi DC Kelley,
Hi hanhan,
In all standard MFC controls, "Transparent" usually means to paint using the same color as the Form or Dialog background.
So for your case, you may just use the Form or Dialog background color in the part of the chart you want to be "Transparent". For the rounded corners outside the chart, you can use setRoundedFrame to set its color.
For your reference, in several of the ChartDirector sample code, there is a short utility that gets the background color of the Form or Dialog. For example, in the Realtime Chart sample code, there is a utility as follows to get the background color of the dialog:
//
// Get the default background color
//
int CRealtimedemoDlg::getDefaultBgColor()
{
LOGBRUSH LogBrush;
HBRUSH hBrush = (HBRUSH)SendMessage(WM_CTLCOLORDLG, (WPARAM)CClientDC(this).m_hDC,
(LPARAM)m_hWnd);
::GetObject(hBrush, sizeof(LOGBRUSH), &LogBrush);
int ret = LogBrush.lbColor;
return ((ret & 0xff) << 16) | (ret & 0xff00) | ((ret & 0xff0000) >> 16);
}
You can then use this background color as the color of the rounded corners:
c->setRoundedFrame(getDefaultBgColor());
Hope this can help.
Regards
Peter Kwan |
Re: Rounding frame directive conflicts with windows background fills |
Posted by DC Kelley on Mar-26-2011 02:51 |
|
Works great, thanks you so very much. And thank you from refraining from reminding me this was a pure VS issue, not a CD one. |
|