|
sorry thats not my question
wht is custom collection?how can we do that.
soori
|
|
|
|
|
Although the question is very vague on what you want to do let see if this helps.
You can create a custom collection by implementing IList, IEnumerable etc interfaces or extending a CollectionBase class to store whatever object you want to specialize to.
In order to sent a Custom Collection to a DataGrid it should be one of the following
A DataTable
A DataView
A DataSet
A DataViewManager
Any component that implements the IListSource interface
Any component that implements the IList interface
CustomCollection implements IList interface so it will work as a DataSource to DataGrid. Hope this helps.
|
|
|
|
|
Hi All,
Please could someone give me a code snippet on how to convert an image into Base64. I think i could use it in this segment myXmlTextWriter.WriteElementString("ImagePath", Convert.ToString(ps.ImagePath)); , Convert the image into Base64 in C# before writing it into xml file. The reason why i need to do this is to embed an image into the xml so that it is embedded into my HTML after the xslDoc.Transform(xmlPath, ExamplePath+"\\Example.html",resolver); .
Actually you can display base-64 images inline, using the data url format -
see the spec. at http://www.ietf.org/rfc/rfc2397.txt[^] .
I read up on this topic and came across the following: <IMG SRC="data:image/gif,base64;[...]"> where the [...] contains your base-64
string
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
If you have an Image object, save it to a MemoryStream to get a byte array.
If you have an image file, load it into a byte array.
Use the Convert.ToBase64String method to make the conversion.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I came across this example...
Image srcImage = new Bitmap(txtGIFImageFile.Text);<br />
MemoryStream memStream = new MemoryStream();<br />
srcImage.Save(memStream, System.Drawing.Imaging.ImageFormat.Gif);<br />
<br />
StringBuilder strBuilder = new StringBuilder();<br />
StringWriter writerSerialized = new StringWriter(strBuilder);<br />
XmlTextWriter writerXMLText = new XmlTextWriter(writerSerialized);<br />
<br />
XmlSerializer serializerXML = new XmlSerializer(memStream.GetBuffer().GetType());<br />
serializerXML.Serialize(writerXMLText, memStream.GetBuffer());<br />
<br />
writerXMLText.Close();<br />
txtSerializedText.Text = strBuilder.ToString();
would it be possible to insert a path with the file name (like for example: "C:\img\img123.jpg" ) in the Image srcImage = new Bitmap(txtGIFImageFile.Text); part?
Thank you in advance.
Nico
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
NarutoFan#1 wrote: would it be possible to insert a path with the file name (like for example: "C:\img\img123.jpg" ) in the Image srcImage = new Bitmap(txtGIFImageFile.Text); part?
I take it that you have no clue how the code really works?
The new Bitmap() part is loading the image from the file specified in the text box. Of course you can use any string you like instead of reading a string from a text box.
Are you going to convert the image from one format to anohter? Otherwise there is no reason to load the image and then save it again.
---
b { font-weight: normal; }
|
|
|
|
|
Yes, i need to convert the image to Base64, this is the format i operantly need to be able to embed an image into the xml to be able to embed it in the html.
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
You can't convert an image into base 64 format, as base 64 is not an image format. Converting from one image format to another is for example converting a GIF image into a JPEG image. What you convert into base 64 is the image file data, not the image itself.
If you want to send the image data in the current format, there is no need to unpack it into an Image object only to re-pack it back to the same format. All you do is use a lot of processing time for nothing, and possibly cause degradation of the image quality.
---
b { font-weight: normal; }
|
|
|
|
|
Okay thank you for your time. But would it be a good idea to convert the image file data to base64 or would it be a better idea to just redo the xml and xsl and just use FOP to create a pdf file with the image embedded onto that?
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
okay, i just redid the whole report. Thank you for your time.
Enjoy your day.
Thank goodness it's Friday.
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
How can I send a email with the standard email-program in windows. Who can help me with an example
|
|
|
|
|
You need a MAPI wrapper to do this, there are several on the web, type 'C# MAPI' in to google.
Christian Graus - C++ MVP
|
|
|
|
|
Send an email with two lines of code:
Using System.Net.Mail;
namespace Email
{
class EmailMe
{
void SendEmail()
{
string SmtpSrv = "mail.Hotmail.com";
SmtpClient _SC = new SmtpClient(SmtpSrv);
_SC.Send(string "From", string "To", string "Subject", string "Body")
}
}
}
|
|
|
|
|
hi how can i use 3d in c# (.net3) (i wana a object that can rotate , view and etc of common 3d action )
########################
|
|
|
|
|
Easiest way, download DirectX SDK and look at the C# samples.
Christian Graus - C++ MVP
|
|
|
|
|
Using DirectX would be a rather painful way to do something extremely simple - and in return it would not be as easy to use as part of other controls as the simple solution.
I have previously posted an example on another forum[^] - notice this is just an evenings hack, so consider it a starting point, not "best practices". Obviosly you would need your own domain specific way to load the 3D model to display (I think WPF might be able to load some formats, I didn't investigate it as I did not need it).
I won't promise the downloadable will execute (they where build for the beta) but I do beleive the source code posted 07-10-2006, 09:54 will still work, or at least get you started
|
|
|
|
|
heeh and more
########################
|
|
|
|
|
I think its quite easy to use the TAO OpenGL framework.
The installation provides libaries enabling c# for OpenGL. The installation comes with the NeHe examples.
Just don't know where it works for .net3
|
|
|
|
|
Hi,
How can we disable individual nodes in a treeview in .Net?
Tin
|
|
|
|
|
I'm pretty sure you can't.
Christian Graus - C++ MVP
|
|
|
|
|
You cannot disable individual nodes.
|
|
|
|
|
|
Depends on what you are doing:
WPF: Individual nodes can be disabled, so no problem.
WinForm: Handle the events on the tree - so if your node is selected, deselect it again (this probably won't be pretty to look at - in the Form or in the code, but that is the price you pay when using an obsolete GUI)
ASP.NET: You might pull something off client side, but I do not know how to do it - and if it is possible.
|
|
|
|
|
Hi,
Ok my database sheme I use is XML, i am trying to populate the data in a treeview control but it gives me unhappy results.
Would it be easier or better by using an Access database rather than XML?
ok ine more question sorry, i have seen many times before a couple of application that store information in a file where they have their own extension. for example storing information in a file database like databse1.dat or smth. How do people do this or is this not C# at all?
Thanks guys
Regards
|
|
|
|
|
If you use the System.IO namespace to writ binary data, you can write any byte sequence you want, and call it whatever you like.
I doubt that moving to Access will, by itself, change how the tree control behaves.
Christian Graus - C++ MVP
|
|
|
|