|
As far as I remember, the Opacity property is declared within the Form class itself, not anything more generic. Thus, I can see 2 options:
1. Make a seperate embedded form for your controls (although I'm not sure this would work)
2. Override the paint handler for each control.
Of course, I could be wrong....
Jeremy Kimball
|
|
|
|
|
Thanks for the reply.
any other idea?
---
"Art happens when you least expect it"
|
|
|
|
|
Hi,
Having not found a good XPath tutorial out there yet, here is my question..
This is how I try to display the fisrtname of the first contact in the Contact.xml file,
Consider this code:
XmlDocument myDoc = new XmlDocument();<br />
myDoc.Load(Application.StartupPath + "\\Contact.xml");<br />
txtPrénom.Text = myDoc.SelectSingleNode("//Prenom").Value;
What am I missing here?
Thank you for your help!
Antoine
This by our hands that dream,
"I shall find a way or make one!"
|
|
|
|
|
try
txtPrénom.Text = myDoc.SelectSingleNode("//Prenom[first()]").Value;
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
SelectSingleNode returns first node matching XPath so your code should IMHO work, but only if "Prenom " is element (not attribute). To select attrbute you need to use this XPath //@Prenom . You can also use xpath like following:
Xml:
<contacts>
<contact firstname="Bill">
...
<contact>
...
</contacts>
<br /><br />
XPath: <code>contacts/contact/@firstname</code> returns 'Bill'
Great XPath tutorial is at www.w3schools.com[^].
|
|
|
|
|
|
You have the right idea, but it depends on your actual XML.
I suggest getting the node directly and looking at it. This will help answer your question.
<names><Prenom>Dog</Prenom><Prenom>Cat</Prenom></names>
XmlNode node = doc.SelectSingleNode("//Prenom");
node.Value == null
node.InnerText == "Dog"
|
|
|
|
|
Hi!
The point is that while scrolling within a datagrid, sometimes the gridloses focus with no reason because I was just scrolling.The class below simply illustrates this(while scrolling you'll get a message)
Thank you in advance.
ps: I'm using vs.net 2003.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace test2k3
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.DataGrid dg;
private DataTable dt;
private System.Windows.Forms.Button button1;
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
dt = new DataTable();
DataColumn dc = new DataColumn("Nr");
dt.Columns.Add(dc);
for(int i = 0 ; i < 100; i++)
{
DataRow dr = dt.NewRow();
dr[0] = "row #"+i;
dt.Rows.Add(dr);
}
this.dg.DataSource = dt;
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.dg = new System.Windows.Forms.DataGrid();
this.button1 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dg)).BeginInit();
this.SuspendLayout();
//
// dg
//
this.dg.DataMember = "";
this.dg.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dg.Location = new System.Drawing.Point(24, 16);
this.dg.Name = "dg";
this.dg.Size = new System.Drawing.Size(160, 128);
this.dg.TabIndex = 0;
this.dg.Leave += new System.EventHandler(this.dg_Leave);
//
// button1
//
this.button1.Location = new System.Drawing.Point(232, 64);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(56, 32);
this.button1.TabIndex = 1;
this.button1.Text = "button1";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(328, 173);
this.Controls.Add(this.button1);
this.Controls.Add(this.dg);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.dg)).EndInit();
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void dg_Leave(object sender, System.EventArgs e)
{
MessageBox.Show("You haven't leaved the grid.You've been just scrolling!","Is This A Bug?");
}
}
|
|
|
|
|
|
Erm...
Application.XXXX
HTH
-----------------------------------------------------------------------
Shaun Austin: .NET Specialist. Spreading the word of .NET to the world... well the UK... well my tiny corner of it!!
|
|
|
|
|
System.Windows.Forms.Application provides static function. I need to get 'this' instance of the Application, just like AfxGetApp provided in MFC, or the Application instance in VB.
Any ideas?
|
|
|
|
|
Hey !
In VB we can easily access the Application object. This is also available in MFC as AfxGetApp().
What is the C# .NET equivalent?
|
|
|
|
|
Hello, I want to make a dialog with a given size for pocket pc.
For doing that I have derived my class from System.Windows.Forms.Form and I have set the property Size for my form with my prefered size. But the result is not what I have expected.
Do you know what can be the solution for my problem?
public class SelectionTool : System.Windows.Forms.Form
{
public SelectionTool(String title, String lblText){
InitializeComponent();
}
private void InitializeComponent()
{
//that line of code doesn't set the size for my form
this.Size = new Size(20,40);
.....
this.ShowDialog();
}
}
Ramona
|
|
|
|
|
I am C# beginner. I just started to practise
on console aplications.
And I already have problem.
How to supply C function _getch()
i.e. Get a character from the console.
Thanx
viliam
|
|
|
|
|
Your best bet is probably to write a DLL in C that performs any low-level input, then use the Platform Invoke feature to access that.
You can also P/Invoke _getch directly.
[DllImport("msvcr71.dll", CallingConvention = CallingConvention.Cdecl)]
static extern int _getwch();
[STAThread]
static void Main(string[] args)
{
Console.WriteLine( "Press any key to continue" );
Console.Out.Flush();
char ch = (char) _getwch();
Console.WriteLine( "You pressed {0}", ch );
} You must call Flush , because the Console class performs buffering on the stream. Failing to do so can cause the prompt to be displayed after _getwch executes, not before.
Note that I used the wide-character version, _getwch, because the CLR uses wide characters internally.
|
|
|
|
|
What about Console.Read() ? Doesn't that work?
|
|
|
|
|
|
Oh ok... I guess I missed the point of the post.
|
|
|
|
|
Actually I don't think you did... I'm sure he just wants to read some character from the console...
-----------------------------------------------------------------------
Shaun Austin: .NET Specialist. Spreading the word of .NET to the world... well the UK... well my tiny corner of it!!
|
|
|
|
|
Hi,
I would enjoy playing a short custom sound with C# (like a beep) when the mouse moves over a button for example, like Ineternet Explorer does.
Would anybody help me ? Thanks.
|
|
|
|
|
Use managed DirectX or use P/Invoke to call the play sound method in the Win32 API.
The graveyards are filled with indispensible men.
|
|
|
|
|
Hi all.
I'm trying to set the IP of my NIC's. I have found nice examples showing how to get the IP through the WMI, but how can I set it?
All hints are appreciated.
Regards,
Christian Sternell
|
|
|
|
|
As far as I know, you can't without going through the natice API, and configuring it with no DHCP, and then setting a static ip address.
"Je pense, donc je mange." - Rene Descartes 1689 - Just before his mother put his tea on the table.
Shameless Plug - Distributed Database Transactions in .NET using COM+
|
|
|
|
|
Thanks for the answer, Giles.
That was a little discouraging, but I'll see what I can do about it.
If anyone out there has a piece of code for this - please post if for me.
Regards,
Christian Sternell
|
|
|
|
|
I'm pretty sure I had a friend do it in C++ once using WMI (NetworkConfiguration class). If you can do it in C++, I would assume you could wrap it in C#.
|
|
|
|