|
Sorry, but my COM knowledge is worse than zero I have no need for it and it looks like too much crap for my liking.
|
|
|
|
|
I would like to play a Direct3D animation inside of a window panel. Can anyone point me in the right direction. I have nothing implemented for that so far. Is it simply a case of specifying that the panel is the Owner of the animation?
|
|
|
|
|
See the Device constructor which takes a Control as the 3rd parameter, which is uses for the rendering surface.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Can anyone give me some information on the commenting schema for the self-generated doc files?
ie> /// <summary> blah </summary>
I need information on what other tags can be used, and what they are for. I can't seem to find any decent documentation on this anywheres online.
Thanks in advance,
Jon
|
|
|
|
|
|
|
You're welcome!
Regards,
Jeff Varszegi
EEEP!
|
|
|
|
|
Hi, how can I dectect when a column of listview chage its width at runtime?.
It happend When the user chage de width of the colums (Sistem.Windows.Columnheader) withe the mouse.
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
Extend the ListView class and override WndProc like so (a sample application is provided):
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
public class Test : Form
{
static void Main()
{
Application.Run(new Test());
}
public Test()
{
SuspendLayout();
Text = "MyListView Test";
MyListView lv = new MyListView();
Controls.Add(lv);
lv.Dock = DockStyle.Fill;
lv.View = View.Details;
lv.ColumnHeaderChanged += new ColumnHeaderChangedEventHandler(
lv_ColumnHeaderChanged);
ColumnHeader col1 = new ColumnHeader();
col1.Text = "One";
ColumnHeader col2 = new ColumnHeader();
col2.Text = "Two";
lv.Columns.Add(col1);
lv.Columns.Add(col2);
ResumeLayout();
}
private void lv_ColumnHeaderChanged(object sender,
ColumnHeaderChangedEventArgs e)
{
Console.WriteLine("Column {0} changed: new width = {1}",
e.ColumnHeader.Text, e.ColumnHeader.Width);
}
}
public class MyListView : ListView
{
private IntPtr hWndHeader;
protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
hWndHeader = SendMessage(Handle, LVM_GETHEADER, 0, 0);
}
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == WM_NOTIFY)
{
NMHDR hdr = (NMHDR)Marshal.PtrToStructure(m.LParam, typeof(NMHDR));
if (hdr.hwndFrom == hWndHeader &&
(hdr.code == HDN_ITEMCHANGEDA || hdr.code == HDN_ITEMCHANGEDW))
{
NMHEADER header = (NMHEADER)
Marshal.PtrToStructure(m.LParam, typeof(NMHEADER));
int index = header.iItem;
if (index >= 0 && index < Columns.Count)
{
ColumnHeader col = Columns[index];
OnColumnHeaderChanged(new ColumnHeaderChangedEventArgs(col));
}
}
}
}
public event ColumnHeaderChangedEventHandler ColumnHeaderChanged;
protected virtual void OnColumnHeaderChanged(ColumnHeaderChangedEventArgs e)
{
if (ColumnHeaderChanged != null)
ColumnHeaderChanged(this, e);
}
private const int WM_NOTIFY = 78;
private const int HDN_ITEMCHANGEDA = -301;
private const int HDN_ITEMCHANGEDW = -321;
private const int LVM_GETHEADER = 4127;
[StructLayout(LayoutKind.Sequential)]
public class NMHDR
{
public IntPtr hwndFrom;
[MarshalAs(UnmanagedType.U4)] public int idFrom;
[MarshalAs(UnmanagedType.U4)] public int code;
}
[StructLayout(LayoutKind.Sequential)]
public class NMHEADER
{
public IntPtr hwndFrom;
[MarshalAs(UnmanagedType.U4)] public int idFrom;
[MarshalAs(UnmanagedType.U4)] public int code;
public int iItem;
public int iButton;
public IntPtr pitem;
}
[DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg,
int wParam, int lParam);
}
public delegate void ColumnHeaderChangedEventHandler(object sender,
ColumnHeaderChangedEventArgs e);
public class ColumnHeaderChangedEventArgs : EventArgs
{
private ColumnHeader columnHeader;
public ColumnHeaderChangedEventArgs(ColumnHeader header)
{
columnHeader = header;
}
public ColumnHeader ColumnHeader
{
get { return columnHeader; }
}
} For fun I implemented the ColumnHeaderChanged event, though you could just skip all that and implement your code where I call OnColumnHeaderChanged (which fires the event - the proper way to fire an event in order to allow derivative classes to override your event handler without handling the event itself, which is faster and allows for more control).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank you!
Thats what I need. Its is very complicated for me now but works fine. I hope understand it all soon.
I will use it in my DataListView custom control.
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
The best way to understand it is the read the documentation for the classes and members I used. Many of what I did, however, is from the Platform SDK for common controls. I re-declared several native structs as classes (not as structs as I normally would so that I can use Marshal.PtrToStructure , which requires a class instance) and P/Invoked SendMessage . The constants are defined in winuser.h and commctrl.h.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
How take IP-address of workgroup or domain computers?
Demonstrate with an C# example.
Cosma
|
|
|
|
|
If you know the names of these computers use the Dns.GetHostByName method. This returns an object of class IPHostEntry which contains a list of IP addresses associated with the host.
<br />
System.Net.IPHostEntry hostEntry = System.Net.Dns.GetHostByName(hostName);<br />
System.Net.IPAddress[] adresses = hostEntry.AddressList;<br />
See the documentation for further information.
|
|
|
|
|
To show the IP Address(es) of the local computer add:
<br />
string hostName = SystemInformation.ComputerName;<br />
System.Net.IPHostEntry hostEntry = System.Net.Dns.GetHostByName(hostName);<br />
System.Net.IPAddress[] adresses = hostEntry.AddressList;<br />
foreach (System.Net.IPAddress curAdd in adresses)<br />
{<br />
MessageBox.Show(curAdd.ToString());<br />
}<br />
Sincerely,
-Ron
|
|
|
|
|
But if there are 20 computers in my local network,
and a must now how from it's are online.
confused:
|
|
|
|
|
But if there are 20 computers in my local network,
and a must know how from it's are online.
confused: 
|
|
|
|
|
I use the Dns.GetHostByAddress method to determine if a computer is online. If not this method throws an exception. I'm not sure which exception this is, but it think you will find out by testing.
I think that the Dns.GetHostByName method which i mentioned shows a similar behaviour.
|
|
|
|
|
If you want the ip address of all the machines in your workgroup you will have to use a file called netapi32.dll, you will have to extract data from it.
Alternatively you could try to resolve a range of ip address and the address that get resolved could be added to an array. That array could be the list of hosts that are available in your network. You could use the Dns.GethostbyAddress method for it.
CCIE (R&S) Written, MCSE 2000 Security
|
|
|
|
|
Thanks, but how can i use this netapi32.dll in C# to know
what of network computers are online.
confused:
|
|
|
|
|
I have a base-class form with buttons on it. If I derive from this form, I want to be able to click the buttons at design time, and react to the clicks. Any ideas?
Thanks in advance.
Kyosa Jamie Nordmeyer - Cho Dan
Portland, Oregon, USA
|
|
|
|
|
By default the scope of the buttons etc in the form are private. Change the scope to public or protected so that u can interact with the designer
|
|
|
|
|
Hi there. Thanks for the reply. I tried that, actually, and all it did was allow me to modify the buttons from the inherited class. I still couldn't get the buttons to raise click events.
Kyosa Jamie Nordmeyer - Cho Dan
Portland, Oregon, USA
|
|
|
|
|
I cant get what u r asking. By modifying the scope u can handle the click event in the derived form.
Raising the click event by using OnClick is only possible in the classes derived from the Button Class.
As per my knowledge, u can do everything for the Button in the inherited form class as u do in a form class.
|
|
|
|
|
Hello,
I am new to C#, and my background is mostly C++.
also just started with the MS Developer Studio for .NET, and no where did i
find how to get the list of derived classes from a given class/interface.
i also have multiple assemblies (each on a different sln file) in the environment
i work in, which might make things a bit more difficult.
thanks for any suggestion
Adi
|
|
|
|
|
There's no way of which I know to do it directly. I haven't played around much with the Visio version that comes with VS .NET Enterprise, mostly having used it for database reverse-engineering; maybe that has some facility for auto-generating class diagrams?
One thing you can do is execute "Tools - Build Comment Web Pages...", and browse around the generated HTML. It's not the best solution, but it'll work.
Regards,
Jeff Varszegi
EEEP!
|
|
|
|