Page Index Toggle Pages: [1] 2 3  Send TopicPrint
Very Hot Topic (More than 25 Replies) serious problem in print preview (Read 25242 times)
andrewsando1973
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Feb 14th, 2010
serious problem in print preview
Mar 13th, 2010 at 9:03am
Print Post  
I have a series problem with the PreviewDiagram method.

1) My fcx has many boxes that are hosting activex control (fpSpread from farpoint), then when i export the diagram to bmp or try to get a print preview for the document, all my axcontrol boxes become invisible. (inivisble only in the bmp and in the preview not in the real document)

Is there any explanation for this? and how can i solve it?

2) Also the quality of the preview is very poor. i mean the boxes with alpha < 255 as well as the shadows have very poor quality it doesn't look like what has been designed.
So, what can i do?

N.B. i wished i can attach a printscreen for the above but i don't know how to attach to this message.

Thanks in advance,
« Last Edit: Mar 15th, 2010 at 7:01am by andrewsando1973 »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: serious problem in print preview
Reply #1 - Mar 15th, 2010 at 10:01am
Print Post  
1) What you see in the real document on the screen is the ActiveX controls rendering themselves in their own windows by handling the Windows WM_PAINT message.

In order to render the controls on paper or exported bitmaps, FlowchartX expects the hosted controls to implement either the IViewObject->Draw method or IDataObject->GetData(CF_ENHMETAFILE) method. If they do not, there's nothing we can do to render the controls on paper / print preview / bitmap. You can see this working for example with the MSCAL.Calendar control.

If the fpSpread does not implement these methods, you could create a copy of the flowchart (e.g. call LoadFromString(SaveToString())) where the fpSpread controls are replaced with Table objects, and then use the copy to export to bitmap or print. If the fpSpread control has an export to bitmap method, another option could be to replace the fpSpread instances with Boxes that display the created bitmaps.

2) The Preview window is implemented by drawing WMF metafiles representing the pages, and unfortunately the WMF format does not support semi-transparency. It should look fine when printed though.

You cannot attach images here. You could upload them to your own server or some image-sharing service and link to it.

Stoyan
  
Back to top
 
IP Logged
 
andrewsando1973
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Feb 14th, 2010
Re: serious problem in print preview
Reply #2 - Mar 15th, 2010 at 10:51am
Print Post  
Thanks for your support. and sorry for any inconvenience.

I am a bit confused now, but may because i feel that months of hard working will go with the wind.

1) So please how can i check if the axcontrol  is implementing the methods you have mentioned? ( IViewObject->Draw method or IDataObject->GetData(CF_ENHMETAFILE) method)

2) and if they are implementing them, how can i make the fcx render the spread in bmp?

3) can you please give me an example (simple code) for ""create a copy of the flowchart (e.g. call LoadFromString(SaveToString())) where the fpSpread controls are replaced with Table objects, and then use the copy to export to bitmap or print.""?

sorry for asking many questions, but i really believe that fcx is one of the best controls on the web.

Thanks,
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: serious problem in print preview
Reply #3 - Mar 15th, 2010 at 11:01am
Print Post  
1) You can check if controls support these interfaces by calling the QueryInterface COM function. I'm not sure how it can be used in VB though. If QueryInterface returns an interface pointer of the specified type, then the control should have the respective methods implemented by the COM contract.

2) If these interfaces are implemented, there's nothing you should do. The flowchart will automatically use them to render the control on paper / the exported bitmap.

3) You could place a second flowchart on the form and call it "fcCopy", or load it dynamically. Then you can copy from the main flowchart to the copy like this:

dim fcdata as string
fcdata = fcMain.SaveToString(false)
fcCopy.LoadFromString fcdata
' replace spreads with tables in fcCopy...
fcCopy.PreviewDiagram

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: serious problem in print preview
Reply #4 - Mar 15th, 2010 at 11:47am
Print Post  
3) if you were asking how to replace spreads with tables - I mean you can remove the AxControl boxes and create Table objects at the same location (fcx.CreateTable method), where the tables have the same number of cells and the same cell dimensions as the spread controls. Then for each table copy the content of cells from the fpSpread cells to the table cells.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
andrewsando1973
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Feb 14th, 2010
Re: serious problem in print preview
Reply #5 - Mar 15th, 2010 at 12:13pm
Print Post  
Thank you,

I will try to find the best way, as the application now is almost finished, but came this problem that makes me really confused.

Thanks again
  
Back to top
 
IP Logged
 
andrewsando1973
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Feb 14th, 2010
Re: serious problem in print preview
Reply #6 - Mar 15th, 2010 at 12:18pm
Print Post  
I checked the documentation of the fpSpread (farpoint) and i found that they have a method GetData. and of course the spread can be printed on paper.

so how can i render the spread on bmp (this is the most important) or paper?

please find below the section of the fpSpread documentation regarding get data:

Applies To
fpDataObject object

Description
Retrieves data of a specified format.

Syntax

Visual Basic

fpSpread1.fpDataObject.GetData(Format As Integer) As Variant

Parameter
The following parameter is available:

Parameter Description 
Format Specifies the data format
Using the Or operator, combine any of the following values: 
Value Description 
1 - fpCFText Text (string data) 
2 - fpCFBitmap Bitmap (picture object) 
3 - fpCFMetafile Metafiles (picture object) 
8 - fpCFDIB Device-independent bitmap (picture object) 
9 - fpCFPalette Color palette (picture object) 
14 - fpCFEMetafile Enhanced metafile (picture object) 
-16639 - fpCFRTF Rich text format (string data) 


Remarks
If the data requested is a file, the 15 (fpCFFiles) value is not valid. Use the fpDataObject SetData method's Format parameter to retrieve the data.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: serious problem in print preview
Reply #7 - Mar 15th, 2010 at 12:44pm
Print Post  
Ok, if it supports the CF_ENHMETAFILE format, maybe we can make it work by swapping an if/else in our code. Currently it looks like this:

Code
Select All
if (punk->QueryInterface(
	IID_IViewObject, (void**)&viewObj) == S_OK)
{
	RECTL rcl = { rect.left, rect.top, rect.right, rect.bottom };
	viewObj->Draw(DVASPECT_CONTENT,
	....
}
else
{
	// try getting metafile through IDataObject
	IDataObject* dataObj = NULL;
	if (punk->QueryInterface(
		IID_IDataObject, (void**)&dataObj) == S_OK)
	{
		FORMATETC etc;
		etc.cfFormat = CF_ENHMETAFILE;
		....
	} 



So apparently fpSpread returns OK when queried for support IViewObject, but viewObj->Draw does not work as expected. We'll upload a version that tries to get a metafile before calling IViewObject so you can check if it will work better.

Stoyan
  
Back to top
 
IP Logged
 
andrewsando1973
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Feb 14th, 2010
Re: serious problem in print preview
Reply #8 - Mar 15th, 2010 at 12:47pm
Print Post  
Really, Thank you sooooooooo much.

Let me know when it is ready
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: serious problem in print preview
Reply #9 - Mar 17th, 2010 at 8:26am
Print Post  
Could you check if this version works any better?
https://mindfusion.eu/_beta/flowchartx32_emf.zip

It first tries to get a metafile image, and only if that fails it calls IViewObject->Draw.

Stoyan
  
Back to top
 
IP Logged
 
andrewsando1973
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Feb 14th, 2010
Re: serious problem in print preview
Reply #10 - Mar 17th, 2010 at 9:42am
Print Post  
I tried it, but it doesn't work out Sad

can you please try it yourself, the control is fpSpread (far point spread for com).

unfortunately, my whole application is dependent on this control (which is so powerful too) i use it as tables, comboboxes, textboxes,...etc.

Sorry for any inconvenience.
Andrew.

N.B: the ControlPadding is still shifting pixle to the bottom and right of the control.

Thanks Again, Andrew
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: serious problem in print preview
Reply #11 - Mar 17th, 2010 at 11:17am
Print Post  
Ok, our developer will check it when he has the time. Meanwhile you might try using that DataObject.GetData method to get a metafile for each spread and print the flowchart copy as suggested above.

By the way our preview/bitmap export code will work only if the hosted fpSpread object itself implements that IDataObject interface and the GetData method, and not its child object (fpSpread1.fpDataObject).

Stoyan
  
Back to top
 
IP Logged
 
andrewsando1973
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Feb 14th, 2010
Re: serious problem in print preview
Reply #12 - Mar 17th, 2010 at 11:26am
Print Post  
Thanks for your support
i will try what you have mentioned.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: serious problem in print preview
Reply #13 - Mar 24th, 2010 at 12:51pm
Print Post  
Our developer traced through the drawing code with the fpSpread trial, and found that the spread object itself does support IDataObject, but its GetData method returns false when asked for a metafile. Have you checked if the spread.DataObject property successfully creates metafiles? If it does, we could add an event that would let you return its IDataObject pointer, or the metafile's IPicture pointer, that FlowchartX could show in the preview window. Then you can avoid cloning the chart and replacing spreads with tables.

Stoyan
  
Back to top
 
IP Logged
 
andrewsando1973
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 56
Joined: Feb 14th, 2010
Re: serious problem in print preview
Reply #14 - Mar 26th, 2010 at 6:00am
Print Post  
Dear Sir, Thank you a lot for your real concern, and as i said before you are the best tech. support i ever seen on the web.

I'm not familiar with using the DataObject's in general, so i submitted a question on the fpSpread Forum regarding how to get the whole spread in a metafile format, and i'm waiting for a reply. Then i will let you know.

Thanks again.

N.B. is there any news about the shifted pixels with Draw ActiveX shape?
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 3 
Send TopicPrint