Search Results

Search found 9 results on 1 pages for 'zaidwaqi'.

Page 1/1 | 1 

  • Load thumbnail image into PictureBox from directory

    - by zaidwaqi
    Hi, I use the following code to get thumbnail of image in Resources, and display on Picturebox. Image tmp = (System.Drawing.Image)myManager.GetObject(tempImage); cfgPassPicture[m].Image = tmp.GetThumbnailImage(40, 40, new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), System.IntPtr.Zero); How do I do this for images in directory (instead of resources), given only the URL? I can load image into PictureBox via ImageLocation property, but not sure how to use Image property of PictureBox for this. Thanks

    Read the article

  • Using Timer only once

    - by zaidwaqi
    Hi, I want to use a timer only once, at 1 second after the initialization of my main form. I thought the following would have a message box saying "Hello World" just once, but actually a new message box says "Hello World" every one second. Why so? I had put t.Stop() in the tick event. Also, do I need to dispose the timer somehow to avoid memory leakage? Timer t = new Timer(); t.Interval = 1000; t.Tick += delegate(System.Object o, System.EventArgs e) { MessageBox.Show("Hello World"); t.Stop(); }; t.Start(); Please help and show if there is a better way of doing this? Thanks.

    Read the article

  • A program that creates another program

    - by zaidwaqi
    Hi, I need to create a program that creates another program but not a compiler though. For example, I write a program that accepts a string input from the user. Let's say user enter "Pluto". This program should then create a separate .exe that says "Hello Pluto" when executed. How can I do this? If you could give example in C# and Windows Forms, it's better. Thanks.

    Read the article

  • Problematic comboBox Windows Forms

    - by zaidwaqi
    Hi, I use VS2008 C# + Windows Forms. I can't understand why comboBox does not behave the way it should. In Design mode, I added a comboBox to my form, and edit Items to add "A" and "B". Double-clicking brings me to SelectedIndexChanged event, which I edit to display the selected text with MessageBox. private void comboBoxImageSet_SelectedIndexChanged(object sender, EventArgs e) { MessageBox.Show(comboBoxImageSet.SelectedText); } When I run, and select "A" or "B" in the comboBox, the MessageBox appears, but nothing is written. Why? Thanks.

    Read the article

  • Release resources in .Net C#

    - by zaidwaqi
    Hi, I'm new to C# and .NET, ,and have been reading around about it. I need to know why and when do I need to release resources? Doesn't the garbage collector take care of everything? When do I need to implement IDisposable, and how is it different from destructor in C++? Also, if my program is rather small i.e. a screensaver, do I need to care about releasing resources? Thanks.

    Read the article

  • Function to register functions to be called if event invoked.

    - by zaidwaqi
    Hi, I have a Panel which contains 20 PictureBox controls. If a user clicks on any of the controls, I want a method within the Panel to be called. How do I do this? public class MyPanel : Panel { public MyPanel() { for(int i = 0; i < 20; i++) { Controls.Add(new PictureBox()); } } // DOESN'T WORK. // function to register functions to be called if the pictureboxes are clicked. public void RegisterFunction( <function pointer> func ) { foreach ( Control c in Controls ) { c.Click += new EventHandler( func ); } } } How do I implement RegisterFunction()? Also, if there are cool C# features that can make the code more elegant, please share. Thanks.

    Read the article

  • How to save enum settings in Visual Studio project properties?

    - by zaidwaqi
    Hi, In the Settings tab in Visual Studio, I can see Name, Type, Scope, Value table. Define settings is intuitive if the data type is already within the Type drop-down list i.e. integer, string, long etc. But I can't find enum anywhere. How do I save enum settings then? For now, I have the following which clutter my code too much. public enum Action { LOCK = 9, FORCED_LOGOFF = 12, SHUTDOWN = 14, REBOOT, LOGOFF = FORCED_LOGOFF }; and I define Action as int in the setting. Then I have to do, switch (Properties.Settings.Default.Action) { case 9: SetAction(Action.LOCK); break; case 12: SetAction(Action.FORCED_LOGOFF); break; case 14: SetAction(Action.SHUTDOWN); break; case 15: SetAction(Action.REBOOT); break; default: SetAction(Action.LOCK); break; } Would be nice if I could simply do something like SetAction(Properties.Settings.Default.Action); to replace all above but I dont know how to save enum in setting. Hope my question is clear. Thanks.

    Read the article

  • Change Image in Resources at Runtime

    - by zaidwaqi
    Hi, My understanding of Resources is that I can combine resources i.e. images and my program into single executable. Let's say I have image pic1.png and I put it into Resource of my project, and is accessible with Properties.Resource.pic1. For example, PictureBox pb = new PictureBox(); pb.Image = Properties.Resource.pic1; What I want to do is for that my program will be able to replace this image at runtime. For example, my program runs, and locate newPicture.png, and use this new image to replace pic1.png that was originally used. Maybe my question is better reworded as "Can I include new image into Resources at runtime?" Please help. Thanks.

    Read the article

  • Method to register method to be called when event is raised

    - by zaidwaqi
    I have a Panel which contains 20 PictureBox controls. If a user clicks on any of the controls, I want a method within the Panel to be called. How do I do this? public class MyPanel : Panel { public MyPanel() { for(int i = 0; i < 20; i++) { Controls.Add(new PictureBox()); } } // DOESN'T WORK. // function to register functions to be called if the pictureboxes are clicked. public void RegisterFunction( <function pointer> func ) { foreach ( Control c in Controls ) { c.Click += new EventHandler( func ); } } } How do I implement RegisterFunction()? Also, if there are cool C# features that can make the code more elegant, please share.

    Read the article

1