|
cmh623 wrote: some advantages of using Forms over MessageBoxes?
You have better flexibility and control. Customization is far better with forms than messageboxes.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi,
How do we implement an IE7 style button? A button that also has a dropdownlist under it. So for example the IE7 home button can be pressed or the drop down list can be shown. Does this type of button have a name because I can't find anything related to it on the internet. How would I be able to make one in .Net or is there already a way of making one?
|
|
|
|
|
I don't know, I just wrote my own, I put an arrow on the right of a button and show a menu when it's clicked on the right edge.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm just getting started with WPF and XAML, and I am trying to create a
traditional menu bar. Everything works until I get to the menu icons. I can
add a bitmap icon to a menu item using this XAML markup:
<MenuItem Header="Log _In">
<MenuItem.Icon>
<Image Source="MenuIcons\Add.png" />
</MenuItem.Icon>
</MenuItem>
However, I want to use vector graphics, rather than bitmaps, for menu icons.
So, I try this markup:
<MenuItem Header = "Log In">
<MenuItem.Icon>
<Image Source="Resources\LogIn.xaml" />
</MenuItem.Icon>
</MenuItem>
I'm getting a design-time error saying that "No imaging component suitable
to complete this operation was found".
What's going on, and what do I need to do to be able to use a XAML
vector-graphic file as a menu item icon? Thanks for your help!
David Veeneman
www.veeneman.com
|
|
|
|
|
Here is the solution I finally implemented: I created a Resource Dictionary that contains the menu item icons I want to use. That gets all of the icons into one convenient container. Then I referenced the individual icon resources in my <MenuItem.Icon> markup. Here are the steps involved:
I used Expression Design to create my XAML icons, one icon per layer. I gave each layer the name of the icon it held. Then I exported the Design file as XAML, setting the Document Format options to:
-- Export as resource dictionary;
-- Group by layers; and
-- Output as drawing image.
I left the effects options as they were.
In VS 2008, I added the resource dictionary to my WPF project, and referenced the dictionary in App.xaml:
<Application.Resources>
<ResourceDictionary Source="MenuIcons.xaml" />
</Application.Resources>
With that done, I simply reference the resource in the <MenuItem.Icon> markup for the window that contains the menu:
<MenuItem Header="Open File">
<MenuItem.Icon>
<Image Source="{StaticResource iconOpenFile}" />
</MenuItem.Icon>
</MenuItem>
David Veeneman
www.veeneman.com
|
|
|
|
|
First I wrote the code where root tree node cannot be deleted when you click on the name of the node. But now I have CheckBox in the properties of the Treeview(tvFavorites) and modifying the code using the checkbox. I dont know how to modify the code using the checkbox. Here is what I tried but it deletes the root node (which I do not want it to).
private void frmFavorites_Load(object sender, EventArgs e)
foreach (DataRow drFolder in dtFolders.Rows)
string str = "";
if (i == 0)
{
//During first time call of the loop
str = tn.Checked.ToString(); //This does not work. //I need to make the change here
//Assign tag Name to the Global variable str
//str contains the rootnode name
}
i++;
}
private void butDelete_Click(object sender, EventArgs e)
{
if (tvFavorites.SelectedNode.Checked.ToString() != str) //And this does not work. I need to make the change here
}
|
|
|
|
|
Why are you using a string? whatever.Checked returns a bool doesn't it? So, why not just use a bool...
My current favourite word is: Bauble!
-SK Genius
|
|
|
|
|
but how should I modify the code to convert it to bool...Not sure
|
|
|
|
|
bool checked;<br />
checked = tn.Checked;
My current favourite word is: Bauble!
-SK Genius
|
|
|
|
|
How should I replace this code "str = tn.Checked.ToString();" to bool checked; and tn.checked without generating any syntax errors
|
|
|
|
|
Ok then, what is 'tn' and what was the error.
My current favourite word is: Bauble!
-SK Genius
|
|
|
|
|
tn is the treenode and if I put bool checked; then it says identifier expected. How should I replace this code str = tn.Checked.ToString(); with this code or how to modify this code further bool checked;
tn.Checked;
|
|
|
|
|
I need to write a C# method that will double the values of 2 variables A and B in the calling program by passing these parameters by reference. I'm not really sure where to begin on this, any help would be greatly appreciated!
|
|
|
|
|
Function:
<br />
public void doub(ref int a, ref int b)<br />
{<br />
a *= 2;<br />
b *= 2;<br />
}<br />
and you would call it like this:
<br />
doub (ref var_name1, ref var_name2);<br />
In my opinion using a function to do that is overkill. Keep in mind that some variable types pass by reference and not value, an example would be String (capital S). If the data type is dark blue it's a primitive (pass by value), if it is light blue it is an object (passes by reference).
Example of primitive types: boolean, int, char
Example of Objects: Form, String
|
|
|
|
|
You've obviously just done this guy's homework for him, I can't see any real world reason to be asking for what he did.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: You've obviously just done this guy's homework for him, I can't see any real world reason to be asking for what he did.
Ahem:
jordanwb wrote: In my opinion using a function to do that is overkill.
|
|
|
|
|
Precisely. I agree, it's overkill, and therefore, odds are 99% that you did his homework.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: odds are 99% that you did his homework.
I agree and he probably also helped him not be able to solve a problem on his own either.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Jordanwb wrote: In my opinion using a function to do that is overkill.
In this case I agree, I'd use even extremely simple function if it increased readability, which is not the case. Performance-wise it's equal, this is going to be inlined.
Jordanwb wrote: Keep in mind that some variable types pass by reference and not value, an example
would be String (capital S). If the data type is dark blue it's a primitive (pass by value), if it is light blue it is an object (passes by reference).
First, .NET System.String type and C# string type are exactly THE SAME type. And it's passed by reference. There happen to be two primitive types that are not value types - string and object. Whenever you make your own type that derives (even indirectly) from <c>ValueType, its passed by value. And guess what, it appears light blue in editor. So wrong, wrong and wrong.
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
You probably just did his homework assignment for him and enabled himn to learn how to mooch off of other people when he can't solve his own problem.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Okay next time someone needs help I won't help him and tell him to stop being a mooch. There you happy?
|
|
|
|
|
No, help them, but don't do it for them.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Any of you fine C# folks care to tackle this problem in an elegant way?
- we have a list of Nodes and we want to group them by parent
- we want to return the Foo attached to each Node, grouped by parent's Foo
Given that:
- each Node knows its parent Node, e.g. someNode.Parent
- the parent Node can be null
- each Node has data attached to it of type Foo, e.g. someNode.Foo
I want a function that takes Nodes and returns their Foos, grouped by parent. (e.g. something that returns Foos grouped by parent Foos)
Any takers?
|
|
|
|
|
Dictionary<ParentNode, List<Foo>> is what you want to return, I'd have thought ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I need it all grouped by Foo. In other words, something like Dictionary<Foo, List<Foo>>
|
|
|
|