|
I pull an image onto the picturebox control as its 'image' property. Then I draw some arrows on the picturebox (not into the image itself).
How do I save the image + the arrows I draw onto the image, out to disk?
I have tried using the BitBlt function but it seems that BitBlt always takes data from the screen-buffer as opposed to the picturebox itself. This is an issue for me because some of the picture I need is underneath scroll-bars...
Anyone have any ideas?
You Know We Non-Stop
|
|
|
|
|
Sorry, this would probably be better asked in the .NET Framework forum, but I get better responses in this one. My C# application, compiled with VS.NET 2002 Pro, which uses the .NET Framework version 1.0.xxx, runs perfectly on a machine with the .NET Framework version 1.0.xxx. However, when this program is required to run under a more recent version of the .NET Framework, I notice different functionality in certain areas of the application. The code simply cannot be anymore straightforward, it works on the same .NET version I compiled it under. My question is, if I compile this same code with VS.NET 2003, or even 2005, will the application run PROPERLY when it is running under 1.1.xxx or newer? Could there be another cause...like I said before, it runs perfect under the older version of the .NET Framework, but not so much under more recent versions. I'd appreciate the help on this...
|
|
|
|
|
.NET versions can be installed side-by-side; if you want to use the 1.0.xxx version, specify this in the configuration file for your assembly. Search MSDN if you need an example.
.NET 1.1 breaks a few 1.0 things, mostly security and remoting stuff though. If your code is as simple as you say, post some code that works differently on 1.1.
Judah Himango
|
|
|
|
|
Extending on what Judah said, look-up the <supportedRuntime> configuration element. It's only supported in .NET 1.1 and newer, since anything targeting the 1.0 framework doesn't really have a choice for backward compatibility.
There's also a lot of information about side-by-side execution in the "Programming Topics" section in the .NET Framework SDK I encourage you to read. I'd give you a link, but unfortunately I'm having connection problems to certain servers. Go figure. It's not hard finding anyway.
Software Design Engineer
Developer Division Sustained Engineering, Microsoft
My Articles
|
|
|
|
|
I am trying to call an ActiveX DLL written in VB6 from my C# app.
The function call has a single parameter that is declared optional.
How do I call it from C#?
The VB function is:
Public Function GetTasks(Optional ByVal lngUserCode As Long) As ADODB.Recordset
|
|
|
|
|
I want to call the function without a parameter so the entire recordset is returned.
|
|
|
|
|
|
Hi All,
How I convert a text file (delimiters are blank spaces) in xml file.
luciano_rib@yahoo.com.br
|
|
|
|
|
lklkjlk wrote:
How I convert a text file (delimiters are blank spaces) in xml file.
just like you need to. :p
top secret xacc-ide 0.0.1
|
|
|
|
|
The easiest way is probably to decide on a schema (format of the xml) and then iterate through all of your text file and transform it on the fly into a string that has your schema. You can then do what you want with the XML.
store your internet favourites online - www.my-faves.co.uk
|
|
|
|
|
To expand on what Davey said, take a look at the XmlTextWriter class in the .NET Framework SDK documentation. It includes all the information you need to use it, as well as examples that should help you.
To iterate through your lines in the delimited text file, open the file in a StreamReader like so:
using (StreamReader reader = new StreamReader("file.txt"))
{
string line = null;
while ((line = reader.ReadLine()) != null)
} Like Davey said, though, the schema of the XML file really depends on what you need.
Software Design Engineer
Developer Division Sustained Engineering, Microsoft
My Articles
|
|
|
|
|
Even if someone writes such a program, it will need numerous inputs regarding what words in the text file are tags, attributes and data. A cumbersome task.
To the very least, you will need to add '<' '>' characters in your text file, so that atleast the tags are identifiable. Rest can be assumed as data. Then you can load that file as a MS DOM document. Get MS XML DOM and see the documentation to know how to invoke the COM and load a document.
If you want to do this manually, add '<' '>' characters, rename the file to .xml and load it in XML Spy. Use the pretty-print button to format it nicely.
|
|
|
|
|
Sorry, I was not aware of XmlWriter, yes you can read up the MSDN article on XmlWriter class and I think, it is best suited for your purpose.
|
|
|
|
|
Hello, i would like to sign a xml document using a certificate stored in my machine. I have been looking for examples but in all of them framework 1.1 is used (using Microsoft.Web.Services.Security) and altough i have it, i cannot use it with Microsoft Visual Studio .NET 2002. It is possible to make the Microsoft Visual Studio to use the 1.1 version of the framework??
I only need the signed xml document to make some testing, so if it isn´t possible to sign with 1.0 using my own certificate, please tell me a program that do that (not infopath because if i check the signature always false is returned).
About the signature...it must be xmldsig.
I have a very near deadline to give my project so if you help me i will be very grateful!
Regards!
|
|
|
|
|
Read my article, XML Digital Signatures for Application Licensing[^]. It uses the classes in the .NET BCL for xmldsig. Many people - including my first work that lead to this article - use Microsoft.Web.Services.dll assembly because the documentation for the the BCL assemblies isn't so great - but it is possible. It just requires some digging into the IL in the System.Security.dll assembly.
Microsoft.Web.Services.dll, BTW, is actually from the Web Service Enhancements, or WSE. There are two versions - 1.0 and 2.0. You can read about the WSE at http://msdn.microsoft.com/webservices/building/wse/[^]. WSE 1.0 will work with both .NET 1.0 and 1.1.
Software Design Engineer
Developer Division Sustained Engineering, Microsoft
My Articles
|
|
|
|
|
I have read your article and i have used your method to sign and to check the signature.
When you sign you don´t add the certificate info, so i add it in order to get it in the server when he receives it.
To perform the signature, it works, but when i verify it...the checksignature method always returns false...i have tried millions of things and none works.
Here i show you some code to sign:
<br />
<br />
Microsoft.Web.Services.Security.X509.X509Certificat cert;<br />
<br />
XmlDocument doc = new XmlDocument();<br />
doc.Load("c:/Formtosign.xml");<br />
<br />
SignedXml sxml = new SignedXml(doc);<br />
sxml.SigningKey = cert.key; <br />
<br />
sxml.SignedInfo.CanonicalizationMethod =<br />
SignedXml.XmlDsigCanonicalizationUrl;
<br />
Reference r = new Reference("");<br />
<br />
r.AddTransform(new XmlDsigEnvelopedSignatureTransform(false));<br />
<br />
sxml.AddReference(r);<br />
<br />
System.Security.Cryptography.Xml.KeyInfo keyInfo = <br />
new System.Security.Cryptography.Xml.KeyInfo(); <br />
<br />
keyInfo.AddClause(new System.Security.Cryptography.Xml.KeyInfoX509Data(cert)); <br />
sxml.KeyInfo = keyInfo; <br />
<br />
sxml.ComputeSignature();<br />
<br />
XmlElement sig = sxml.GetXml();<br />
doc.DocumentElement.AppendChild(sig);<br />
<br />
XmlTextWriter writer = new XmlTextWriter<br />
("c:/Formsigned.xml",System.Text.Encoding.UTF8);<br />
writer.Formatting = Formatting.Indented;<br />
<br />
try<br />
{<br />
doc.WriteTo(writer);<br />
}<br />
finally<br />
{<br />
writer.Flush();<br />
writer.Close();<br />
}<br />
Now the code to verify the signature;
<br />
nodeList = doc.GetElementsByTagName<br />
("Signature",SignedXml.XmlDsigNamespaceUrl);<br />
<br />
nodeList2 = doc.GetElementsByTagName("X509Certificate");<br />
<br />
SignedXml[] signatures = new SignedXml[nodeList.Count];<br />
<br />
validSignatures = nodeList.Count;<br />
<br />
<br />
for(int i = 0; i < nodeList.Count; i++)<br />
{<br />
signatures[i] = new SignedXml();<br />
signatures[i].LoadXml((XmlElement)nodeList[i]);<br />
<br />
<br />
Certificate cerCapi = new CertificateClass();<br />
cerCapi.Import(nodeList2[i].InnerText);<br />
ICertContext iCertCntxt = (ICertContext) cerCapi;<br />
int certcntxt = iCertCntxt.CertContext ;<br />
IntPtr hCertCntxt = new IntPtr(certcntxt);<br />
<br />
Microsoft.Web.Services.Security.X509.X509Certificate cer = new Microsoft.Web.Services.Security.X509.X509Certificate(hCerCntx);<br />
<br />
<br />
RSACryptoServiceProvider csp = new RSACryptoServiceProvider();<br />
csp = (RSACryptoServiceProvider)cer.PublicKey;<br />
if (!signatures[i].CheckSignature(csp))<br />
validSignatures--;<br />
}<br />
Your method is adapted to my necesities...but i think that is nearly the same. I get the keys not from a program, I get them from the certificate.
Thank you in advance...
|
|
|
|
|
URL:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vclrfusingforeachwithcollections.asp
Hi! I have created a class library in C# using IEnumerable interface as specified in above URL, Example 2.
Now, I am iterating the items from Visual basic but it is giving error like Object does not support this property or method while it works fine with .net. As mentioned in URL, it should work with the VB also.
What can be the problem?
C# code is same as in URL, Example 2.
Here is the VB code:
Dim col As New MyCollection
Dim i As Object
For Each i In col
MsgBox (i)
Next
|
|
|
|
|
Ami Shah wrote:
am iterating the items from Visual basic but it is giving error like Object does not support this property or method while it works fine with .net.
Do you mean Visual Basic 6? I wouldn't think that a class written with C# would work in VB6 without a lot of extra work (I believe it is possible via COM, but it takes a lot to achieve it)
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
Ya, Visual Basic 6 only. It is mentioned in the given URL also that you can use For Each statement in Visual Basic 6 also with using Example code 2.
I have implemented the same code given in Example 2 only and Calling loop thru VB as mentioned. It should work acoording to article, right?
|
|
|
|
|
I wouldn't think that is possible. You need to be using VB.NET
I understand that is possible to access .NET objects in a non .NET environment via a COM interface, but I've never tried. However, that solution will not give you access to the enumerator via a foreach statement, you would use the via the methods exposed via the IEnumerable interfave directly.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
See the URL, in the example 2 it is clearly written that
"This example repeats the same algorithm of Example 1, but uses a generic collection that can be enumerated from other languages such as Visual Basic."
I think the meaning is that We can use the for each and iterate thru collection from visual basic.
|
|
|
|
|
Given the context of the article, they are meaning Visual Basic.NET. By "other languages" it looks to me that they mean other languages that use the .NET framework.
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
Not getting the response you want from a question asked in an online forum: How to Ask Questions the Smart Way!
|
|
|
|
|
|
I've made an Interface IDataFactory with a property ISqlDbComponent{get;set;}
a component with the interface IDataFactory:
public class DataFactory : System.ComponentModel.Component, IDataFactory
The property should be visible with
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
but isn't.
When I derive a component from DataFactory, the property ISqlDbComponent IS visible.
I don't understand why and which Designer Attribute I have to add to the property to make it visible in the first implementation and not only in derived classes.
The property is implemented in the component "DataFactory" so why it isn't visible in the designer?
Thanks a lot
Stefan
|
|
|
|
|
STW wrote:
The property should be visible with
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
but isn't.
Thats not true. That controls what the designer 'saves', and that attribute means it will be saved.
Look at BrowsableAttribute, but public Properties are visible by default.
top secret xacc-ide 0.0.1
|
|
|
|