|
/*
System.Drawing.Image image = System.Drawing.Image.FromFile();
System.Drawing.Image image = System.Drawing.Image.FromStream();
image.Save("a.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
image.Save("a.gif", System.Drawing.Imaging.ImageFormat.Gif);
*/
|
|
|
|
|
Thanks, but I am a bit confused with the code. Which is the source file, and which is the destination file?
|
|
|
|
|
Two ways
1) you get the stream from Memory, by BinaryRead a little complex
2) you save the file to your hard disk first, then
get local file path and save as aonther file,
simple but unefficient.
|
|
|
|
|
GDI+ is a librabry in .NET which is used to manipulate graphics.
Read GDI+ articles from google(search GDI+ .NET)
here you can get code to generate image from another image, in this way you can craete a jpg from gif or vice versa.
Thanks
Sushant Duggal.
|
|
|
|
|
Hi,
I need to get the IP Adress (and many othe infos) of any user of my ASP.Net (web) application.
I looked arround the 'System.Web.HttpBrowserCapabilities' but there is no way to get the IP Adress.
Thanks a lot
The novice.
|
|
|
|
|
Have a look a Request.ServerVariables Collection - It definately has the user's IP Address in there plus, I suspect, the other information you are after.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Use Request.UserHostAddress to return the client IP.
To get more info use Request.Browser
|
|
|
|
|
Hi there !
I want to store a list of System.Drawing.Rectangle objects in an ArrayList.
On action of user, the position of the Rectanlge objects should be changed.
Anyway, the collection is not updated when I use foreach in the Move function see below).
I guess the content of the arraylist is somehow protected, but what kind of dynamic list should I use instead ?
Thanks
ch
My code looks like this :
public class RectCollection
{
private ArrayList rects;
public RectCollection()
{
this.rects = new ArrayList();
}
public ArrayList Rects
{
get { return rects; }
set { rects = value; }
}
public void Add(Rectangle rect)
{
this.rects.Add(rect);
}
public void Move(int x, int y)
{
foreach (Rectangle rect in this.rects)
{
rect.Offset(x, y);
}
}
|
|
|
|
|
Its nothing to do with the list being "protected" from change - it is due to the nature of Rectangle. It is a value type, which means you effectively operate on a copy of it when calling Offset after it is unboxed from the ArrayList.
try this as your move method:
public void Move(int x, int y)
{
for(int i=0;i<this.rects.Count;i++)
{
Rectangle rect = (Rectangle)this.rects[i];
rect.Offset(x,y);
this.rects[i] = rect;
}
}
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Hi to everyone,
I am writing a c# program that uses a native c++ dll. In the c++ dll I have a function which allocates space for a char array and returns it as follows:
char * my_func(size)<br />
{<br />
char * pOut = new char[size];<br />
...<br />
...<br />
return pOut;<br />
}
In C# part I wrapped the function as follows:
<br />
[DllImport("my_dll.dll", EntryPoint="my_func")]<br />
public static extern IntPtr my_func(int size);<br />
I am using the function in my code as follows:
<br />
IntPtr pData = my_func(nSize);<br />
byte[] arrByte = new byte[nSize];<br />
Marshal.Copy(pData, arrByte, 0, nSize);<br />
...<br />
The problem is how can I free the memory allocated in the native c++ dll by the new operator.
Thanks
|
|
|
|
|
i got this exception while calling Timer.Start()
Number must be either non-negative or -1.
Parameter name: dueTime
can any one tell me the reason.
timer interval is set to 180000.
Regards
Shajeel
|
|
|
|
|
Hi
Are the optional parameters are allowed in C#. If yes how they r implemented?
|
|
|
|
|
johnprakasht wrote: Are the optional parameters are allowed in C#.
Yes.
johnprakasht wrote: If yes how they r implemented?
It's a trick of the compiler.
Any other question?
I thought you might ask how to declare them!
with the param keyword.
As in
Console.WriteLine(string format, params object[] arguments);
|
|
|
|
|
If you mean optional parameters like those in VB.Net: No you won't find this in C#. Generally just make overloads of a function with different parameter combinations.
|
|
|
|
|
Optional parameteres not allowed same as VB.net here.
way of implementation is that you must create oveloaded methods as below:
public GetTest(string str1)
{
....
}
public GetTest(string str1,string str2)
{
....
}
|
|
|
|
|
Hi Friends,
Can anyone tell me how to embed images in email.
I need to put some images in the email.(inline images not attachments)
Thanks,
Sushant Duggal.
|
|
|
|
|
|
Ketan Majumdar wrote: http://www.devmail.net/help/devmail.samples.sending.embedding.html[^]
Hi,
This code uses the dll compiled and developed by devmail.com, the complete code is not available.
thanks
Sushant Duggal.
|
|
|
|
|
|
Ketan Majumdar wrote: Finally stumbled upon the way to create email messages with embedded images in ASP.NET 2.0. (Note that this doesn't work for ASP.NET 1.1, sorry to say.)
^) it deosnot work with framework 1.1
thans once again
Sushant Duggal.
|
|
|
|
|
is .net framework necessary to run a c#.net app.
if have another way, plz help me.
|
|
|
|
|
You MUST read your previous "SAME" question.
The answer is NO.
That is the concept of C#.
If you don't want to use .NET Framework, then write your code
using old C++.
|
|
|
|
|
but i am not familiar with c++. plz can u give me any tutorial for me.thanks.
|
|
|
|
|
But sorry, I cannot tell you how to write a C++ code. Just find some books about that.
|
|
|
|
|