|
how to store the image in folder and retrieve it and display it in picture box in stand alone application
|
|
|
|
|
You will have to embed the image into the applicaiton as an 'EmbeddedResource'. After which you can assign the image to a picturebox through reflection. To guide you in the right direction, look into the following class/method.
System.Reflection.Assembly.GetManifestedResourceStream("relative file stream, look up documentation")
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
|
|
|
You are welcome
|
|
|
|
|
Hi Everyone,
I am developing one windows application. In that application i'm using one webbrowser control to navigate web sites.I want to close that browser after some time.[Meaning I am accessing one web site after some idle time i want to redirect to login page.].
Thanks in advance.
Regards,
Raja Baireddy
|
|
|
|
|
Hi,
how about launching a System.Windows.Forms.Timer, and when it fires have it call myWebBrowser.Navigate()
to the page of your choice? (don't forget to stop the timer!)
|
|
|
|
|
Hi,
You are correct. for navigating purpose i'm doing same thing. whenever timer interval elapsed it will fire and it will redirect to login page.
It is redirecting to landing page. But still session is maintaing.
Suppose one user is logged into the site, Without logging out he left that one, after some time we are redirecting to index page.
There some other users can able to see his/her personal information.
[This problem is happening with the sites like codeproject.com
In codeproject.com they are using loginpage as well as welcome page is same.so that time it is giving problem for me.
]
Is there any way to kill that session information.
Regards,
Sekhar Reddy
|
|
|
|
|
I am unaware of any WebBrowser method that drops a session.
I would consider removing the WebBrowser and starting a new one.
|
|
|
|
|
I have tried to destroy the WebBrowser control and again i'm creating new instatnce of webbrowser. Still it is maintaing the session values.
|
|
|
|
|
I have an application which renders fonts in textboxes so the user can see what they look like. I then need to be able to delete that file. But when I try, I get an error because the file is locked.
I have figured out that if the textbox is never rendered to the screen, no lock occurs (so it's not the pfc or ff stuff, nor is the file read-only) (also, once I stop debugging, I can delete the file manually).
The Kicker: Only certain Fonts do this. bajoran.ttf gets this error, but TKDS9HOL.TTF does not.
Here is my code. Anybody have any ideas?
------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO; //manual add
using System.Drawing.Text; //manual add
namespace FontFileTest
{
public partial class Form1 : Form
{
string strFile = "bajoran.ttf";
//string strFile = "TKDS9HOL.TTF";
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
PrivateFontCollection pfc = new PrivateFontCollection();
pfc.AddFontFile(strFile);
FontFamily ff = pfc.Families[0];
txt.Text = "Sample";
txt.Font = new Font(ff.Name, 12, FontStyle.Regular);
txt.Visible = true; //remove this line, will not lock
ff.Dispose(); //irrelevant
pfc.Dispose(); //irrelevant
}
private void btnDelete_Click(object sender, EventArgs e)
{
//extra stuff to try--irrelevant
txt.Font = new Font("System", 12, FontStyle.Regular);
txt.Dispose();
Application.DoEvents();
this.Refresh();
try
{
File.Delete(strFile);
}
catch (Exception exp)
{
MessageBox.Show(exp.Message);
return;
}
lblStatus.Text = "Deleted";
}
}
}
|
|
|
|
|
Umm, this might be a stupid answer, but are you sure that case-sensativity can't be causing that bug..?
|
|
|
|
|
I did actually think of that (and tried some stuff), but no, that did not make a difference.
|
|
|
|
|
Run the app as administrator? Make sure you have delete privs on that file?
|
|
|
|
|
The file is probably in use, and you can't delete things that you're still using.
Keep an array of filenames that you wish to "delete", and delete them when you're done using them (on program close?)
I are troll
|
|
|
|
|
Well, I figured out a way around it, if anyone else encounters this. Using a PictureBox and graphics.DrawString (instead of a TextBox) does the trick. The code below was cut from different methods & some stuff taken out, so it may be incomplete, but you should get the picture.
Graphics g;<br />
Bitmap bm;<br />
StringFormat sf = new StringFormat();<br />
PrivateFontCollection pfc = new PrivateFontCollection();<br />
pfc.AddFontFile(strFile);<br />
FontFamily ff = pfc.Families[0];<br />
<br />
f = new Font(ff.Name, 12, FontStyle.Regular);
PictureBox pb = new PictureBox();<br />
pb.Width = 280;<br />
pb.Height = f.Height + 4;<br />
pb.BackColor = Color.White;<br />
pb.BorderStyle = BorderStyle.FixedSingle;<br />
<br />
bm = new Bitmap(pb.Width, pb.Height);<br />
g = Graphics.FromImage(bm);<br />
g.TextRenderingHint = TextRenderingHint.AntiAlias;
g.DrawString(ff.Name, f, Brushes.Black, 0, 2, sf);
<br />
f.Dispose();<br />
pb.BackgroundImage = bm;<br />
<br />
|
|
|
|
|
i need to disable ctrl,shift,tab,windows key
is there any coding to disable them and enable them
plz help me
|
|
|
|
|
You can use windows hook for that. There are several articles here at codeproject that show how to use them.
|
|
|
|
|
He was already answered Here,[^] I assume he just want's code[^] written for him to do his task, but he won't bother to read[^] anything of value to help him out.
|
|
|
|
|
hi,
As i m developing cyber cafe software so when user logout from pc need to close all program,as like user may working on internet explorer as time over it need to close automatically.
so i need to close all application after time is over.
i need it through coding in vb.net.
|
|
|
|
|
Use Process class provided by .Net Framework.
|
|
|
|
|
hi,
i have an mdi container that forms are opened inside a panel.
is it possible that if an mdi child generated a message box, this message box will belong to the opening form and hence i can open another form and continue working.
because now when a form generated an error i can not click on any area in my application. thanks
|
|
|
|
|
Well, one option is to create your own version of a MessagBox using a simple Form.
|
|
|
|
|