|
Hi folks,
I have project writing rich text document on metafile using GDI
Now I'm trying to make it using GDI+
Problem: I can't draw it precisely!!
Test sample: create metafile 10x10 inces, draw strips 10, 9, 8 inches long:
<br />
RectangleF frame = new RectangleF(0f, 0f, 10f, 10f);<br />
Metafile mf;<br />
Graphics g1;<br />
<br />
using(Graphics gr = CreateGraphics())<br />
{<br />
IntPtr dc = gr.GetHdc();<br />
mf = new Metafile(@"c:\inch.emf", dc, frame, MetafileFrameUnit.Inch, EmfType.EmfOnly);<br />
gr.ReleaseHdc(dc);<br />
}<br />
g1 = Graphics.FromImage(mf);<br />
g1.PageUnit = GraphicsUnit.Inch;<br />
g1.DrawLine(Pens.Green, 0F, 1F, 10F, 1F);<br />
<br />
g1.DrawLine(Pens.Green, 0F, 3F, 9F, 3F);<br />
g1.DrawLine(Pens.Green, 0F, 5F, 8F, 5F);<br />
g1.DrawLine(Pens.GreenYellow, 1f, 0f, 1f, 10f);<br />
g1.DrawLine(Pens.GreenYellow, 3f, 0f, 3f, 9f);<br />
g1.DrawLine(Pens.GreenYellow, 5f, 0f, 5f, 8f); <br />
<br />
g1.Dispose();<br />
mf.Dispose();<br />
Strips are shorter than needed!!
Using other units (Milimeter, Pixel, Point, Document) produces different results - all invalid
Question: how to create precise EMF - with definite size, size and positions of elements?
WBR Tim
Tim
|
|
|
|
|
Its an easy one
I have a worker thread like this:
private void workerThread()
{
...
...
interpreter.Parse(.....)
...
...
}
This "interpreter" is a NMEA parser object, and the Parse method raises several events... whose handlers are declared and coded on the main form code.
My question is... are these event handlers executed in my worker thread? or are they executed in the main ui thread?
By the way, the NMEA Parser is very similar to the Jon Person's one, avaliable in CodeProject
|
|
|
|
|
Those event handles run on your worker thread and it's not recommended to access/modify UI controls from them. You might want to read this[^] article to get a better understanding.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thanks for your kind response!
But i forgot to tell you that I am using Compact Framework 1.1, that does not include BeginInvoke
|
|
|
|
|
|
I had developed Today screen programming for Pocket
PC using .NETCF,C#,Today screen plug in which is provided by microsoft
.I refered the following link.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/TodayScrn.asp
It is working fine with Pocket PC 2003 English OS.But it is not working with Pocket PC 2003 German OS.What is the change i need to be do to
make this work in German OS.I didnt get any error or crash but my
application is not listed out in Pocket PC (that is in
Settings->Today->Items tab).So i am not able to set the today screen
item and access the application.Please help me in this regard.
Regards,
S.Sevugan.
|
|
|
|
|
how to add module in c#.net? There is no option in the menu project-> add module in c#.net which we have in vb.net.
sarayu
|
|
|
|
|
Use CSC.exe (C# compiler) to compile ur code in to a module using the Target switch. Then use AL.exe (assembly linker) to link the module to ur assembly.
|
|
|
|
|
hi
Thank you for the response.
Iam not aware of how to compile and usage of assembly linker. can u give me the step by step procedure.
Regards,
Sarayu.
|
|
|
|
|
Look in msdn.microsoft.com
|
|
|
|
|
C# does not support the concept of modules as VB.NET does. AFAIK the module concept is a hang over from the old VB6 days and the VB.NET compiler does some fudging when converting the VB.NET code into MSIL in order to get it to work.
I did read an interesting article on the subject a week or two back, however I cannot find it otherwise I would have linked to it.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
I mean CSC /target:module
Never used VB & don't know how a module in VB differs from module in dotNet.
|
|
|
|
|
hi
I have got the information from msdn but that is purely related to console application. How will i do that in windows application using c#.net.
My requirement is :
I need to access a variable globally where the changes are done dynamically and that has to be reflected in all the other forms in that solution file.
example:
A variable a=10 is accessed globally.
During runtime i ll change the variable,a=20 in a different form.
how will this reflect in all the other forms unless i declare the globle variable in a module.
if i declare the variable by giving
public static a
i can access globally, but i cannot do the changes dynamically.
hope i ll get your help.
thanks,
sarayu.
|
|
|
|
|
Hello!
We are using a class to manage serial port, and we are continuously receiving data from GPS.
In order to improve things, all the complex treatment is done by a worker thread, but we need to do many UI updates from this thread. The result is this: all things are right, but UI always slows down and doesnt offer a good response to user interation.
We are using Invoke function for these UI updates, something like this:
protected TextBox _txtSum;
protected int _sum ;
public void thread_funcion()
{
_sum = ......... // complex process
_txtSum.Invoke(new EventHandler(UpdateSumDisplay));
..
..
..Many more complex UI updates
..
}
public void UpdateSumDisplay(object sender, EventArgs e)
{
_txtSum.Text = _sum.ToString();
}
... but I think this is not enough (and we discovered Invoke is a blocking method!!!)
How do you guys solve this kind of situations?
Any idea will be useful!!
Thanks!!!
By the way, my app is developed using Compact Framework on a Pocket PC, thats why we are in great need of perfomance.
|
|
|
|
|
_Silius_ wrote: and we discovered Invoke is a blocking method!!!
You could try BeginInvoke , i don't know if it's in the Compact Framework though...
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
Im afraid BeginInvoke is not avaliable in CF
|
|
|
|
|
Hello everybody,
I have created a setup project with Visual Studio .NET, everything's all right but during installation, I cannot see the files which are installed ...
Does somebody knows how to make appear the files installed during installation ???
Thanks a lot and have a nice day,
alain
There is no way to happiness, happiness is the way !
|
|
|
|
|
This is not a cappability that is supported by Windows Installer. To actually display each file name as it is copied requires a lot of really complex custom modifications to the setup.
You can add a line to the MSI using Orca to get the progress bar to display some simple messages like "Copying files", "Creating Registry Entries" and stuff like that, but it will not display the file names themnselves.
If you want to add at least some status messages, open the msi with Orca, find the EventMapping table and add a new row with the following values:
Dialog: ProgressForm
Control: ProgressLabel
Event: ActionText
Attribute: Text
|
|
|
|
|
Thanks for your answer ! I'll have a look on what I can do with Orca !
I wish you a nice day,
alain costanza
There is no way to happiness, happiness is the way !
|
|
|
|
|
Hi All,
I've been working on a saved dynamic assembly that holds all the types and corresponding xml serialization attributes I need to deserialize xml documents into objects.
You might wonder why I would choose a dynamic assembly over simply coding the types at compile time - the simple answer is I don't know what the types will be before hand and I only have an xml schema (from which I build the dynamic assembly) with various attributes that change frequently.
Since the schema only defines data types (methods,events,delegates could probably be defined within xs:appinfo tags but in my case they are not), I needed a way to add functionality to these dynamically created classes which were otherwise, nothing more than just data stubs.
The method I chose was to define (at compile-time) abstract base classes from which classes in my dynamic assembly could inherit. Now these simple data-stub classes had a complement of methods to enable them to do more than simply hold data in fields.
Unfortunately, it seems that since my dynamic classes now inherit from classes defined at compile-time, the xml serializer gets confused (see error and stack trace below).
It worked fine before I added the inheritance - maybe I need a reference (somehow) to the hardcoded assembly containing the types I inherit from in my dynamic assembly.
Any suggestions? Thanks in advance, Rein
[[error and stack trace]]
"An unhandled exception of type 'SystemIO.FileNotFoundException' occurred in mscorlib.dll.
Addtional Information: File or assembly name [xxxxx.dll], or one of it's dependencies, was not found."
stack trace:
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Boolean stringized, Evidence assemblySecurity, StackCrawlMark& stackMark)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef, Evidence assemblySecurity)
at System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly()
at System.CodeDom.Compiler.CompilerResults.get_CompiledAssembly()
at System.Xml.Serialization.Compiler.Compile()
at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings)
at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlTypeMapping xmlTypeMapping)
at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
at System.Xml.Serialization.XmlSerializer..ctor(Type type)
|
|
|
|
|
|
Hello,
I did the below experiment and I did not understand the cause for the exception. Can you please throw some light on this problem?
Also can you please clarify whether a native client can directly sink the .NET Remoting callbacks?
Description of Prototype:
This has mainly 3 modules viz. Remoting Server(C#), Adapter (MC++) and Client(Native C++).
(1) I implemented a SAO(Server Activated Object) singleton, in a C# .NET Remoting Server. Remoting object exposes ISrv interface. Also, Remoting object sends notifications via ISrc interface. These interfaces are defined in a C# Class library and shared across Client, Adapter and Server.
(2) I implemented an MC++ Adapter, a wrapper for the SAO. Adapter implements ISrv interface and exposes the same to native client(s). This basically holds a transparent proxy to the remoting object mentioned in (1).
(3) I implemented a native C++ client interacting with SAO via MC++ Adapter. Client was able to reach SAO via MC++ adapter using ISrv interface. Also Native client was able to receive notifications from C# SAO via sink class(on Cleint side). Actually the sink objects were registered onto SAO by clients via ISrv. SAO Singleton maintains such registered sink objects in an arraylist in its class scope. For some reason, I observed an exception when Server tries to send notifications, 5 minutes(approximately) after the sink object registration. I could not understand the reason for this problem. Can you please clarify? Below is the exception info:
Exception Message: "Requested service not found"
Exception Source: System.Runtime.Remoting.RemotingException
To get around this problem, I had to do the below changes to Adapter & Client modules:
I created a Sink class, derived from MBR and implementing ISrc in MC++ Adapter. Set the lifetime of Sink class to indefinite life time. Then Adapter was able to receive notifications from SAO without any problems as described above. In this experiment, I had to use a different interface between native client and Adapter for Adapter to relay SAO notifications back to the client.
Thank you in advance....
Best Regards,
|
|
|
|
|
chervu wrote: Exception Message: "Requested service not found"
Exception Source: System.Runtime.Remoting.RemotingException
To get around this problem, I had to do the below changes to Adapter & Client modules:
That happened because in .NET Remoting, each remote object has a definite lifetime associated with it. This is to avoid leaving them hanging around forever.
Now because you overrode InitializeLifetimeServices and returned null, the remoting framework doesn't disconnect the object from the framework, in other words, the object will be accessible for the lifetime of the server. For more advanced lifetime control, have a look at the ISponsor[^] interface.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thank you very much for the response.
Is it correct to say that native clients(in above experiment: C++ exe) can not directly receive notifications from a Remoting Server (in above experiment: SAO)?
If this is correct to say, then always a managed Adapter(wrapper) needs to be written to receive notifications from a remoting server so as to relay them to native clients?
I did not understand how Remoting Server can lose instances of Sink objects created/existing in the Native exe over heap. Can you please give a pointer on this topic to any book/MSDN article that explains a little detailed?
Thanks again & Best Regards,
|
|
|
|
|
chervu wrote: Is it correct to say that native clients(in above experiment: C++ exe) can not directly receive notifications from a Remoting Server (in above experiment: SAO)?
Yes, because remoting only works across clients written in .NET.
chervu wrote: I did not understand how Remoting Server can lose instances of Sink objects created/existing in the Native exe over heap. Can you please give a pointer on this topic to any book/MSDN article that explains a little detailed?
Your remoting server didn't lose instances of native objects, it destroyed your managed wrappers because their lifetime expired.
This[^] might help. The "Advanced .NET Remoting" book by Ingo Rammer might also help.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|