|
Hey thanks buddy, that’s right. I think, I should frame my interview answer as follows:
(1) As one of the core features, .NET platform targets to support multiple languages. The internal constructs of each language compiler to implement MI differ.
(2) The cost of implementing MI (especially due to above mentioned reason) is quite high as MI is relatively rarely used in most OOP designs. For those rare situations, interface based MI, which does not involve much of an overhead and complexities, can be used.
(3) A language or platform supporting MI becomes rather complex from developer as well as the compiler writer perspective because of the confusion involved in casting, member references ambiguity, serializing and so on. .NET aims to be a clean and intuitive platform.
Howz that?
|
|
|
|
|
Sounds pretty good. On my last .Net related interview I did not need to answer questions like that. There were some technical questions, but it was mainly system based, like how do you handle this situation on a web server farm.
Steve Maier, MCSD MCAD
|
|
|
|
|
Oh yeah, oh yeah... Exactly! I would love to hear some real-world stuff like that from those guys.
Salil Khedkar [^]
|
|
|
|
|
hi,
i am doing a custom control inherits from button but has diffrent shape
but every time i try to put it in a form and mouse over on it, it disappeared
i handled all the methods that can be handled in it but nothing
can any one help me plz?
|
|
|
|
|
showing some code (and not triple posting ) would certainly help get you an answer quicker.
|
|
|
|
|
ok that is the whole code
i think that would help
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Data;
using System.Windows.Forms;
namespace MyCustomControls
{
///
///
public class custom1:System.Windows.Forms.Button
{
private Point p1 ;
private Point p2 ;
private Point p3;
private Point p4;
private Point p5;
private Point p6;
private Point p7;
private Point p8;
private Point p9;
private Point p10;
private Point p11;
private Point p12;
private Point[] points;
int x;
int y;
int z;
int a;
private System.Drawing.Drawing2D.LinearGradientBrush lgb ;
private System.Drawing.Drawing2D.GraphicsPath gb;
private System.Drawing.Color color1;
private Color color2 ;
private Color color3;
private Graphics g;
private Rectangle rec;
private Pen pen;
public custom1()
{
Init();
}
public void Init()
{
x = this.Width ;
y = this.Height;
z = x / 2;
a = y / 2;
color1 = Color.Silver;
color2 = Color.White;
color3 = Color.Navy;
p1 = new Point(1, 0);
p2 = new Point(x-1, 0);
p3 = new Point(x-1,1);
p4 = new Point(x, 1);
p5 = new Point(x, y-1);
p6 = new Point(x-1, y-1);
p7 = new Point(x-1, y);
p8 = new Point(1, y);
p9 = new Point(1, y-1);
p10 = new Point(0, y-1);
p11 = new Point(0, 1);
p12 = new Point(1, 1);
points = new Point[12]{p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12};
lgb = new LinearGradientBrush(new Rectangle(0, 0, this.Width, this.Height),Color.FromArgb(253,253,253),Color.FromArgb(201,200,220),90.0f);
gb = new GraphicsPath();
float[] relativeIntensities = {0.0f, 0.008f, 1.0f};
float[] relativePositions = {0.0f, 0.32f, 1.0f};
Blend blend = new Blend();
blend.Factors = relativeIntensities;
blend.Positions = relativePositions;
lgb.Blend = blend;
rec = new Rectangle(0, 0, this.Width, this.Height);
//events
// this.Click+=new EventHandler(custom1_Click);
// this.MouseEnter+=new EventHandler(custom1_MouseEnter);
// this.MouseLeave+=new EventHandler(custom1_MouseLeave);
// this.MouseDown+=new MouseEventHandler(custom1_MouseDown);
// this.MouseUp+=new MouseEventHandler(custom1_MouseUp);
//
}
protected override void OnPaint(PaintEventArgs e)
{
g = e.Graphics;
g.FillPolygon(lgb, points);
gb.AddLines(points);
this.Region = new Region(gb);
//base.OnPaint (e);
}
public enum States
{
Normal,
MouseOver,
Pushed
}
States state;
protected override void OnMouseEnter(EventArgs e)
{
state = States.MouseOver;
this.Invalidate(rec);
base.OnMouseEnter(e);
}
protected override void OnMouseLeave(System.EventArgs e)
{
state = States.Normal;
this.Invalidate(rec);
base.OnMouseLeave(e);
}
protected override void OnMouseDown
(System.Windows.Forms.MouseEventArgs e)
{
// do nothing if pressed not the left button of mouse
if ((e.Button & MouseButtons.Left) != MouseButtons.Left) return;
if (rec.Contains(e.X, e.Y))
{
state = States.Pushed;
// button receives an imput focus
this.Focus();
}
else state = States.Normal;
this.Invalidate(rec);
base.OnMouseDown(e);
}
protected override void OnMouseUp
(System.Windows.Forms.MouseEventArgs e)
{
if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
state = States.Normal;
this.Invalidate(rec);
base.OnMouseUp(e);
}
}
}
|
|
|
|
|
hi,
i am doing a custom control inherits from button but has diffrent shape
but every time i try to put it in a form and mouse over on it, it disappeared
i handled all the methods that can be handled in it but nothing
can any one help me plz?
|
|
|
|
|
|
i want to syncronizse between windows clock and another device which i test that has its own clock.
i'll read the Real Time Clock Of the device(through RS232) and calculate th offset between them and update the offset to whatever i want
does enyone knows how can i do it?
|
|
|
|
|
how does the pc and the device communicate? how do you obtain time from the device? does the device have a "time" or just tick-counts?
there are no facts, only interpretations
|
|
|
|
|
Hi all,
I want to write a background application that checks certain conditions periodically at a configurable period (e.g. 10sec). What is the best aproach to acheive this ? by Timer or by a looping thread or other better method ? The background application should consume small CPU power so that it won't affect the applications at the foreground.
Thanks
Patrick
|
|
|
|
|
A timer would be the best approach, cause a looping thread will definitely consume CPU power.
www.troschuetz.de
|
|
|
|
|
Yeah, use a timer or if you have a problem with that use the Thread.Sleep(So many milliseconds); statement.
Salil Khedkar [^]
|
|
|
|
|
Hi all,
how can we add history of recently viewed items into our application's menu. I have developed an interface, i want to keep track of all the recently viewed file names in my File menu (atmost 5).
is it easy to implement it or should we have to do some rigourous work...?
any ideas or suggestions?
thanks in advance,
Suman
|
|
|
|
|
You'll have to define a container where you store the names respectively the paths of your recently viewed files. This could be a simple array or maybe some more complex container.
To your MainMenu add a MenuItem which is for example named "Recently Files". In the PopUp event of this MenuItem add a MenuItem for each file in your container. At last write an event handler for Click events of the several MenuItems and load the specific file.
www.troschuetz.de
|
|
|
|
|
|
Hi guys,
thanks for ur advices and suggestions and they did help me in coding my own program.
thanks,
Suman
|
|
|
|
|
Does anyone know how to change the font size of the column header in a ListView?
I'm wrinting an App in C#
Have a great coding day.
Regards,
Tony D. Abel
|
|
|
|
|
There is a nice article on customizing the ListView located here[^]. Basically you will see that he has subclassed the NativeWindow . There are a few important steps; in particular, you must assign the handle of the subclassed native window to that of the handle to the header control's handle. Also, you will need to override the WndProc and watch for WM_SETFONT (0x0030). This will allow you to specify your own Font instance and then assign the WParam of your message the handle of your newly created font (call ToHfont() on your Font object), then obviously you will want to call base.WndProc(ref m); so your changes are propagated. The following P/Invoke signature will be needed:
[DllImport("User32.dll",CharSet = CharSet.Auto,SetLastError=true)]
public static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
- Nick Parker My Blog | My Articles
|
|
|
|
|
Can someone point me to a 'good' site that outlines good naming conventions for objects and variables etc. for both c# and VB? Preferably a microsoft site. Doing a search for this brings up nothing substantial. Thanks!
SN
|
|
|
|
|
|
|
Hi
I have a form which is being displayed, and from my class I would like to be able to set control values.
In VB6 I would have done this by simply frmMain.txtName = "John", however, in C# doesn't seem quite so easy. What am I doing wrong?
Thanx
|
|
|
|
|
How can we tell you if you don't show any code?
|
|
|
|
|
Well, your question is rather nebulous, in particular because assuming you had a Form class instance called frmMain , you could simply access the control and then specifically the specific property of the control (this may be the part you were missing) like this:
frmMain.txtName.Text = "John";
Also, if you are referencing the control from within the class it is defined, you can change properties as such:
this.txtName.Text = "John";
txtName.Text = "John";
Hope this helps.
- Nick Parker My Blog | My Articles
|
|
|
|
|