Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » [solved] drawing to a GC through SWT and native code
[solved] drawing to a GC through SWT and native code [message #638284] Wed, 10 November 2010 17:09 Go to next message
Christian Sell is currently offline Christian SellFriend
Messages: 51
Registered: August 2010
Member
Hello,

I am creating an integrated printing solution which uses SWT to output parts of a document, and a C DLL (under Windows) to output other parts. Reason for this is that the DLL contains a word processing component which is able to render RTF.

To achieve this, I am passing the handle from the GC object over to the C DLL side. This goes well, if output is only generated from there. However, as soon as I call GC#drawString prior to calling the DLL, the output generated from there has wrong distances between lines, resulting in partially messed-up layout. This does not happen if I call other GC methods, such as drawLine.

It seems to me that the GC#drawString method is configuring the GC in a way unexpected by the DLL component. Can anybody hint on what is going on here?

thanks,
Christian Sell

[Updated on: Mon, 22 November 2010 20:05]

Report message to a moderator

Re: [solved] drawing to a GC through SWT and native code [message #640693 is a reply to message #638284] Mon, 22 November 2010 20:22 Go to previous message
Christian Sell is currently offline Christian SellFriend
Messages: 51
Registered: August 2010
Member
ok, I've got it. I ran through all the attributes of the device context and compared the values when printing through SWT first and when printing through the external component only.

I found that after using GC#drawString() the value retreived through GetTextalign(HDC) was always 24, whereas otherwise, it was 0. Now I simply call SetTextAlign(hdc, 0) in the external DLL before invoking the print routines proper, and voila, all is well

greetings,
Christian
Previous Topic:mouse wheel sends extra scroll event
Next Topic:how can i know if i'm running in a top level thread?
Goto Forum:
  


Current Time: Sun Dec 17 23:32:16 GMT 2017

Powered by FUDForum. Page generated in 0.01437 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software