|
Such as?...
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
But also, do I put the file into the solution explorer and then do the stuff? Isn't there a simple icon editor without the fuss?
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
Could you please give me an example of how it fits with a jpeg in the solution explorer? I found the using, I/O, but please help me understand.
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
The six lines of code I gave you, when executed, read an image file and create the corresponding icon file.
There are no mysteries involved, the trick is Image.Save knows how to create a simple icon file.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Write a small console program that calls the code that Luc gave you like so:
ImageToIcon( "c:\\icon.bmp" ); After you run this you should find a file called "icon.ico" in "C:\" which you can then use in your project.
|
|
|
|
|
I have an error with FileMode from that, and do I need the image in the solution explorer? Since it's converting, does it matter what kind of file it is?
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
What error are you getting? No, you do not need to add the image to your project. Just generate the icon from Paint.NET and save it some place. Then write a console program that calls Luc's function to save it as an icon. After the icon is generated you might want to add that ICO file to your project.
As for the source file format, as long as it is supported by GDI+ you should be fine. Stick to BMP/JPG/PNG/GIF and you shouldn't have a problem.
|
|
|
|
|
I see in usercontrol,we can create atributte to it
exam:
[Category("Data"), Description("Ten Cua Quan Co")]
public String TenQuanCo
{
get { return this.m_St_TenQuanCo; }
set { this.m_St_TenQuanCo = value; }
}
set { this.m_St_TenQuanCo = value; },this is a command line which we input from keyboad.
Right now, I want chose a String which I create before,the operation is same we choose a String in comboBox.
please repeate,I must type a String in atributte of usercontrol to get it
Right now,I don't type ,I want choose it from a String which I have created before like I chose in combobox
Please help me
|
|
|
|
|
I think I can speak for all of us if I say: "huh?"
(that is to say: Noone has answered so far probably because we can't understand your question. Try rephrasing it or ask someone with better knowledge of english for help...)
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Don't double post.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi,
I have an application (C#) which uses the standard resources in the System.Net library to fire off a WebRequest, pull down a web page, then extract some financial data on it : the data is read from the Response using standard StreamReader techniques. Resources are closed after being used.
The problem I am having is that when I have my app automatically checking every number of minutes the user specifies for updated data, it appears that my WebRequest IS NOT pulling down the latest data on the URL and is accessing some cached version.
My assumptions : using the standard facilities in the System.NET namespace/library is accessing core IE7 functionality. Yes, I have IE7 updated with all the latest security patches.
Using IE7 directly you can, of course, use control-F5 keys to force a refresh of the page.
Appreciate any feedback or ideas as to how to make sure I get the lastest data on the web page in question.
thanks !
Bill Woodruff
dotScience
Chiang Mai, Thailand
"The greater the social and cultural distances between people, the more magical the light that can spring from their contact." Milan Kundera in Testaments Trahis
|
|
|
|
|
You might want to take a look at WebRequest.CachePolicy . Here's a sample snippet from MSDN[^] that does absolutely no caching.
public static WebResponse GetResponseNoCache(Uri uri)
{
HttpRequestCachePolicy policy = new HttpRequestCachePolicy(HttpRequestCacheLevel.Default);
HttpWebRequest.DefaultCachePolicy = policy;
WebRequest request = WebRequest.Create(uri);
HttpRequestCachePolicy noCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);
request.CachePolicy = noCachePolicy;
WebResponse response = request.GetResponse();
Console.WriteLine("IsFromCache? {0}", response.IsFromCache);
return response;
}
|
|
|
|
|
Hi Gleat,
Thanks very much for that helpful response !
I'm going to be testing that this week.
best, Bill Woodruff
dotScience
Chiang Mai, Thailand
"The greater the social and cultural distances between people, the more magical the light that can spring from their contact." Milan Kundera in Testaments Trahis
|
|
|
|
|
How would I make a picturebox (pictureBox1 ) "jump"? I mean jump as have a timer move it up for a certain amount of time, and then bring it back down, and when it collides with the ground (a flat pictureBox, pictureBox2 ), the timer disables. I know it's confusing and I ask a lot of crap about this stuff, which all community is sick of, but if you ould answer this (Anyone!), I'd GREATLY appreciate it. THanks in advance.
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
You kind of already answered your question. For Windows Forms applications (as opposed to WPF or DirectX apps), you'd do something like put a Timer on your form. Set an event handler for the timer's Tick event. Inside that tick event, set the .Location of your picture box to a little higher than it was before, e.g.
myPictureBox.Location = new Point(myPictureBox.Location.X, myPictureBox.Location.Y - 1); If you're unsure how to do any of the stuff I mentioned, like setting up an event handler or putting a timer on your form, just ask specifically how to do something and we'll be glad to help.
|
|
|
|
|
Yeah, but it's not that that confused me. How would I make it come back down after it reached a certain point?
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
Figure out what your "certain point" is, then start adjusting it's direction downward. Something like this:
int certainPoint = 50;
bool hasReachedCertainPoint = false;
...
void MyTimerTickHandler(object sender, EventArgs e)
{
if (hasReachedCertainPoint == false)
{
myPictureBox.Location = new Point(myPictureBox.Location.X, myPictureBox.Location.Y - 1);
hasReachedCertainPoint = myPictureBox.Location.Y > certainPoint;
}
else
{
myPictureBox.Location = new Point(myPictureBox.Location.X, myPictureBox.Location.Y + 1);
}
}
|
|
|
|
|
Another thing you might want to look into is WPF. WPF (Windows Presentation Foundation) is the latest UI toolkit for building Windows programs. Inside it is some built-in support for animation, both 2d and 3d animation. Check out WindowsClient.net[^] for more information.
|
|
|
|
|
That's the problem. The Certain Point changes, and if I map out all of them, it would suck. A lot.
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
That's what variables are for - let the certainPoint change as much as it wants; each time your timer tick event fires, and the picture box moves, it will check to see if it's above the certain position and will start moving downward if it is. Does that help?
|
|
|
|
|
Kind of, but say you want the point to be 10 pixels above the box. Every time the box moves up, the point will STILL be 10 pixels up. I see what you mean, but do you see waht I mean? No offense.
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
I don't, sorry. Can you explain a bit more?
(p.s. I'm leaving for sabbath and won't be able to answer your question till Sat or Sun. Maybe the other good CPian folks can help you out in the meantime.)
|
|
|
|
|
I mean that if you just set that Certain Point to be 10 above the box, it will never make it to the point; the point will always be 10 above.
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|
|
When the box first moves, certainpoint will be 10. If you move the box up towards this point by 1 each time, decreament certainpoint by 1. So, if the box pos initially is 100, and certainpoint is 10 above this, the target turnaround point will be boxpos + certainpoint = 100 + 10. Move the box up by one. Boxpos = 101. Take one from CertainPoint : 101 + 9. And so on, until certainpoint is zero. Then negate the delta, and start adding to certainpoint again and mving the box down, until certainpoint is 10. I think...
|
|
|
|
|
How do you decrament an int? I tried this with a timer: --x;, but that just did it once. No every tick.
- "Achieving all knowledge does not mean achieving all wisdom."
- "What makes you smart
?"
|
|
|
|