|
It's not static, but I don't really intend to change it. Do I have to use a picturebox? Can I just load it anywhere (I have multiple images with the for loop later...)
- I love D-flat!
|
|
|
|
|
You load an image file using Image.FromFile() or Image.FromStream().
The former locks the file until the image gets disposed of.
You can also embed an image as a resource, and load it from there when needed.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
I still get the error.
- I love D-flat!
|
|
|
|
|
What error? Please try to provide good information if you want to get good replies.
use a try-catch construct, catch the Exception, and look at Exception.ToString().
It will show a message, extra details, and a stack traceback. The first class.method
with a linenumber is the source line you should look at.
I hope you told Visual Editor to always display line numbers? (menu Tools/Options/
TextEditor...).
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
I know ehere it is. It's when I set the Bitmap previously declared to be a new Bitmap with a file extension. The error: ArgumentException was unhandled. Parameter is not valid.
- I love D-flat!
|
|
|
|
|
MasterSharp wrote: a new Bitmap with a file extension
there is no such thing as a bitmap with a file extension, only files have an extension.
I'm guessing you are doing something like new Bitmap(filespec+".JPG")
and it throws the ArgumentException, so you must:
1. look at the exact value of the parameter you have there; is it a valid path?
2. if relative path is used, is the current directory at that point what you expect?
3. check that file exists
4. check that file contains a valid image (does it show a thumbnail in Windows Explorer).
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Do I need te file extension or not? (jpg, png ... ?)
- I love D-flat!
|
|
|
|
|
This is it:
Btimap myBitmap;<br />
<br />
public Form1<br />
{<br />
<br />
myBitmap = new Bitmap("Content/Sprites/myImage.jpg");<br />
<br />
}
It doesn't work, when the file is under those folders in the explorer, WITH that name.
- I love D-flat!
|
|
|
|
|
That is not the correct path. When visual studio builds it places your executable in the bin directory. ../../Content/Sprites/myImage.jpg might work but the easiest thing to do is change your project settings to move the images to the bin directory on compile.
However, I usually set the options to embed in the assemble and the use the GetManifestResourceStream method from the Assembly class to retrieve the streams at runtime.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
So the suspicious things are under my earlier points
1. are slashes valid folder separators on your system?
2. this is a relative path, is curdir what you think it is?
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
A file extension is not mandatory; AFAIK GDI+ recognizes the image formats it supports
without needing the extension for that, so the only thing that matters is the filespec
correctly points to an existing and valid file.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Hi,
I am trying to deploy an application accompanied by a .chm help file. The file is referenced in the app by a helpProvider object that has a directory path property for the .chm.
Publishing the app is straight forward using the 'Click Once' publish wizard provided with 2005 Express. Unfortunately, when installed on the target computer, the app will only link to the .chm file if it has been placed (manually) in a directory that has exactly the same path as it had on the developer computer. The publish wizard seems to ignore the presence of the .chm file completely.
How do I publish the app so that the .chm file is included with it and installed automatically on the target computer?
A related 'problem' is that I cannot find the app on the target after it has been installed; the 'Program Files' directory does not appear to be used. Where does the app reside when it is installed on the target?
Thanks in advance JR.
|
|
|
|
|
Hi everyone,
Can someone tell me what is the cheapest way to send SMS through a C# application???
i will be thankful if u can give me some suggestion or links.
kind regards,
Nadia
|
|
|
|
|
Nadia v D,
What do you mean by "cheapest" way?, As in money? or...
Regards,
Gareth
|
|
|
|
|
Third party providers publish web services that you can call on a per use basis I believe.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Hi Nadia v D,if you find the cheapest way to send SMS through a C# application,please tell me,i want it for long time,but no Result.
|
|
|
|
|
Hi all
I want to set the items of a context menu at runtime, but there is no public constructor for the ToolStripItem class.
How should I achieve that?
-----
You seem eager to impose your preference of preventing others from imposing their preferences on others. -- Red Stateler, Master of Circular Reasoning and other fallacies
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
God is the only being who, to rule, does not need to exist. -- Charles Baudelaire
|
|
|
|
|
ToolStripItem is an abstract class and you can't add its instances to context menu. Instead, create instances of elements that derive from ToolStripItem (such as ToolStripLabel,ToolStripButton and so on) and add them to context menu.
|
|
|
|
|
Thanks Giorgi.
-----
You seem eager to impose your preference of preventing others from imposing their preferences on others. -- Red Stateler, Master of Circular Reasoning and other fallacies
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
God is the only being who, to rule, does not need to exist. -- Charles Baudelaire
|
|
|
|
|
You are welcome
|
|
|
|
|
I was wondering if there was a way to get the name/id of a process that is locking a file.
When I run try to open a FileStream and get the annoying "The process cannot access the file 'somefile' because it is being used by another process." message, can I get witch process is using that file or is that out of reach in C#?
|
|
|
|
|
I don't know how to do it in c# but here is c++ way: Deleting Locked Files[^]
You can use P/Invoke and use it in a .NET application
|
|
|
|
|
How to automatically Highlight (Select) value of a Textbox ,when typing the value in Textbox.
|
|
|
|
|
Look at the Select and SelectAll methods as well as the SelectedText, SelectionLength and SelectionStart properties of the TextBox.
|
|
|
|
|
I need two way communication between a Windows Service and my Windows Forms Application that will be running on many computers across a LAN.
The service will need to accept small but frequent ammounts of data from all the winforms apps simultaneously and to be able to send response messages back.
Would named pipes be the best solution?
|
|
|
|