|
Where is the map coming from ? Showing a scrolling image and jumping to parts of it is trivial, so long as the image is in your control.
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 )
|
|
|
|
|
yes yes the image is totally mine. i will have total control over it. SO what do i need to do........... also please give me some links to stuff that you feel i could learn from or make use of. Thanks a lot..........
|
|
|
|
|
Hi all ,
I have to acess some function just after every statement, so do i need to make one more class that will contain all frequently used functions and global variables. or is there any other way to do them..
as an example..
class abc{
public int a;
public void XYZ();
}
void XYZ()
{
//do something
abc();
//do something
abc();
//do something
//abc();
}
and abc internally calling someother function...
so what need to do for this abc ....
T@SU
|
|
|
|
|
Why not implement the freq. used function "abc" in the class "abc"? (BTW: bad naming )
|
|
|
|
|
I'm just getting started with VS 2008. I thought I'd start by creating a fairly standard WinForms-style UI, but do it in a WPF app, instead of a WinForms app. I haven't had any luck finding tutorials or walkthroughs on creating WPF UIs with VS 2008. Can anyone suggest a good walkthrough or article? Thanks.
David Veeneman
www.veeneman.com
|
|
|
|
|
check the MSDN page for webcasts on WPF - there are some great ones (I've mostly seen german webcasts but I'm rather sure that there are some great english ones as well).
WPF is a huge theme so you might even consider buying some book(s?) on it.
Best think is that the old MCF-like eventhandling is back (from child to parent) and even improved, databinding has improved much and the 3D support is just lovely - downsides are: no MDI support (as far as I know), no dockable windows etc.
|
|
|
|
|
Thanks. There is a DockPanel container, which I think is designed for window docking. And while there is no explicit MDI support, MDI-style interfaces look like they can be done fairly easily by nesting panels.
Unfortunately, there aren't any VS 2008 books out yet. I'm going with the Manning book, WPF in Action with Visual Studio 2008. It's not being published for a while, but most of the chapters are available online.
David Veeneman
www.veeneman.com
|
|
|
|
|
well the DockPanel is a layout container - nothing more - you don't get run-time docking or the menu/toolbar-sharing of the MDI windows.
You don't need the VS2008 Books - not much has changed for WPF-programming. I have the "Pro WPF" from MacDonald in front of me (.NET 3.0) and can only recommand it - of course another WPF Petzold is allways good
|
|
|
|
|
I found an MSDN hands-on lab to create a line-of-business application using Expression Blend as the designer. The lab can be found here[^].
David Veeneman
www.veeneman.com
|
|
|
|
|
Have you looked at articles by Josh Smith or Sacha Barber on this site? They both have written some really top-notch articles on WPF...
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi all,
[color=darkred]I had database and coded class. I just want mapping xml to use NHibernate. [/color]
MyGeneration generates code from database. If I use it, I'll have to merge my old file with new generated class. It's too risk. Am I wrong ? (maybe I don't know enough about MyGeneration)
ActiveRecord is the same.
I'm reading about codesmith [^] , maybe it's good.
Are there any other tool ?
Thanks
imagic
imagic
|
|
|
|
|
|
I advise you to steer away from any tool that does code-generation. They tend to get you 90% of the way there quickly - but the other 10% can be very difficult.
How much code is in your existing classes? If your code is well segregated - you have taken care with "seperation of concerns" - then you should be about to drop in a new data layer solution.
Our ORM tool Diamond Binding[^] is highly suited for creating and maintaining the business object definitions from an existing database, and providing a fully featured API for handling business objects. It also is powered by NHibernate.
|
|
|
|
|
In an application (c#) that i am making, i've found i need to make a more complex listbox/listview than what is in the .net framework. I'm trying to display more than just a value(item), but i want a picture and other ideas. To best implement this idea i've come up with a custom control i'm planning on building.
This custom control will look very similiar, if not the same as the "listbox" in WindowsXP's controlpanel->Add or remove programs.
Basically there is a list of ordinary listboxitems in a listbox. The only difference is when you click on an item, it expands downward, pushing other items down, and showing an image and a few buttons in relation to the selected ListBoxItem.
If anyone has any idea how i would go about creating this control or would like to help me i would appreciate it. It would probably contain "EnhancedListBoxContainer" and "EnhancedListBoxItem" controls.
Thank You.
|
|
|
|
|
Not too difficult really, but a good idea.
Basically, you will have to handle the drawing yourself.
Each item will be as wide as the control, and as high as the text (or therabouts). You draw the picy on the left, and the text about 20px in (assuming the picture to be about 16*16)
Probably you could have a variable for the currently selected (expanded) item, so that when it is drawn you know to draw the extra info, and set different colours.
As for drawing each control, have a variable for the current y position, start at 0. Draw an item and find its height, add its hieght to the variable. The next control starts drawing at this y value. Of course, be sure not to draw below the bottom of the control, its just a waste (ie, when your y variable is greater than the height of your control).
These are just my ideas, and i'm sure they could be improved upon.
My current favourite word is: Bauble!
-SK Genius
|
|
|
|
|
Hi,
you can use a regular ListBox with:
- instances of some class in the items collection (doesn't have to be strings!)
- owner-drawn (with constant or variable item height) meaning you have to provide a method
to paint a single item any way you like
- in your app a selected item would take a larger height
This is an example.[^]
|
|
|
|
|
Thank you for your reply's.
I was actually thinking about the idea of a tall item. Then you could place a control the size of that item and put it ontop of the item. It would work well.
That example also was helpfule too.
I decided to ask some people if they preffered 1.)this idea, or 2.)instead to simpley have a listbox with normal items and all, and then put the information on the buttom (of the listBOX) ALWAYS instead under the selected item (3rd idea is a panel that appears after hovering over an item, but it got no votes).
3/4 people liked the second idea.
1/4 1rst idea.
I'm going to go with the public on this one since they ARE the ones who use it, and choose the 2nd idea. Afterall it is much simpler to implement. Thank You Again.
|
|
|
|
|
I am attempting to make a method such as the following:
1 public static void foo<T>(T unknown) {
2 PropertyInfo[] tProps = typeof(T).GetProperties();
3 foreach (PropertyInfo pi in tProps) {
4 foo<pi.PropertyType>(pi.GetValue(unknown, null));
5 }
6 } I get the following compiler error on line 4: "The type or namespace name 'pi' could not be found (are you missing a using directive or an assembly reference?)". Is there any way for me to recursively call this method as logically indicated by the code above? Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
You need to know the Type at compile time.
|
|
|
|
|
I found that ComboBox does not allow to enter data using foreign keys.
To reproduce:
1. Run code
2. Enter Walter from keyboard
3. Click button.
Observed:
J
Expected:
W
How to fix ?
using System.Windows.Forms;<br />
using System.Collections.Generic;<br />
<br />
class testForm : Form {<br />
<br />
Storage s = new Storage();<br />
<br />
testForm() {<br />
Customer c = new Customer();<br />
c.Id = "J";<br />
c.Name = "John";<br />
<br />
List<Customer> l = new List<Customer>();<br />
l.Add(c);<br />
c = new Customer();<br />
c.Id = "W";<br />
c.Name = "Walter";<br />
l.Add(c);<br />
<br />
ComboBox cm = new ComboBox();<br />
cm.DisplayMember = "Name";<br />
cm.ValueMember = "Id";<br />
cm.DataSource = l;<br />
<br />
s.CustId = "W";<br />
<br />
cm.DataBindings.Add("SelectedValue", s, "CustId");<br />
<br />
Controls.Add(cm);<br />
Button b = new Button();<br />
b.Top = 80;<br />
b.Click += new System.EventHandler(b_Click);<br />
Controls.Add(b);<br />
<br />
}<br />
<br />
void b_Click(object sender, System.EventArgs e) {<br />
if (s.CustId == null)<br />
MessageBox.Show("Empty combobox must store null value");<br />
else<br />
MessageBox.Show(s.CustId.ToString());<br />
<br />
}<br />
<br />
class Customer {<br />
public string Id { get; set; }<br />
public string Name { get; set; }<br />
<br />
}<br />
<br />
class Storage {<br />
public string CustId { get; set; }<br />
}<br />
<br />
static void Main() {<br />
Application.Run(new testForm());<br />
}<br />
}
Andrus
|
|
|
|
|
When you type in Walter, the items bound are not selected. You can either set the drop down style to DropDownList, forcing user to select from the list, or you can use a custom control that "search" for "Walter" in the list while you type, and set the selected index if it is able to match the serach. IIRC there's such a combobox here on CodeProject.
|
|
|
|
|
If I have these classes...
public class TestClass
{
}
public class TestCollection : List<TestClass>
{
}
... and I pass an instance of the TestCollection class to this...
public static void MyMethod(object ListObject)
{
}
... I can use reflection to get loads of info about the TestCollection (ListObject) class.
What I can't figure out is how to use reflection to get the <T> (in this case TestClass) as this is the class I need to know about the properties for.
Dave
modified on Monday, December 17, 2007 3:38:19 PM
|
|
|
|
|
Hopefully this code will help you reflect on the problem (pun semi-intended):
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
namespace GenericReflection
{
class Program
{
static void Main(string[] args)
{
List<int> intList = new List<int>();
DisplayGenericInformation(intList);
}
static void DisplayGenericInformation(object genericObject)
{
DisplayGenericInformation(genericObject, 0);
}
static void DisplayGenericInformation(object genericObject, int indent)
{
Type genericObjectType = genericObject.GetType();
WriteIndented(genericObjectType.Name, indent);
foreach (Type argumentType in genericObjectType.GetGenericArguments())
{
WriteIndented(argumentType.Name, indent + 1);
DisplayGenericInformation(argumentType, indent + 2);
}
}
static void WriteIndented(string message, int indent)
{
while ((indent--) > 0)
{
Console.Write(" ");
}
Console.WriteLine(message);
}
}
}</int></int>
|
|
|
|
|
Thanks, it's helped a little but there is still a problem as commented in this ammended version of the code you supplied.
using System;
using System.Collections.Generic;
using System.Reflection;
namespace GenericReflection
{
class Program
{
class MyClass
{ }
class MyCollection : List<MyClass>
{ }
static void Main(string[] args)
{
List<MyClass> intList1 = new List<MyClass>();
DisplayGenericInformation(intList1);
Console.WriteLine(Environment.NewLine);
MyCollection intList2 = new MyCollection();
DisplayGenericInformation(intList2);
Console.WriteLine(Environment.NewLine);
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
static void DisplayGenericInformation(object genericObject)
{
DisplayGenericInformation(genericObject, 0);
}
static void DisplayGenericInformation(object genericObject, int indent)
{
Type genericObjectType = genericObject.GetType();
WriteIndented(genericObjectType.Name, indent);
foreach (Type argumentType in genericObjectType.GetGenericArguments())
{
WriteIndented(argumentType.Name, indent + 1);
DisplayGenericInformation(argumentType, indent + 2);
}
}
static void WriteIndented(string message, int indent)
{
while ((indent--) > 0)
{
Console.Write(" ");
}
Console.WriteLine(message);
}
}
}
|
|
|
|
|
That makes sense because you'd need to look at the base type information for the classes. Since I don't really know what the structure of the code is like and what you're going to expect I can't provide a better example, but you could change it too something like:
using System;
using System.Collections.Generic;
using System.Reflection;
namespace GenericReflection
{
class Program
{
class MyClass
{ }
class MyCollection : List<myclass>
{ }
static void Main(string[] args)
{
List<myclass> intList1 = new List<myclass>();
DisplayGenericInformation(intList1);
Console.WriteLine(Environment.NewLine);
MyCollection intList2 = new MyCollection();
DisplayGenericInformation(intList2);
Console.WriteLine(Environment.NewLine);
Console.WriteLine("Press any key to exit");
Console.ReadKey();
}
static void DisplayGenericInformation(object genericObject)
{
DisplayGenericInformation(genericObject, 0);
}
static void DisplayGenericInformation(object genericObject, int indent)
{
Type genericObjectType = genericObject.GetType();
WriteIndented(genericObjectType.Name, indent);
foreach (Type argumentType in genericObjectType.GetGenericArguments())
{
WriteIndented(argumentType.Name, indent + 1);
DisplayGenericInformation(argumentType, indent + 2);
WriteIndented("Base:" + argumentType.BaseClass.Name, indent + 1);
DisplayGenericInformation(argumentType.BaseClass, indent + 2);
}
}
static void WriteIndented(string message, int indent)
{
while ((indent--) > 0)
{
Console.Write(" ");
}
Console.WriteLine(message);
}
}
}</myclass></myclass></myclass>
|
|
|
|