|
when are all over worn/overused, maybe? idontknow.
|
|
|
|
|
any idea on how can be achieved this high level of programming stuff?
Any simple example --rudimentary-- like a snippet ?
What i manage to create until now: But is a UserControl extension.
public partial class Car : UserControl
{
public Car()
{
InitializeComponent();
CarLoad();
}
public void CarLoad()
{
Life = 50;
Wheels = 4;
PaintColor = BackColor = Color.Aqua;
this.Size = new Size(20, 20);
}
[DefaultValue(50)]
[Description("...")]
public int Life { set; get; }
[DefaultValue(4)]
public int Wheels { set; get; }
[DefaultValue(typeof(Color), "Aqua ")]
public Color PaintColor { set; get; }
|
|
|
|
|
What you are describing is an object not a control. A control implies that it is a user interface element whereas an object has a bunch of properties and events.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
But i want to see it in my controls list(also). (Like a derivation from UserControl one)
in [Objects Components] control list panel.
|
|
|
|
|
So basically you want to rewrite all the infrastructure that UserControl puts in place for hosting in Visual Studio, on the designer, display at runtime, etc? Have I got that correct?
Well, one of the first problems you're going to face getting an answer is that you haven't specified which platform this is for. Is it WinForms? WPF? Silverlight? ASP.NET?
|
|
|
|
|
YES You got that right.
And is for WinForm.(i'll edit my original post) thanks and sorry for omitting it.
|
|
|
|
|
Okay, well if I were you then, I would start by looking to inherit from ContainerControl (that's what UserControl inherits from). Then, you need to evaluate whether or not you need the features that you get specifically from the UserControl (e.g. Border).
|
|
|
|
|
Ok, and if i choose from Control to inherit(it's easier), then how I hide the rest of the properties showing in my Properties window?
|
|
|
|
|
Take a look at the inheritance hierarchy for System.Windows.Forms.Timer [^]. Now look at each upper level class, that should give you an idea of the amount of work ahead of you.
Veni, vidi, abiit domum
|
|
|
|
|
Inherit from Control[^]; that's the correct base-class to inherit from when visualizing things. For non-visual components inherit from Component[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Ok, and if i choose from Control to inherit(it's easier), then how I hide the rest of the properties showing in my Properties window?
|
|
|
|
|
You don't; they're inherited and required for the correct working of a control. Without them, you can't call it a control. You can hide properties using a hack, but that's all it is - a hack. It doesn't mean that the properties aren't accessible.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
then, yes, i'm very interested on it- can you give me an example on how to do it?
Please, and thanks.
|
|
|
|
|
|
Eddy is right. If you want to build a control from scratch you inherit from either Control or Component.
UserControl is normally used when you want to build a new control from a mash up of other controls, like a button and textbox.
|
|
|
|
|
+
I have another problem = it seem that i can not add new events- well,working events.
here is what i did so far:
public event EventHandler textchange2;
If i insert only this line in my "Car" control object , it will appear in events list when the new control will be added.
The rest of the code is over my head... >>>
protected virtual void ontextchange2(EventArgs e)
{
EventHandler handler = textchange2;
if (handler != null) handler(this, new EventArgs());
}
|
|
|
|
|
Hi, i'm a beginner for plc. Please somebody guide me or provide some samples to connect, read and write the OMRON PLC through ethernet port.
Thanks advance.
|
|
|
|
|
Why are you asking here? Why not http://www.omron.com/[^]?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I only know read & write Mitsubishi PLC from a Mitsubishi's control named MXComponent.
|
|
|
|
|
I connect my plc through ethernet port so is there any possibilities to read the port and get the values from the connected PLC.
|
|
|
|
|
I only know read & write Mitsubishi PLC from a Mitsubishi's control named MXComponent.
|
|
|
|
|
And that tells the OP what exactly?
|
|
|
|
|
I would look to a solution that uses OPC technology to achieve what you want. There are plenty of vendors that supply OPC Servers for Omron products - Look at KepWare and Matrikon as 2 of the bigger vendors. Omron may even supply there own OPC Server that you can use. The OPC Server talks to the PLC hardware through communication drivers and you then write a client application in C# to read and write to the PLC via the OPC Server.
There are a few examples on Code Project and as OPC is designed to remove the vendor specific quirks of hardware communication, what works for one PLC vendor will usually work for another with minimal changes. It may seem daunting at first, but there is a .NET wrapper around the OPC Core. Have a look at the OPC Foundation website for further details.
I've been working on a C# client that talks to Siemens hardware via an OPC Server recently and once you get a grip of how the OPC Server organises and presents the individual IO tags of the PLC hardware its an elegant system to use. It also scales very well with my C# client detecting changes in the PLC within 15ms even though its monitoring over 6000 tags!
|
|
|
|
|
I need a collection, which is easy to sort (or sorted collection).
If it is almost sorted, the sorting time must be minimal.
Or it can be collection, which keeps its elements sorted, even if you change the keys of elements.
The keys in collection must NOT be unique!
(Maybe some sort of tree collection internally.)
|
|
|
|
|