|
Image.FromFile() generates a real Image and locks the file so it can still get at the metadata available through GetPropertyItem().
Image.FromStream() generates a real Image and no longer needs the stream; you can do to the stream whatever you like, the image couldn't care less.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
hi,i need to use a telephone component for my application,such as answering machin or ...
some friend adviced me kdtele component ,but i dont know how to use them
if any body knows please help me
thanx
|
|
|
|
|
Try here[^]
only two letters away from being an asset
|
|
|
|
|
|
This is probably pretty simple, but I'm a bit unsure of how to approach this. I have a path to a particular bmp file in my C# code. I want to display this picture in my HTML page. How would I pass this path to the HTML code instead of hardcoding the path?
C#:
string filePath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\temp.bmp";
HTML (hard coded at the moment):
<img src="C:\\Users\\L****\\AppData\\Local\\Program\\temp.bmp" alt="Graph"/>
|
|
|
|
|
You can do this either in the code behind img.src = filePath or in the page <img src=<%=filePath%>
only two letters away from being an asset
|
|
|
|
|
I'm still a bit confused since I haven't worked with this before.
The path: string filePath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\temp.bmp"; is located in ChartContainer.ScreenShotWin.
From what you wrote, I would assume I would make these changes to my hardcoded html file, but this is not solving passing filePath. File '<%=filePath%>' was not found.
<%@ Language="C#" Inherits="ChartContainer.ScreenShotWin" %>
<html>
<head>
<title></title>
</head>
<body>
<img src=<%=filePath%> alt="Graph"/>
</body>
</html>
What am I still misunderstanding? Thank you!
|
|
|
|
|
I suggest you modify your img tag to make it a server-side tag, and modify it's src property somewhere in the loading stages of your form.
<img runat="server" id="graphImage" alt="Graph" />
And in your code, possibly in your Form_Load method, you would assign the value to it.
string filePath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\temp.bmp";
graphImage.Src = filePath;
Adam Maras | Software Developer
Microsoft Certified Professional Developer
|
|
|
|
|
What type would graphImage.Src be defined as within my c# code?
My code needs to save a picture to a local folder, navigate to an html file via webbrowser offscreen displaying said prior saved photo (by accessing it via the local folder path which I want to pass to it), take an offscreen screenshot, and save to file. In the end certain bits of data will also need to be created at runtime and displayed on the webbrowser for the screenshot. They want an image report. I guess I better start reading up on ASP.
Everything else works fine except for accessing the picture in html without hardcoding it because I still am a bit in the dark about how this is passing the pathway to the image at runtime.
<%@ Language="C#" Inherits="ChartContainer.ScreenShotWin" %>
<html>
<head>
<title></title>
</head>
<body>
<img alt="Missing Graph" runat="server" id="graphImage" />
blah blah blah...
private void ScreenShotWin_Load(object sender, EventArgs e)
{
filePath = Environment.GetFolderPat(Environment.SpecialFolder.LocalApplicationData) + "\\temp.bmp";
webBrowser1.Navigate("C:\\Projects\\HTMLReport.htm");
System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
t.Interval = 1000;
t.Tick += new EventHandler(t_Tick);
t.Start();
}
|
|
|
|
|
Good morning all.
I am coming up with an error: Cross-thread operation not valid. Attempted to access from a thread other than the thread it was created on.
My code:
private void btnSubmit_Click(object sender, EventArgs e)
{
if (tbRACFID.Text == string.Empty)
{
MessageBox.Show("You must have a RACFID in order to continue.", "RACFID Field Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
ff.ControlSetFocus(tbRACFID);
return;
}
if (tbUserName.Text == string.Empty)
{
MessageBox.Show("You must have a User Name in order to continue.", "User Name Field Validation", MessageBoxButtons.OK, MessageBoxIcon.Stop);
ff.ControlSetFocus(tbUserName);
return;
}
PwdSecurity p = new PwdSecurity();
uipc = this.Parent as UIPCMainForm;
string strContainer = cbEndUserDepart.SelectedValue.ToString() + tbRACFID.Text.ToLower();
DAL d = new DAL(uipc.StrUserName, p.base64Decode(uipc.StrPassword));
this.backgroundWorker1.RunWorkerAsync();
btnReset.PerformClick();
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
PwdSecurity p = new PwdSecurity();
uipc = this.Parent as UIPCMainForm;
string strContainer = cbEndUserDepart.SelectedValue.ToString() + tbRACFID.Text.ToLower();
DAL d = new DAL(uipc.StrUserName, p.base64Decode(uipc.StrPassword));
BackgroundWorker worker = (BackgroundWorker)sender;
string SubnetIPAddress = string.Empty;
DataSet ds = new DataSet();
ds = d.FillDropDowns(4);
foreach (DataRow dr in ds.Tables[0].Rows)
{
if (
dr["ROUTR_TYPE"].ToString() == cbRouter.Text &&
dr["LOC"].ToString() == cbLocation.SelectedValue.ToString())
{
SubnetIPAddress = dr["SUBNT_IPADR"].ToString();
}
}
d.importContainer(
strContainer,
tbUserName.Text,
cbRouter.SelectedValue.ToString(),
(int)arSubNetList[cbSubnet.SelectedIndex],
cbSubnet.SelectedValue.ToString(),
arDHCPOptionList[cbLocation.SelectedIndex].ToString(),
arDHCPPolicyList[cbLocation.SelectedIndex].ToString(),
SubnetIPAddress,
arAllocationTemplateList[cbSubnet.SelectedIndex].ToString()
);
}
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
this.tsProgBar.Value = e.ProgressPercentage;
this.tslStatus.Text = e.UserState as string;
}
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
this.tslStatus.Text = "Operation complete";
}
Any ideas? I saw something online about Invoke. Thank you, WHEELS
|
|
|
|
|
Hi,
Here[^] is the full description of your problem.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
but isnt the purpose of backgroundworker that u dont need to explicitly invoke the controls?
if i call worker.ReportProgress i dont need to invoke the controls and they are updated without cross threading exceptions!
i might have missed but idont see you calling worker.ReportProgress from your worker_DoWork method?
modified on Tuesday, August 4, 2009 11:37 AM
|
|
|
|
|
Two of the BGW events are handled on the main thread; and obviously DoWork is not, otherwise nothing would be going on in the background.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
|
Hello Forum
When you call Form.Close() the form actually closes but in fact it is still lives in memory, i need to make sure that when i close a form the from is dead and nothing is being executed any more on this form, is the way to achieve this by invoking the GC.Collect() or there is another way.
Please help
Thank You
|
|
|
|
|
there is no other way!
but you need not call GC.Collect(), the system does it regularly when it's idle and memory is low (or other propitious condition)
however, for testing / debugging purpose, it's good to call GC.Collect() and the use some kind of memory profiler to see if some unexpected object stays in memory.
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Hi,
a Form doesn't do anything, neither do any other .NET object.
The only things that do something are Windows timers, Windows events and Windows threads.
So if your Form did launch a timer or a thread (incl. BackgroundWorkers and asynchronous I/O operations) you should make sure they come to a halt; having the Form collected is both unnecessary and insufficient.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
right, i had some timer's and upon closing i stoped them, but i was wonderig if thre is a way with one command stop them all, this is why i was going in this direction.
Thanks for your help
|
|
|
|
|
Write the timer stop code in Form's dispose method. Also consider using background threads to do the processing. Background threads will terminate when the parent thread terminates.
|
|
|
|
|
great idea
thanks
|
|
|
|
|
I can add text, data values from the database into a word file through the C# coding. I want to know how to insert an image in the word file through c# coding?Plz help urgently!!!!
csetopper_bhanu
|
|
|
|
|
Hi,
Please let me know the difference b/w abstract and Interface...with example...
im confused......
|
|
|
|
|
|
Hello all ,
I have couple of questions .
1.why do we need to call forcibly Garbage Collector when we dont know which object is going to be destroyed ? I mean i would like to know the scenarios where exactly we need this .
2. i have requirement that i need a custom class in which i can destroy the class when needed. is it possible ? if yes can u lease give me code to do it .
3. How can i say this resource is Unmanaged and this one is managed ?
Apologises incase of trouble.
Regards,
Jaddu
|
|
|
|
|
1) One scenerio would be an application that creates several temporary objects that need to be cleaned up occasionally during the apps lifetime to prevent memory leaks and performance degradation. A graphics editor could be an example.
2) Use the Dispose pattern[^]
3) Start here[^]
only two letters away from being an asset
|
|
|
|