|
In, Aspx page, I would like to add programmatically a new element(c# or VB.NET) in the header of my aspx page.
Add element=toto,atribut=coucou value =”Y”
Example
<title>Default
<toto coucou="”Y”">
Thank you a lot
bye
-=zoltx=-
|
|
|
|
|
That makes no sense. Can you try explaining again what you want to do.
Also, this should really go in the ASP.NET[^] forum
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
I would like to add a tag in the header in my aspx page
as <base href="http/....." />
for example
.....generate by VS
<base href="http://localhost/test1" />
......
Thank you
-=zoltx=-
|
|
|
|
|
I have an app that draws graphs. I want a tooltip that says the x and y value for the axis the mousepointer is over. That is not the main problem. The real problem is that the panel redpaints itself when the tooltip moves. (It now just shows the X and Y coordinate of the pointer) The tooltip moves on panel_Navigate which makes it repaint at every little mouse movement. I have read a little about Double buffering. Is there an easy way of implementing this? This did not work:
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.DoubleBuffer, true);
I have a form with a usercontrol with the panel to draw graphs inside it. I tried to make my own little derived panelclass which overrides the OnPaint method, but I just could not make it work properly because I have to draw the graphics inside the override method. That makes things a little tricky.
Any suggestions? Maybe I'm doing something wrong with the code above? I tried putting it inside all of the constructors, but nothing happend.
- Atle
|
|
|
|
|
First of all, the ControlStyles enumeration is flagged (attributed with the FlagsAttribute ), meaning that you can use bitwise operators on it. In the Microsoft .NET BCL assemblies (base class library), any enumeration with a plural ending does (the power of naming conventions and consistency).
You can save many instructions by changing the three lines to the following:
SetStyle(ControlStyles.UserPaint | ControlStyles.DoubleBuffer
| ControlStyles.AllPaintingInWmPaint, true); This has to be called before the handle is created, so it's best you do this in the constructor.
Second, double-buffering isn't a blanket fix for any drawing problems. More than likely, the entire graph area is being invalidated or your redrawing the entire graph every time OnPaint is called (or your Paint event handler, which ever way you're doing it - although overriding OnPaint is faster and gives you greater control).
Instead of drawing the entire region, use the PaintEventArgs.ClipRectangle passed to the OnPaint method to determine which area needs repainting. If you repaint the entire area for a complex drawing (like a graph), double-buffering will not help much (a little, but not much).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have a TreeView tv1, I am adding nodes and their child nodes. I am storin the values (no. of nodes) in a 2D array. like.. I have a 2D array called
int nodes[][], and a var called int parents , (both global & static),am storing the no of the parent in nodes[0][0], and the number of children that parent has in nodes[0][1].
Ex.
Say I add two parents
then:
nodes[0][0] = 1;
nodes[0][1] = 0;
nodes[1][0] = 2;
nodes[1][1] = 0;
then say I add two children to the first node-
then:
nodes
nodes[0][0] = 1;
nodes[0][1] = 2;
nodes[1][0] = 2;
nodes[1][1] = 0;
This works fine but removal of nodes is the problem. I can remove a child and say
nodes[tv.SelectedNode][1]--;
I can remove a parent without children by:
nodes[tv.SelectedNode][1] = 0;<br />
parents--;
The problem is in removing the parents with children:
I tried to make another function called CopyNodes(int [][],int selectednode)
where I make a temmp 2D array and when I encountered the var selectednode I skipped that part to copy array elements through 2 for loops (like you copy 2D arrays) But somithing is wrong & the array cannot remove the parent with children, & decrement the no. of elements of the array.
I did my best..
Please HELP ME!!
PLEASE!!
_____________________________________________________
Yea! I could be wrong...
|
|
|
|
|
Why are you even bothering? The TreeView already stores the hierarchy of TreeNodes and you can easily get the count at any level using TreeView.Nodes.Count or TreeNode.Nodes.Count . This can even be done recursively very quickly.
What you're doing is not only unnecessary but very error prone as you've already experienced. Don't bother; the TreeView already maintains the node count so use it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Ok thanx but how do I get the modified TreeView (ie. after deletion of the new nodes..) into a 2D array like I want ?
_____________________________________________________
Yea! I could be wrong...
|
|
|
|
|
I have written as function to copy the node values (count) depending on the values the tree gives :
private void CopyArr2()
{
p = ruletree.Nodes.Count;
p--;
for(int i=1; i<=p;i++)
{
TreeNode currnode = ruletree.Nodes[i];
if(currnode != null)
{
if(currnode.Nodes.Count > 1)
{
child[i,0] = i;
child[i,1] = currnode.Nodes.Count;
}
else
{
child[i,0] = i;
}
}
}
}
But The resulting array has no modifications even ater I delete a node!!
why?
_____________________________________________________
Yea! I could be wrong...
|
|
|
|
|
Hi C# gurus,
I would like to know where I can get some sample code that shows how to add an additional button in the caption bar of a window? I would like to add a button on the left of the "minimize" button of the caption.
I could do this in MFC, but Windows.Forms is so different
Thanks for the help.
There is no spoon.
|
|
|
|
|
you can drag a button control to the form and then click on the code behind file to see the BtnClick Event handler. Under properties, you can name the button, the text on the button, etc.
However, do you mean adding a button like a COM AddIn, creating a button that way?
|
|
|
|
|
ok I think that he wnts to put a small button beside the _ (minimize) button on top of any window caption bar= ( (new botton) _ (maximise) X)
right?
_____________________________________________________
Yea! I could be wrong...
|
|
|
|
|
bouli wrote:
I could do this in MFC, but Windows.Forms is so different
Actually, it's not. Underneath it all, Windows Forms makes native API calls and sends or posts, and handles window messages.
The only difference is that not all the APIs, structs, and defs are defined in headers (you can't use headers), so you must P/Invoke the native APIs and define the structs and constants you need.
For example, in your form you want to add a caption for, extend the Form class, override WndProc , and handle the WM_NCPAINT (0x0085) message in a similar fashion as you would with MFC. There's your starting point.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
ok, I should do the same as in MFC, create dynamically a button, paint it in the Non Client area and handle the clicks by trapping the events in the WM_SYSCOMMAND; like for MFC?
There is no spoon.
|
|
|
|
|
Yes; and as I said in my first reply, you need to P/Invoke the necessary APIs and define the necessary structs and constants. Don't forget to actually determine where the minimize button is. Don't always assume you know where it is. Depending on property values, the minimize button may be in a different location. Display settings (size of the caption buttons) may also be different.
There's quite a bit of code in C/C++/MFC available on the 'net that shows you how to do this correctly. Just try googling for it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
there is an excellent implementation in emule of such a button and this implementation also take care if xp styles are enabled or not. I am looking how it is done in emule to do something similar in C#.
thanks for the help
There is no spoon.
|
|
|
|
|
Hello Everybody,
I want to send muliple values(Array values) from one page to other.
I thing query string is not a solution. Session can be helpfull.
But some of my seniors said do not use large number of Session.
Is there any alternating way to avoid both session & query string to send array values.
Please tell me the performance effectt of Query string, Session & alternate one
Thanking You
TusharP
|
|
|
|
|
|
I have to name varibles depending on a count variable. I want to append it to the variable like int "newno" + count = new int();
This gives a syntax error I also tried takin the new value in a string, but that didn't work as well .. It said : A local variable named 'var' is already defined in this scope
when I tried string var = "newno" + count;
and
int var = new int();
HelP!!
_____________________________________________________
Yea! I could be wrong...
|
|
|
|
|
Hi!
What exactly are you trying to do? Are you sure you shouldn't be
using arrays of some sort instead?
An example:
string[] varArray = new string[ sizeGoesHere ];<br />
<br />
for( int i=0; i<varArray.Length; i++ )<br />
{<br />
varArray[i] = "Some Text and counter: "+i;<br />
}
Zerxes
|
|
|
|
|
A little error snuck in..
for( int i=0; i<<varArray.Length; i++ )
Zerxes
|
|
|
|
|
Ack.. That's what you get for trying to post code.
This should be correct
for( int i=0; i<varArray.Length; i++ )
Zerxes
|
|
|
|
|
ok but that's no what I'm tryin to do..
I have a variable static int count = 0; . it is global. I am adding a text box each time I click a button say..
private void btnAddCond_Click(object sender, System.EventArgs e)
{
TextBox "tb" + count = new TextBox();
this.Controls.Add("tb" + count);
}
I hope it explains my plight!!
Help PLZ
_____________________________________________________
Yea! I could be wrong...
|
|
|
|
|
Thought about using the Name property of TextBox class?
Otherwise i don't see a need to give your variable a unique name, because it's gone as soon as you leave the event handler.
private void btnAddCond_Click(object sender, System.EventArgs e)
{
TextBox textbox1 = new TextBox();
this.Controls.Add(textbox1);
}
|
|
|
|
|
I thank you Mr. Stefan Troschütz
Yes It works!! thankx
_____________________________________________________
Yea! I could be wrong...
|
|
|
|