|
shyagam wrote: How can I use my ShapedButton in the designer?
Do NOT write any code in InitialiseComponent, the IDE recreates that code.
shyagam wrote: If that's the case, then how can I inherit Button?
You can't, as you say, once you inherit from UserControl, that's it, excepting for interfaces.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: Do NOT write any code in InitialiseComponent, the IDE recreates that code.
What can I do than in order to gain the ability to design the button in the designer?
|
|
|
|
|
It's not exactly what you wan't, but it might help you out a little bit because it enables you to use at least some designer abilities. To outwit the designer do the following:
Let's say you have a class MyButton derived from Button . To place an instance, first place a usual Button Control on your form by using the designer (let's name it myButton1). In your code replace the designer generated code private System.Windows.Forms.Button myButton1; with private MyButton myButton1; and in InitializeComponent() use your own class, which results in replacing this.myButton1 = new System.Windows.Forms.Button(); with this.myButton1 = new MyButton(); . This should make the designer switch to your own data type permanently and your own properties and events should also be listed by the designer. Hope this helps.
|
|
|
|
|
Well... I didn't try your suggestion, so I can't tell you if it works...
I have found my truly beautyful solution (in my opinion at least ).
I have discovered that after inheriting System.Windows.Forms.Button, the icon of my file in the solution explorer, changed itself to a component's icon.
So I started reading about components, and finally I've discovered my solution:
A component is defined as a class which implements the IComponent interface, or inherits from a class which directly/indirectly implements the IComponent interface.
So I checked the heirarchy of the Button class, and there it was!
Button indirectly implements the IComponent interface.
So I kept on reading, and found that with some simple attributes added to your class, your class can have what is called a "Design-Time Support"![^]
Thank you all again.
I hope this info would help others to achieve similar goals.
|
|
|
|
|
Hi
I was just searching for that solution - great !!!
My problem was that I could not open the designer after I derived a class from TreeView (I got HTML errors in the designer) .
Now I added the following property to the derived class:
[Designer(typeof(SimpleControl.Design.SimpleDesigner))]
then I reopend the form in designer - in voala the garphic was displayed !
Thanks a lot for that hint!
|
|
|
|
|
the question is simply this boys n girls, ladies n gents,
how do I iterate thru all the elements of a Datagrid in a windows form (.net 1.1). thats when I take input from user. how do i know the number of rows entered in it.
thanks
Rocky
|
|
|
|
|
I have an assembly that is strongly named and is added to the GAC. All works well. however, if I obfuscate the assmebly using Dotfuscator I get the following error:
Failure adding assembly to the cache: Strong name signature could not be verified. Was the assembly built delay-signed?
Any ideas on how to fix this?
|
|
|
|
|
|
You need to obfuscate it before adding the strong name. The strong name includes a cryptographic hash of the contents of the DLL, which is verified on adding to the GAC, and obfuscating it (obviously) changes the contents. Use sn.exe with the -R switch to strong-name-sign a DLL. You may need to specify /delaysign+ to the compiler for sn.exe to work.
I found I had to do this when rebasing a Primary Interop Assembly generated with tlbimp , since tlbimp does not allow the base address to be specified.
|
|
|
|
|
i finsih work in my first project and i need to make setup package that include project files and database and sql server engine and i need to setup engine and database during project setup on client computer
how i do this
what soft ware i use it
note
itry to do this with setup project in .net but i failed answer me quickly
ma_refay
|
|
|
|
|
I will "answer you quickly":
Into the setup project add as a prerequisite sql server (msde or express)and a custom setup action that mounts the database files or execs some scripts to gen the database.
Is this quick enough?
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
in general every window got is's own button in statusbar on desktop - my question is - how to check if the form is general on-top (or is active) and make it's statusbar button "flashing" like internet communicator window when new message is coming...??
Ideal compilator compiling comments without code...
|
|
|
|
|
If a forms property ShowInTaskBar is set to true then yes, most applications have a window in the taskbar. You can make the taskbar window for your application 'flash' by using the API commands FlashWindow and FlashWindowEx. You can learn more about these commands by googling the application API Guide and API Viewer. I also have code for this in VC#, but at the moment I am not at the right computer.
Regards,
1tg46
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.
|
|
|
|
|
iam working in c# i need some thing like module in vb to write public variable that keep it's value in it during project running and can call it from any form
is there thing like it in c#
ma_refay
|
|
|
|
|
|
i am currently a developer that uses .net as my main programming environment. and i wanted to know how could i use .net to create License and then in turn use them to protect the applications that i have developed?
can some one please point me into the right direction? posible some tutorials or papers on how i can use .net to implement this????
kenny
|
|
|
|
|
|
Hi. May be any of you can help me with this. Do you know the eway to extract a frame of a quicktime movie and save it as jpg?
Thanks a lot !!
|
|
|
|
|
|
Hi all,
I need to delete rows from my db, when the criteria is: older than a
certain date.
Can it be done without an SQL string query?? Using only a DataSet
and/or DataAdapter?
The regular SQL would be: "DELETE FROM EventLog WHERE
EL_TimeStamp<01/08/2006".
But the problem is using the date in C# and Access-database.
Thanks in advance,
Danny
|
|
|
|
|
Have you tried using a parameterized query?
DateTime dt = DateTime.Parse("01/08/2006");
OledbCommand cmd = new OleDbCommand "DELETE FROM EventLog WHERE EL_TimeStamp < ?;", connection);
cmd.Parameters.Add("@p1", OledbType.Date,dt);
cmd.Execute();
|
|
|
|
|
Hello fellow programmers,
I have something in mind which, as far as my knowledge goes, cannot be done.
But I'm writing here to ask for a solution...
I'll start with explaining a class I wrote, named ShapedForm...
ShapedForm inherits from System.Windows.Forms.Form.
It has a built in functionallity to receive a Bitmap object, and change the form's region according to the drawing in the Bitmap, leaving out "transparent pixels".
I've also added a mouse-drag ability, as it's impossible to move the form without a title-bar.
So today I've started coding a new project, where I wanted a shaped button!
My idea was to inherit System.Windows.Forms.Control which, as you all know, is the base class for many controls, and add the above functionallities to it.
The problem comes here...
Is there any way to force the derived classes (i.e. Form, Button, Panel, etc.) to inherit from my ShapedControl instead of the original Control class?
Kind of like overriding an inheritance or something like that...
Again, as far as I know, it cannot be done...
So if you have an alternative method in mind, please share it with me.
Thanks in advance,
Shy.
|
|
|
|
|
You are right, you cannot do that. What I would probably do is design it this way:
I'd create a number of Shaped... classes, e.g. ShapedButton, ShapedPanel, etc. These would inherit from the various based classes (Button, Panel, etc.)
The "Shaped" functionality would go into a separate class of its own that contains the functionality that you need. Then from the various control subclasses you created earlier you would call into the Shaped class.
e.g.
public class ShapedStrategy
{
public void SomeShapedFunctionality(Control shapedControl)
{
}
}
public class ShapedButton : Button
{
private ShapedStrategy shapedStrategy;
public override void OnPaint()
{
shapedStrategy.ShapedPaint(this);
}
}
Hopefully that might give you some ideas.
|
|
|
|
|
Yes... I have thought about it...
But it's kind of annoying to do that with every control...
|
|
|
|
|
Hello, my first post here.
Gonna try and be specific as possible.
Here's the situation. I have a small app with a list View set to Largeicon view.
The problem is it will display the icons on some computers, but not all.
Works fine on my laptop, but not on my desktop... Both computers are running WinXP, all
updates and patchs installed.
So I'm just looking for some pointers on where to start looking for the problem.
I know this sounds vague, but it's the best I can do for the moment.
hope someone has an idea...
Thanks alot
LoneFerret
Cross my heart, smack me dead...stick a lobster on my head.
|
|
|
|