|
Hi,
if you have a "TVCard" class in C#, it should probably not be concerned by GUI stuff at all;
but it might offer a "Station" property getting/setting the current station selected.
Then an app using the TVCard class could periodically read and display the Station property
using the right thread, and based on its own requirements.
Alternatively, but I dont like this as much, the TVCard class could offer an event that
periodically reports the Station setting; then the app can subscribe to that event,
and must itself take care of the threading issues. The reason I dont like this that much
is that now the TVCard is deciding on how often something happens in the app, normally
the app is in charge !
Of course you could give the TVCard an Interval property as well,
so it really starts to look like a timer.
And yes, you could teach your TVCard to always raise the event on the GUI thread too,
but that would not be needed when an app wants to know but not display the Station setting,
therefore it should not be included in the TVCard ("separation of concerns").
So I would stick with the simple Station propery and let the app do timing and GUI stuff.
|
|
|
|
|
-So I would stick with the simple Station propery and let the app do timing and GUI stuff-
I think its a clean solution!
Thank you very much
pusch
|
|
|
|
|
The System.Timers.Timer has a SynchronizingObject[^] property. This can be used to make sure that the timer callback function is called on a specific thread.
Maybe this will help . . .
|
|
|
|
|
this is what I was looking for!
May be it is not the best solution for my posted question, but its exactly what I had in mind.
Thanks a lot.
regards
pusch
|
|
|
|
|
Hi,
I have written simple code in click event of button as below
MessageBox.Show("HI");
When I run the application, I got the blank messagebox means it doesn't have the message text "HI" and also doesn't display OK messagebox button. Anybody have any idea. Please guide. Any type of help is appreciated.
Himanshu Batavia
|
|
|
|
|
You only need to post your question once. Someone will answer eventually.
Your code should look something like this
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("Hello");
}
I would seriously suggest buying a book and working through it to get started in programming before looking for help online. Learn the basics first.
I think I'm going to call my next project "Chuck Norris". It's a sure way to guarantee it's unbreakable.
• • •
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
|
|
|
|
|
|
Hello
I have written simple code like this :
MessageBox.Show("Hello");
in click event of Button1. But when I run the program and click on Button1, I get the messagebox but having no output means I don't get "Hello" text and also don't get OK messagebox button. Why it is so? Any type of help is appreciated
Himanshu Batavia
|
|
|
|
|
Sounds like your code isn't working right. Are you certain the button1.Click event is setup to be handled by your handler function? You should show us the appropriate code.
|
|
|
|
|
I want to know image dimension but I can't use Image.FromFile method to load image file because it is very slow and I want get image dimention quickly.
my image file format is JPEG
i will thank every one help me
(excuse me i can't speak english correctly)
|
|
|
|
|
You will need to read the header information from the file then. This link[^] takes you to the specification. Be aware though that there are *many* different versions of JPEG, so you will need to test this thoroughly.
|
|
|
|
|
thank you a lot.
but this site does not offer any C# code and I can't find image dimension obviously in it's jpeg header format.
thank you again.
if any one have more simple answer please send it. thank you again.
|
|
|
|
|
I answered this question a couple of days ago right here.[^]
|
|
|
|
|
thank you very much .
can i trust it completely that it work correctly in any jpeg file?
thank you again.
|
|
|
|
|
Only if you test it to death.
|
|
|
|
|
i dont understand what you say?
|
|
|
|
|
What's not to understand??!! The only way YOU can "trust" any code you use is if YOU exhaustively test it!
|
|
|
|
|
The site isn't intended to show you C# code. It's the jpeg format only.
What you need to do is read in the file, a byte at a time until you read in the Xdensity and Ydensity bytes (each of which is two bytes). If you read in the first 18 bytes, the 14th will tell you the JPEG unit, the next two will be the X density and the last two will be the Y density.
|
|
|
|
|
thank you .
but can you offer a formula between density and unit that result in the height and width in pixel.
if you do it i will thank you very much
|
|
|
|
|
Well, according to the link. If units is zero then Xdensity and Ydensity are already in pixels.
If it is 1 or 2 it is in dots per inch or cm respectively. You will then need to find out the dots per inch/cm on the output device and scale appropriately.
For example, if the image is a photo at 300dpi and it is to be displayed on a screen at 96dpi then you need to reduce the number of pixels by source/destination or 300/96 (3.125)
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
thank you very much .
|
|
|
|
|
it does not give me the height and width in pixel yet.
i want only height and width. unit and density does not help me
thank you again.
|
|
|
|
|
Hi,
I want to save the images into Access database in C#. Please give ne the sample piece of code if you have or give me the related links.
Thanks in Advance,
AR Reddy
|
|
|
|
|
Hi,
to save images in access first transform them in bytes and then insert them in access.
|
|
|
|
|
There's a bazillion examples out on the web. All you have to do is Google for "C# save image access database".
|
|
|
|