|
I see,
That requires a screen clear after setting the new colour. Try the following code to see it happen.
Console.BackgroundColor = ConsoleColor.Blue;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("hello");
Console.ReadLine();
Console.Clear();
Console.WriteLine("hello again");
Console.ReadLine();
Alan.
|
|
|
|
|
Great, It works.
Console.BackgroundColor = ConsoleColor.Blue;
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Clear();
Console.WriteLine("hello again");
Console.ReadLine();
|
|
|
|
|
Hey all,
I using GetWindowRect with this struct
[StructLayout(LayoutKind.Sequential)]<br />
public struct RECT<br />
{<br />
public int X;<br />
public int Y;<br />
public int Width;<br />
public int Height; <br />
}
However the sizes returned are not correct, any clue why?
1680 x 1050 returns 1686 x 1082
1280 x 1024 returns 1291 x 1061
1440 x 900 returns 1451 x 937
Only the last 2 have the same difference.
|
|
|
|
|
Could it be including the non client area ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
|
What you probably did is maximize a window and ask for its size, then compare that to the screen resolution; your conclusion should not be GetWindowRect is wrong, your conclusion should be a maximized window is set slightly larger than the screen size, which you can clearly see when looking carefully.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hey all,
I using GetWindowRect with this struct
[StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int X;
public int Y;
public int Width;
public int Height;
}
Your structure is wrong. Its not Width and Height its Right and Bottom.
To get the height and widht you need to subtract the Right from X and the Height from Y
In all actuallity RECT in the SDK is definded as
public struct RECT
{
public int left;
public int right;
public int right;
public int bottom;
}
Width = right - left
and
Height = bottom - top
Bob
|
|
|
|
|
Which control can I use for displaying bulleted list?
> A
> B
> C
When I click A, there should be a gridview/panel which will be displayed.
Thanks
------------------------------------------------------------
"The only true wisdom is in knowing you know nothing." --Socrates
|
|
|
|
|
You have two separate issues here, 1) displaying a bulleted list and 2) displaying a panel on click. First though, tell us what platform you are using, Web or Windows. The answers will vary for both.
only two letters away from being an asset
|
|
|
|
|
Thanks Mark. Web platform is what I am using. I found the ajax collapsible panel but not sure if something better can be used here.
------------------------------------------------------------
"The only true wisdom is in knowing you know nothing." --Socrates
|
|
|
|
|
|
Hello all!
I am developing an app based on a Windows Form (Windows Application). My IDE is Visual Studio 2008.
I downloaded an example application (Console application) which used an external reference and everything went OK. Then I imported that reference into my Windows Application, and it crashed in runtime with the following exception:
'System.TypeInitializationException'
Then I realized that, in the add reference dialog, some of the DLLs appear in light grey (not selectable), whereas in the console application all of them can be selected.
¿what's the matter with this?
Thanks in advance!!!
|
|
|
|
|
Probably :
1. You don't have the license to use that reference ?
2. You don't initialized like in console application.
|
|
|
|
|
1.It makes no sense, because I can reference it in a Console App, ¿why can't I in a Windows Form App?.
2.¿Is it different to initialize in a console App and in a Windows Forms? How can I make it?
Thanks!
|
|
|
|
|
Hello all,
I have just started programming with c# (2008). The only programming experience that i have ever had is visual basic. I am only 12 years old. I have purchased a c# 2009 for dummies book and that does not seem to help my current problem. My problem is that I am unable to write things. This is what i mean:
Console.WriteLine("Enter your name:");
Above both the brackets i get a red line and a error saying "invalid token '(' in class, struct, or interface member declaration.
I also get the same message for the other bracket.
"invalid token ')' in class, struct, or interface member declaration.
I have tried everything and asked everybody however know one seems to know a solution, I would deeply appreciate if anybody woul help me.
Thank you,
Aman
modified on Tuesday, August 4, 2009 4:44 PM
|
|
|
|
|
Hello World C#
Go through this tutorial. It should help get you on the right start. You can even download the code and try to compile that by itself. If that fails to compile then you may have issues with how your directories are set up. Best of luck!
|
|
|
|
|
Dear VengefulSakhmet,
Thank you very much. May i know here to find your tutorial?
Thank you,
Aman
|
|
|
|
|
You see at the top of the message the 'Hello World C#' bit?
Click on it, it's a link. The different colour, sort of gives this away.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Dear Henry Minute,
Thank you very much for the totorial, i am sure that i will find it very usefull.
Sorry for the trouble,
Aman
|
|
|
|
|
Dear HenryMinuite,
Man i used your totorial and i did nto find it usefull FOR my problem. The brackets still go red no matter whati try. I even trying copying and paisting it but it still does not work. I Copied the command that writes thing on the launch of the program but it still apears red. Would it help if i paist my script for you to understand and hopefully help?
Thank you,
Aman
|
|
|
|
|
Dear Aman,
The tutorial I had posted at the top called "Hello World C#" should work correctly. Perhaps your directories and libraries are not properly set up. Take a look at: Visual Studio Getting Started. I would go to the FAQ section and look up installation procedures. Also post your full code. I assume you are trying to write a small program for starters, so it shouldn't be hard to tell if your program would compile properly in the right environment. Best of luck!
-Laurel
|
|
|
|
|
Hello,
I asumed that at first. However all my previous programs had worked properly without a error, I even copied and pasted it but the brackets still have the red line underneath. I have not touched the settings, Anyway i will look at the getting started thing. Thank you very much for helping me. I hope that it will help me a lot and fix my unusual problem.
Thank you for all your support,
Aman
|
|
|
|
|
Hi Guys,
this is my first post on Code Project, becouse everything i needed help I found on this forum, but for this inssue o don't find the answer.
So, my problem is:
- I have a class that implements an Interface e.g:
public interface IMyclass
{
string Name {get; set;}
}
public class Myclass : IMyclass
{
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
}
In one method I need return an IList<IMyclass> created as a List<Myclass> like this:
public IList<IMyclass> CreateList()
{
IList<Myclass> listMyclass = new List<Myclass>();
return (IList<imyclass>)listMyclass;
}
and the code that call the class expect a return of IList<IMyclass>, but this form generate an error saying that this cast is not possible.
anyone have an idea to solve this problem? I'm using Visual Studio 2005.
Thanks.
Ubirajara Mendes
|
|
|
|
|
I'm not sure why you've received an error... (please post the exact error message and text) but you should simply be able to do this:
public IList<IMyclass> CreateList()
{
return new List<Myclass>();
}
Adam Maras | Software Developer
Microsoft Certified Professional Developer
|
|
|
|
|
Hi Adam,
that is the exception:
Cannot implicitly convert type 'System.Collections.Generic.List<Teste.App.Myclass> to 'System.Collections.Generic.IList<Teste.App.IMyclass>. An explicit conversion exists (are you missing a cast?)
Ubirajara Mendes
|
|
|
|