Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Chart not displaying correctly on laptop. 1

Status
Not open for further replies.

Bryan - Gendev

Programmer
Jan 9, 2011
408
AU
I have a simple chart using mscomctl.OCX in my app. This works perfectly on my Dev PC.
However, when installed on my laptop I get a 'distorted' image where the components are 'bunched up' vertically - not in the usual correct spacing.
I have added this line in my Inno script
Source: mypath_Dist\mscomctl.OCX; DestDir: "{sys}"; Flags: regserver ignoreversion;
Any ideas why this might be happening?
GenDev
 
The fact that the chart is being displayed - albeit incorrectly - suggests that the OCX has been properly installed and registered. If that was not the case, you would have seen an error message. So don't look to Inno for the cause.

A more likely possibility would be DPI awareness. Try putting this near the start of your main program:

Code:
DECLARE INTEGER SetProcessDPIAware IN WIN32API
SetProcessDPIAware()

However, if that doesn't solve the problem, remove it, as it cold cause unwanted side effects elsewhere.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Mike,

Sadly that didn't create any change - removed form code in Main.prg

Gendev
 
It could still be related to different DPI resolutions on Dev PC and laptop. Todays laptops often come with HD or even UHD/XHD displays with high DPI rates, unlike VFP, which reacts to SetProcessDpiAware rendering fonts accordingly, OCXes usually have their own settings about that.

Change the font sizes up when you detect high DPI displays. That is, if the resolution is higher than usual, set up the font sizes used in the chart.

Chriss
 
Hi Chriss,

The laptop is an older model.

DEV PC runs at dual 1920x1080 and the laptop 1280 x 768

Regards
GenDev
 
Hi Chriss,


Here are the pic files

laptop_t9copp.png
devPC_jjwmu9.png
 
Okay, that can't be explained with dpi resolutions at all.

Arte there some default settings stored in the registry (the registry is not only storing informations about OCXs themeselves, but also settings)? I think so, or some INI files, or other sources, that determine how the column captions are rendered. Anything, that can differ on pc vs laptop, but as Mike already said, the mere registering of the OCX is done, otherwise you wouldn't see a chart at all.

There are Ole control specific properties you can set that are not store in VFPs property memo, but in an Ole memo in a form or clas record, so they will come over from pc to notebook, once you have the same sources or same EXE there, so I'd just give it a go to build a new EXE, bring it over to the notebook and use it there. Be aware that overwriting an EXE in a system directory like Program Files with UAC on would redirect that to VirtualStore and not indeed overwrite the EXE a setup could put there. So to update an EXE, either turn UAC off or let a setup do the EXE update.

Chriss
 
Hi Chriss,
Y have uninstalled/reinstalled my program on the laptop countless times using the uninstall/install exe provided by Inno. Thus the exe is the same on both computers.
I didn't think my ini file held any items that impacted on the graph.
I'll have to investigate whether it is possible to 'prime' the control.

Thanks

GenDev
 
Hello,

I agree, it seems to be a DPI effect.

is that effect in other programs, too ?
Do you use the laptop in native resolution ?
You may try to change dpi to 100% and "play" with "Cleartype"


Regards
tom

 
I think the "Person, Event, Source" etc texts are "Footnotes", right? In the MS Chart Properties you will set them to be vertical or horizontal besides other settings. That has nothing to do with DPI.

Chriss
 
Hmm...

A first question is how gendev create chart picture because mscomctl.OCX don't contains a class for creating picture.



mJindrova
 
Chriss,
This is the view I have in the IDE of the form I use with the control inserted and my text added - this may not be the correct way to do it but that's what I used.

Form_xs4h8w.png


GenDev
 
Of interest
The graph shows the same on my wife's Toshiba Laptop - much later C1999 vintage.

GenDev
 
You choose what you want in OLE püroperties:

But you can only see thise, when you design a visual form (VCX/SCX), not if you stick to writing PRG code:
ms_chart_properties_jrmhpi.png

That's where you configure what chart type to draw, how captions/titles/legend/footnote text is rendered etc.

Chriss
 
'You mnay also get more guidance, if you post the code you use to create thise charts. If your code is limited to defining the data series, your own experience shows you get "random" results in chart types, captions, etc. because you most likely don't explicitly set all that as you don't know how. We, as "normal" VFP developers would use these visual designer options available to us, that are not available when you do everything programmatically.

We had that discussion already, your coide is all PRG and you need to maintain and extend that. It doesn't hinder you to do new things withvisual designers, you cannot only do whol forms, you can base a class on container or even on the control base class and add that as object into your PRG code, too.

Chriss
 
Chriss,
You said ' your code is all PRG '.
Well I have over 50 forms and 220 prg files in my application.
The chart control is used in a form and was made over 15 years ago.
I now see the properties you mention and I will experiment with some of the options there.

Regards
GEnDev
 
You madfe the impression you're having all prg code in your thread184-1829540.
Okay, if you use the Ms Chart control on an scx form then you now know where to make some OCX specific settings. In general, things you can configure in these property dialogs of an OCX
a) come from the OCX, they are not VFP dialogs, they are dialogs VFP finds in an OCX
b) are not always available as usual properties in VFPs properties window
c) could usually at least be set by code, too, but you'll need OCX documnetation to find out how/where. Even intellisense won't often help you find things, for example in many OCXes, unlike in VFP, where you have fontname/fontsize, etc properties, OCXes have a font object with size fontface etc properties, and so that only shows up in 2nd level of intellisense of the font subobject.

I was goolging the MS Chart chm, I'm pretty sure it once was documented in the MSDN library, like once (last time for VFP6) the chm for VFP was just one part f the MSDN library with help files for very many things related to MS, including VBA for Office, etc., also common controls and some more MS OCXes. I think the chart control is mostly related to Officce and so you may find documentaiton for it in the VBA help system.

Chriss
 
Further to my previous post I have used the MS Chart properties to add text to my chart.
Surprising behaviour on Notebook compared to Desktop. I have used the smallest available font size
for the text. Note vertical axis numbers and exhibit types printed on Notebook not on Desktop.

Notebook_bltbc8.png
Desktop_imrpal.png


GenDev

Adelaide
South Australia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top