|
The same like any other control. Did you try anything, or are you just looking for someone to make your treeview?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
thanks!
i dont wanna use component !
|
|
|
|
|
I have created a window to simulate the keyboard, how to make the cursor in the program window not focused, so that the simulated keyboard can enter a string into the text box of the specified window?
|
|
|
|
|
You'll need to change your form so that it does not receive input-focus. Google for "WS_EX_NOACTIVATE", or check out the article[^] on creating a virtual keyboard here on CodeProject.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
I assume you know that you can use Cursor.Hide(); to hide the Cursor, and Cursor.Show(); to restore it.
Is your window with simulated keyboard on a touch-enabled device ? That's the only scenario I can imagine where you'd want to hide the Cursor.
If I am not understanding your idea here, please say more.
bill
Google CEO, Erich Schmidt: "I keep asking for a product called Serendipity. This product would have access to everything ever written or recorded, know everything the user ever worked on and saved to his or her personal hard drive, and know a whole lot about the user's tastes, friends and predilections." 2004, USA Today interview
|
|
|
|
|
How to create a control from scratch? (for WinForm applications)
NOT inherit/extend UserControl.
I want to create something totally new.
A good example is the timer control properties - i bet that is not an extension from Usercontrol.
Something similar i need.
{
I just want to create(fromScratch),visualize and use a NEW control with its properties (and events).
}
For example:
I want a Control named "Car"
Properties: wheels,doors,windows,lights,sounds,color,name,class,subclass,etc
Events: Speed,Stop, Accelerate,Brake,click, collide,touch, lightsOn,soundOn,noWheels,etc
And nothing more than this !
Thanks.
modified 17-Oct-13 5:08am.
|
|
|
|
|
Does the NoWheels event cause them to drop off, like something out of Wacky Races?
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
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());
}
|
|
|
|