|
Bitmap bmp = (Bitmap)resources.GetObject("myBMP.bmp");
IntPtr Hicon = bmp.GetHicon();
Icon newIcon = Icon.FromHandle(Hicon);
This code here can change ur icon at run time.
instead of the first ;line try getting the bmp image from file
as for replacing the app.ico well I dont know...
|
|
|
|
|
can you please tell me what this 'resources' is- in first line?
The error i get with this code is:
"The type or namespace name 'resources' could not be found (are you missing a using directive or an assembly reference?)"
|
|
|
|
|
well lets just forget what that resources was here.
Im giving u this actual function that I wrote.
public static void change_Icon(string iconName, System.Windows.Forms.Form This)
{
try
{
//MessageBox.Show(Environment.CurrentDirectory);
string c = Environment.CurrentDirectory;
//MessageBox.Show(c + "\n" + c.IndexOf("ATech").ToString() + "\n " + c.Substring(0, (c.IndexOf("ATech") + 6)).ToString());
string path = c.Substring(0, (c.IndexOf("ATech") + 6)) + @"Resources\Icons\" + iconName;
Bitmap bmp = new Bitmap(Image.FromFile(path));
IntPtr Hicon = bmp.GetHicon();
Icon newIcon = Icon.FromHandle(Hicon);
This.Icon = newIcon;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
well in this I'm just making out the correct path to the resources folder. 'Atech ' is the name of tyhe project and its main directory. The actual images were stored in ......\Atech\Resources\icons folder so I had to get them from there. tell me if u get hold of this code. I think its pretty straight forward.
hope it helps
Rocky
|
|
|
|
|
is very simple only you need keep in a loop for instance this:
System .Drawing .Icon nuevo=new Icon (@"D:\MyIconNow.ico");
Random manual=new Random ();
int p = manual.Next (2);
if (p == 1)
base.Icon=nuevo;
else
base.Icon=null;
of course, the loop is'nt the only way too keep that atach in execution, try with delegate...
if you wanna know anything write me
|
|
|
|
|
what is the size of string builder in .net.
how long a string can contain a string builder in c#.net.
thanks in advance.
|
|
|
|
|
The only limit to the string size in StringBuilder is the amount of memory you can physically allocate.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi all,
I want my program written in c# to be able to recieve commands from winLIRC but have no idea how to set up a connection with the winLIRC server running on my computer. Any help will be appreciated. Thanx in advance.
|
|
|
|
|
You can connect to the WinLIRC server using a simple TCP/IP connection. If started the same thing some time ago and back then there was a side on the WinLIRC or LIRC homepage that described how to connect to the server (basically named the port number) and the message format.
If you're interested, you can give me your mail address and I will send you the code If got so far. If I recall right, I was able to successfully connect to the server and receive messages but the connection was somehow unstable.
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi everyone,
I created an ArrayList and put Button objects in it.But when i try to reach one of the arraylist elements compiler (VS 2005) gives error and says that 'object' does not a definition for it.
For example:
ArrayList myButtons = new ArrayList();
Button button10 = new Button();
myButtons[0].Text = "something";
Error : 'object' does not contain a definition for 'Text'
Any suggestions?
|
|
|
|
|
Arraylist contains objects , you need to cast it ...
((Button)myButtons[0]).Text = "something";
hope this helps...
V.
If I don't see you in this world, I'll see you in the next one... And don't be late. (Jimi Hendrix)
|
|
|
|
|
It has ABSOLUTELY helped. thanks
|
|
|
|
|
If you are using VS2005 and therefore .NET 2 you should be using a List<>
<br />
List<Button> myButtons = new List()<Button>;<br />
myButtons.Add(new Button());<br />
myButtons[0].Text = "Something";
|
|
|
|
|
Hi
How to run an Dotnet Application in the system which donot have dotnet framework installed.
Reply soon.
Thanks & Regards,
Hari
|
|
|
|
|
can't
V.
If I don't see you in this world, I'll see you in the next one... And don't be late. (Jimi Hendrix)
|
|
|
|
|
For running dotnet applications, dotnet framework has to be installed which is one of the basic requirement.
Raja Raman S
Reuters India Pvt.Ltd.
Bangalore
|
|
|
|
|
Not possible in windows apps / services , only way is u write a asp.net web application, and host it in a web server that has .Net framework, access your web application from any client machine that has a Internet explorer browser!
Karam C Bose
|
|
|
|
|
Mono..(not technically .NET framework )
|
|
|
|
|
I want to display a picture <full screen="" size=""> and play a sound < .wav or .mp3 format > with the use of DirectX 9.0. How I going to do this?..
Plz help....
|
|
|
|
|
Download DirectX, and then take a look at some of the samples. Alternatively, Google for DirectX samples. These are such large areas, that you aren't going to get help on the forums. You will have to do some digging/learning yourself.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
hai
pls need help, iam newbie to the .net, working on wildacard search, iam using *, ? but ? is not working properly, my code is
private string BuildFilter()
{
string filter = "1=1";
foreach (string key in filters.AllKeys)
{
filter += String.Format(" and {0} like '{1}*'",
key,filters[key].Replace("'", "''"));
}
foreach (string key in exactFilters.AllKeys)
{
filter += String.Format(" and {0}='{1}'", key, exactFilters[key].Replace("'", "''"));
filter += String.Format(" and {0}='{1}'", key, exactFilters[key].StartsWith("'"));
}
foreach (string s in exactFilters.AllKeys)
{
filter += WildCardSearch.Match(Text, s);
filter += String.Format(" and {0}='{1}'", s,exactFilters[s].Replace("'", "''"));
filter += String.Format(" and {0}='{1}'", s, exactFilters[s].IndexOfAny(Wildcards));
}
return filter;
}
can anyone help me what i ahve done wrong.
|
|
|
|
|
I've a form filled up with a tabcontrol.
Is it possible to place a control (any) that it will be common to every tabpage?
When I try to add a control directly to tabcontrol I get a error (only tabpages can be added to tabcontrol!). When I add a control to a tabpage I'm not capable to make it available on every tabpage anymore...
Anyone can help? Thanks in advanced.
|
|
|
|
|
It is imposible to add a control to a tab control. It only takes tabPages so you should add a copies of the control to all the tabPages.
good luck
|
|
|
|
|
If u dont want to rewrite code, you can place the control / controls in a panel and add the panel to each tabpag during runtime.
Ex: let me have a set of controls and functionality in a panel and this panel is available in form say frmReUseForm. and panels name is panel1 (make the panel public)
in my form that contains the tabcontrol with tab pages,
i write the following code, may be in constructor ,
frmReUseForm obj = new frmReUseForm();
tabpage1.Controls.Add(obj.panel1);
tabpage2.Controls.Add(obj.panel1);
tabpage3.Controls.Add(obj.panel1);
tabpage4.Controls.Add(obj.panel1);
hope this helped you,
thanks.
live and let live
|
|
|
|
|
I am not the one who posted the question so u should direct your reply to the poster not to me
Thanks anyway
|
|
|
|
|
One small mistake, please add the panel to the tabpage on the paint event of each tabpage
private void tabPage1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
tabPage1.Controls.Add(obj.panel1);
}
private void tabPage2_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
tabPage2.Controls.Add(obj.panel1);
}
|
|
|
|