|
First: To paste it correctly, use the "encode HTML tags when pasting" option below the message entry box - this replaces the < and > characters with more protable ones.
Second: Try the correct forum - there is one for WPF where you will probably get better help than a dedicated C# forum.
If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
|
See following thread. There is code that will animate the color.
It is in code-behind though, but maybe it's useful.
WPF Forum[^]
hope this helps.
(ps: The code in the thread combines two animations, strip out the color animation)
|
|
|
|
|
Thank You friend .for your reply ...
i have solved the problem ....
solution like these
private LinearGradientBrush Setcolour(string FirstColour, string sSecondColour, Point StartPoint, Point EndPoint, MatrixTransform MatrixTr)
{
LinearGradientBrush lgb = new LinearGradientBrush(GetColour(FirstColour), GetColour(sSecondColour), 0);
lgb.MappingMode = BrushMappingMode.Absolute;
lgb.StartPoint = StartPoint;
lgb.EndPoint = EndPoint;
lgb.Transform = MatrixTr;
return lgb;
}
MainBrush.Fill = Setcolour("#ffffffff", "#ff020202", new Point(141.363, 201.300), new Point(141.363, 252.324), new MatrixTransform(1.000, 0.000, -0.000, -1.000, -81.196, 252.324));
Thank u all ......
|
|
|
|
|
I have developed a user control in .net 2.0 framework. on user control i used table layout panel. to place the controls but in some cases i have to need to put 2 lable in a one cell so i used panel to put the 2 label one was windows lable and another was gobicode html lable in next ce4ll of table layout panel i put the text box. now i have arranged tab indexes properly. and short cut key given to the windows lable as i cant give short key to the gobicode. but in this case short cut for that text box is not working. Please help me.
|
|
|
|
|
Hey guys!
I have a question and I think the answer is 'Remoting', but I want to know for sure. I want to write an application which contains modules. Customers buy the 'base' software. If required, they buy additional modules which enables the software to 'do more'. Now all these modules are seperate projects (and thus seperate dll's). I want the software to check if a module is 'active', and then check for the existance of the dll, if both are OK, the system can reference the dll and use it.
Ofcource all modules are available at design time so referencing the dll's is no problem, but when starting the system with one or more dll's missing i'll receive a JIT Debugger message. Is there a way to not deliver all modules, but only deliver the 'active' modules and change that (change db values and copy the module dll's) without having to compile the software again?
And... Can I also accomplish this without module versioning? What I mean here, is that I may want to change (update or fix) modules which result in a new module dll (and a new version). Can I still use that dll from the 'base' system without having to decompile? (I am aware here, that I need to be very carefull what to change and not change (for example) return value types or so).
Hrmmm... a fairly large story, but I wanted to explain exactly what I want to get a satisfying answer. Since English is a foreign language for me I may have used some unneeded words Cheers guys!
|
|
|
|
|
|
hi,
i have a multithreaded application in which i m downloading files and updating GUI.it runs fine when i debug it but dnt update the GUI when i run it in release mode.tell me where i m wrong?
|
|
|
|
|
Member 590310 wrote: tell me where i m wrong?
By giving us a vague description with no code to review. That's where you are wrong.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
You've asked this very same question before and I asked you to tell us more about the problems you were having and to post some code. But you ignored my (and Luc's) reply and now you just post it again. This day didn't start very well, and you just made it worse...
|
|
|
|
|
private void LoadKeywordsCombo()
{
using (var db = new momdbDataContext())
{
keywordsComboBox.DataSource = db.Books.Select(c=> c.Keywords !=null
c=>new{ID=c.ID,Name=c.keywords});
keywordsComboBox.DisplayMember = "Name";
keywordsComboBox.ValueMember = "ID";
}
}
I'm wanting to somehow select everything from the book table where keywords is !=null and populate my combo box accordingly. i thought it might be the .where() method but i'm not sure
thanks in advance for the help
|
|
|
|
|
Are you sure Keywords is null and not an empty string? Best use the IsNullOrEmpty method.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
could you give an example of how i might use the isnullorempty in this instance ?
what i'm trying to avoid is a combobox witha bunch of blank fields where the keyword isn't added
|
|
|
|
|
Read the documentation, Select take a predicate that returns a bool. string.IsNullOrEmpty returns a bool. Ergo...
keywordsComboBox.DataSource = db.Books.Select(c=> !string.IsNullOrEmpty(c.Keywords))
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hello all, my name is Sundeepan and I am new to this board and to coding as well. To train myself and get familiar with OOP concepts using the C# language I am reading, "Microsoft .NET Framework - Application Development Foundation" book by Tony Northrup. I am finding this book very informative. I do have a question that I was not able to find an answer to by querying Google. The question is as follows:
If a method requires an object as one of its parameters why should one not pass an object of a base class, instead one must pass an object of the derived class?
I understand that this might be a foolish question, but I am at a very early stage of my learning, any help would be appreciated. Metaphors are equally as helpful as a technical answer.
Regards
Sundeepan
http://sundeepinthought.blogspot.com
modified on Friday, February 5, 2010 12:32 AM
|
|
|
|
|
class Animal
{
protected void Foo(){}
}
class Cow : Animal
{
public vod Moo(){}
}
class Farm
{
public void Pet(Animal animal){}
}
If you pass Animal to a method then you can only access the Foo method. However, if you pass Cow, you will have access to both Moo and Foo methods since Cow derives from Animal.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
So if I wrote
class Farm
{
public void Pet(Cow chicken){}
}
I can access both Foo and Moo?
But if I wrote
class Farm
{
public void Pet(Animal man){}
}
then I can only access the Foo method?
Lol..nice example though....clarification is needed if you don't mind
|
|
|
|
|
sundeepan wrote: Cow chicken
and
sundeepan wrote: Animal man
was a really comical. Anyway i don't see any clarification to make since it is just as you say. When you inherit, you get the members you inherit and in addition any member you make in the new class. Just like if someone left you some items to travel to an unknown land ( ) then, you'd have the items you originally owned plus the ones he left you. But he would not have the items you own since you never gave it to them.
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
sundeepan wrote: why should one not pass an object of a base class
Who says you shouldn't? There are many cases where you would.
|
|
|
|
|
This is the paragraph that threw me off:
"Another benefit of inheritance is the ability to use derived classes interchangeably, a concept called polymorphism. For example, there are five classes that inherit from the System.Drawing.Brush base class: HatchBrush, LinearGradientBrush, PathGradientBrush, SolidBrush, and TextureBrush. The Graphics.DrawRectangle method requires a Brush object as one of its parameters however, you never pass an object of the base Brush class to Graphics.DrawRectangle. Instead you pass an object of one of the derived classes. Because they are each derived from the Brush class, the graphics.DrawRectangle method can accept any of them. Similarly if you were to create a custom class derived from the Brush class, you could also pass an object of that class to Graphics.DrawRectangle. "
|
|
|
|
|
It sounds like the author isn't a very good technical writer. Which is one of my complaints about mass-market programming books. And one of the benefits of taking a class with a real live teacher -- you can ask the teacher for clarification.
That may not be a good example -- System.Drawing.Brush is abstract, so you can't have an instance of it anyway. But if you do have an instance of it, then you could go right ahead and pass it (but who knows what would happen).
|
|
|
|
|
Its a "Microsoft Press" book for the 70-536 cert exam...this guy better be a good technical writer lol!
|
|
|
|
|
I actually almost say the contrary is true.
Mark Nischalke's answer holds true, you do have access to both the Moo() and Foo() methods by passing the subclass. However to do so couples the method to the subclass, and other instances of the animal class cannot be passed:
class Program
{
static void MakeAnimalSpeak(Animal animal)
{
animal.MakeNoise();
}
static void MakeAnimalSpeakCoupled(Cow animal)
{
animal.MakeNoise();
}
static void Milk(Cow animal)
{
animal.Milk();
animal.MakeNoise();
}
static void Main(string[] args)
{
Cow cow = new Cow();
Duck duck = new Duck();
MakeAnimalSpeak(cow);
MakeAnimalSpeak(duck);
MakeAnimalSpeakCoupled(cow);
Milk(cow);
}
}
abstract class Animal
{
public abstract void MakeNoise();
}
class Cow : Animal
{
public override void MakeNoise() { Console.WriteLine("Moo"); }
public void Milk() { Console.Write("Sloooosh"); }
}
class Duck : Animal
{
public override void MakeNoise() { Console.WriteLine("Quack"); }
}
Of course it is horses for courses, as with everythign in the code world. In the example Mark gave, you should pass the cow if you need access to both Moo() and Foo() but otherwise IMO is is better to pass an Animal instead. Better yet, coding to Intefraces produces cleaner results still, and helps with testing (as mock objects can be passed more easily)
Cpianism: I have a negative number in my Rep so please fix it.
Chris Maunder: That isn't a bug.
|
|
|
|
|
This is great, I like the humor involved too. I am saving this reply as a PDF on my computer.
Thanks again!
|
|
|
|
|
Hi,
I had a question regarding the Windows Aero Glass Feature, found in Windows API Code Pack. This feature is not included in Windows XP and Vista, I believe. So if the GlassForm is shown in Windows XP, will an error be thrown? or will the GlassForm window be shown, without the aero feature and without anyerror error?
To be more clear: What will happen if the GlassForm is show in Windows XP/Windows Vista?
Thanks,
Harsimran Singh
|
|
|
|