bouli wrote: 1) What is the equivalent of Win32 GetSysColor() function in .NET?
It is System.Drawing.SystemColors class
bouli wrote: 2) I would like to have the equivalent in C# (.NET) of the following C++ (MFC) statement:
class CMyWindow : public CWnd
While CWnd is an MFC class that represents a basic window.
I want to write my own control and use it
Use System.Windows.Forms.Form for forms(dialogs). But for controls like button, user-controls use System.Windows.Forms.UserControl or Control. Here big difference between MFC and .NET. In MFC can be CWnd dialog and control(I used these for nested dialogs - one dialog owns another), but in .NET only classes delivered from System.Windows.Forms.Form can be dialogs and cannot contain any forms.
Right click on your ToolBox and select 'Customize ToolBox' option. From .NET Component tab, with Browse button , select assembly of your control and click OK. It is now added to your toolbox and you can drag and drop it on your form.
For one thing, you didn't hook-up your Paint event handlers. Remember, he's a n00b.
Also, never use events in a derived class - it's too slow and doesn't provide the control you might need (such as NOT calling the base class's OnPaint handler). Instead, always override the related method for an event when deriving from a class:
publicclass MyControl : UserControl
protectedoverridevoid OnPaint(PaintEventArgs e)
base.OnPaint(e); // Allows base class to paint and raise the Paint event.// Draw
Point of clarification: OnPaint is not an event. It's a method that, in the defining class, raises the Paint event before or after optionally performing some action (like any default painting). When you override this, you pre-empt the event being raised (which is why you call base.OnPaint) and actually override all the functionality of that method since it's virtual. If you don't call base.OnPaint, any painting that the base class, or its base class, etc., need to do won't be performed.
Consider this: when you override such a method like OnPaint, the CLR will call your virtual method which uses the callvirt (as opposed to call) IL instruction. This is polymorphism. This one call does it all. When you instead handle an event in the derived class from the base class (like handling the Paint) event, there are several IL instructions (both in your implementation and in the event's add and remove accessors, not to mention whatever they require to add the handler to the callback chain) just to wire-up the event! When the event is fired, the collection of handlers is enumerated and each one is invoked with takes several more IL instructions (some to enumerate and jump back, and a couple to invoke the delegate). I hope this makes sense.
Besides, when you override the event handler like OnPaint, you don't need to know the sender because the current instance of your class is the sender. All you need is the EventArgs (or derivative, like PaintEventArgs). It simplifies your class.
You can't just send a raw file to the printer (unless it's text or postscript and the driver is setup to recognize it correctly)! While a PDF is mostly PS, it is also compressed and mangled.
You need to have a program or library to print PDFs correctly. There is no support for this in the .NET base class library (has nothing to do with C#, which is only a language that targets the CLR), nor should there be (too specialized).
If Adobe Acrobat (including Reader) is installed, you can customize your Toolbox in VS.NET, click the COM tab, and add the Acrobat Control for ActiveX (which creates a couple interop assemblies and references them automatically). You can then use the LoadFile method to load a PDF then call the Print method. The out-of-process server for Acrobat (not Reader) doesn't appear to easily expose this type of access to the object model.
Hahaha, I know you would be laughing at me for this but anyways...
I'm a super n00b to programming in general, I saw all websites saying if you want to study C# you would need C/C++ or Java background but I didn't believe it, so I took a C# book for n00bs and read it and learned some basics of C# Programming but I want to study Managed DirectX so I can make games with C#, so I started reading "Sams Managed DirectX® 9 Kick Start Graphics and Game Programming" but it was little confusing and the book stated that it's not a book for n00b, I want to know if there's any book or websites that will teach you from the very basics of Managed DirectX from ground up, please don't tell me I have to study DirectX first before I go study Managed DirectX because I want to just go for C# + Managed DirectX and skip all the other stuff.
Please reply thank you ^^
Bring you English Version Super Robot Wars games