|
You're welcome. Interfaces aren't all bad though..
Personally I would restrict a type as much as possible (with as context, the rest of the program) unless the code is meant to be used be other people/programs
|
|
|
|
|
I'm actually working on some base classes that are going to form the data objects for a fairly hefty set of scenarios. They are used throughout our systems and need to be extensible in some situations and tied down in others (Wcf DataContracts for instance).
I've tried staying on one side of the road (Interfaces/Abstract Class) but I'm now experimenting with a little of both where appropriate.
|
|
|
|
|
If the abstract base class had just a getter, it wouldn't break the contract or the Liskov substitution principle, yet it still won't compile. C# doesn't support covariance of return types on overridden members.
|
|
|
|
|
I've got a real head scratcher here. One of my dialogs the text displayed at runtime begins one pixel farther to the left than at design time, and some spaces are 1 pixel wider at run time. I initially noticed this when the effect caused text to wrap differently.
When I created a new test form in the same project and copied the interface components into it, the problem persisted. When I created a new solution and copied the offending forms source into the new solution the problem went away.
This is happening in VS2k8. The solution it's occurring in was originally created in 2k3 and then converted to the new version.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
I remember reading an article somewhere (can't find a reference at the moment) about this sort of thing. IIRC it is caused by either the designer using GDI+ and the run-time using GDI, or vice versa.
This may not be the cause in your case, but perhaps if you root around using the above info, you might be able to resolve the problem, or discount it anyway. I'll continue racking my brain, and if I remember the source, I'll come back.
[Edit]
Brain finally started working.
Look at this[^].
Lots of other goodies from googling 'text alignment gdi vs gdiplus'
Good luck!
[/Edit]
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Interesting and that did send me down the right path. In the properties viewer under Behavior is an option called UseCompatableTextRendering . The description of it is "Specifies whether text rendering should be compatible with previous releases of Windows Forms. Setting it to true changes the rendering in the designer to match what's used in the original application in either case. Changing it in my new app (same form code) causes both the design and runtime rendering to be changed.
This strongly implies that there's a setting at the project/solution level that's overruling the designer and forcing legacy rendering in either case.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
<blockquote class="FQ"><div class="FQA">dan neely wrote:</div>This strongly implies that there's a setting at the project/solution level that's overruling the designer and forcing legacy rendering in either case. </blockquote>
and there is: To use the new rendering call: Application.SetCompatibleTextRenderingDefault(false).
http://blogs.msdn.com/jfoscoding/archive/2005/10/13/480632.aspx[^]
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Hi,
i used hl7 to xml converter article, it returns a xml document as a string.
can i get it as a document itself, how? how can i read the xml document and populate my database?
|
|
|
|
|
Did you think to ask the person who wrote the article ? You can read the XML document using the XMLDocument class.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
how to create PC to PC call, give me idea, i searched in google, but i dint find any thing.
yogesh
|
|
|
|
|
I believe you are looking for skype. I am sure their is a programming SDK that you are able to use to target the service.
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
|
|
|
|
|
Thomas Stockwell wrote: I believe you are looking for skype
Ah, you assumed his use of the word "call" means a telephone call. I would never thought of that.
|
|
|
|
|
yogesh_softworld123 wrote: i searched in google, but i dint find any thing.
start here[^]
|
|
|
|
|
Is it possible to shut down a computer by programming a micro controller that is external to the computer?
|
|
|
|
|
Jerome Crooks wrote: Is it possible to shut down a computer by programming a micro controller that is external to the computer?
Sure. Just have the micro controller set off a large enough ordnance for the distance and the size of the target, should be no problem.
|
|
|
|
|
Why not?
But why would you even do that? You don't need an external micro controller
|
|
|
|
|
I am doing a school project where we have to build a device with a microcontroller inside that will have different tasks. The device will be sending and receiving info wirelessly to a PC and one of the objectives of the project is for the device to be able to shutdown the computer. I am not much of a programmer but i have other group members who are. What is an ordnance? Is this my only option? Is there any code involved?
|
|
|
|
|
Jerome Crooks wrote: What is an ordnance?
A weapon. Your question was vague and so you got a joke answer.
You can turn off a computer by running code, you could look at the mother board to see if there's a jumper you can wire up to, and connect to shut down. It's kind of a hardware question, not a programming one really. ( that is, if you want to turn off a computer via another device, and not in a program on the computer, then it becomes a hardware question )
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Christian Graus wrote: you could look at the mother board to see if there's a jumper you can wire up to, and connect to shut down.
I've never seen a jumper to do this, some enthusiast mobos do have onboard power/reset switches that could be manually pressed/pressed by a hardware device.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Hi,
you could set up one function key to execute the DOS shutdown command, and build your own USB keyboard emulator that emits the right function key code when you want the shutdown to occur.
|
|
|
|
|
I found these examples[^] to cause many a sleepless night
You can bluntly take the power of the computer, but I guess that you are looking for a method to send a signal to the computer and to shut it down "the friendly way".
I are troll
|
|
|
|
|
I don't know about an external micro-controller, but you could do something like this:
uchar reset = 0;
do
{
reset = inportb(0x64);
if(reset & 1)
inportb(0x60);
} while (reset & 2)
outportb(0x64, 0xFE);
That'll pulse the keyboard reset line. It should be rather simple from there to translate it into assembly code and encode it into the micro-controller
|
|
|
|
|
I'm sure there's an API call to shut down the computer gracefully as if you clicked shut down yourself.
You could call that from C# code using PInvoke.
Interfacing a uC to a computer is reasonably easy via serial or parallel ports, marginally more difficult via USB - I've never tried a wireless port.
There's no reason why a uC can't talk to your C# app via one of these ports which in turn shuts the PC down.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
I am also an electronics and communication engg.
One thing you can do is create a small windows service which scans your serial port where microcontroller is connected. and whenever your controller sends some specific serial data, you can run a C# code to shut down your PC..
This might work.
|
|
|
|
|
And in that service you can execute a small line of code...
System.Diagnostics.Process.Start("Shutdown", "-s -t 01");
this will shut down the computer . ..
|
|
|
|