|
I believe if you use the Windows.Screen.Bounds value to determine the bounds of the screen this will tell you where that particular screen resides with respect to the entire virtual desktop. Then set the StartPosition property of your form to the bounds position for the screen. You can also use the Location property to change the position of form at runtime.
You can also use the SystemInformation.VirtualScreen Property to determine maximum virtual space for your multiple monitors. This will also tell you if there are negative coordinates for the virtual desktop.
Good Luck!
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Thanks, but I found and tried all this. My main desktop is on the right, but the virtualScreen does not hafve any negative numbers, nor does drawing beyond my desktop on the one draw to the other. This would probably work *if* I had a dual monitor setup where they were considered a single desktop, but then it would work just by getting the bounds of the current desktop.
Have you got two monitors ? I'm keen to know if you've had success with this method.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile.
- Jamie Hale, 17/4/2002
|
|
|
|
|
The experience that I have had with multi-monitor support has shown me that each screen comprises a sub-rectangle in the entire large screen. The primary monitor will always be located at (0,0), for backward compatibility.
I am curious what the bounds value for each screen returns. Are they both located at (0,0), or are they arranged logically on the virtual desktop like the documentation suggests.
What does the virtual desktop setting return? Does it still not return a very large rectangle where both of your monitors are found?
I don't have Visual Studio .Net at home, so I can't really test this, but I have done it with Visual Basic. From reading the documentation, I believe that Visual Basic and C# perfrom this operation in much the same way. I do not know if this will help you, but there is a VB sample in MSDN called MultiMon.exe.
If I come up with something else I will let you know. Good Luck.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
kilowatt wrote:
The experience that I have had with multi-monitor support has shown me that each screen comprises a sub-rectangle in the entire large screen. The primary monitor will always be located at (0,0), for backward compatibility.
That can be true, if the computer is set up to treat the monitors as one large desktop.
kilowatt wrote:
I am curious what the bounds value for each screen returns. Are they both located at (0,0), or are they arranged logically on the virtual desktop like the documentation suggests.
No, they return co-ordinates arranged as if they were one desktop. But if I draw onto my primary desktop to negative co-ordinates in the X direction, nothing appears on my secondary monitor, which is on the left.
kilowatt wrote:
What does the virtual desktop setting return? Does it still not return a very large rectangle where both of your monitors are found?
It returns a large rectangle, my problem is that I cannot use any values I get from Screen to actually access the secondary desktop.
kilowatt wrote:
I don't have Visual Studio .Net at home, so I can't really test this, but I have done it with Visual Basic. From reading the documentation, I believe that Visual Basic and C# perfrom this operation in much the same way. I do not know if this will help you, but there is a VB sample in MSDN called MultiMon.exe.
Is it VB.NET ?
kilowatt wrote:
If I come up with something else I will let you know. Good Luck.
Thanks for your help. I expected it to work the way you are suggesting, or expose a method to actually *access* a screen, but it doesn't appear to be the case.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile.
- Jamie Hale, 17/4/2002
|
|
|
|
|
I just came back to let you know I am an idiot I had my app set to full screen, which overrode my other settings, which is why this did not initially work. While I had found all this stuff before, it was your post that made me go back to play with it again and find my error, so thanks a million.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile.
- Jamie Hale, 17/4/2002
|
|
|
|
|
Your Welcome!
I am glad that you figured it out.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I've been through the properties a bajillion times - could someone please tell me where Microsoft have hidden the option for an edit box to only accept numbers ?
Thanks
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile.
- Jamie Hale, 17/4/2002
|
|
|
|
|
Its not there
There is a masked edit box control here, you can borrow the simple code from that
It might even be simpler than overrideing Key*, just override IsInputKey/Char and return false for anything but numbers, '.', and ',' then you only need to check for double decimal separators.
James
Simplicity Rules!
|
|
|
|
|
Thanks. My first thought was to override OnChar and check for myself, but I thought that surely C# couldn't be so pathetic as to leave out edit boxes for numbers only ? I guess I was wrong.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile.
- Jamie Hale, 17/4/2002
|
|
|
|
|
Christian Graus wrote:
I thought that surely C# couldn't be so pathetic
Not C#, Windows Forms :-P
James
Simplicity Rules!
|
|
|
|
|
Another solution, if all you want is a basic TextBox with the ES_NUMBER style applied...
public class NumericTextBox : System.Windows.Forms.TextBox
{
private const int ES_NUMBER = 0x00002000;
public NumericTextBox()
{
}
protected override CreateParams CreateParams
{
get
{
CreateParams createParams = base.CreateParams;
createParams.Style |= ES_NUMBER;
return createParams;
}
}
}
|
|
|
|
|
I do it in KeyPress .
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
An Extender Provider is even more fun, since you can then attach it to any control that accepts key input. A ComboBox is the most obvious other control that this would be useful for.
I just happen to have written one too, but of course, i'm too lazy to do anything about it.
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
I have not found any reference on how to create a wizard dialog (Back/Next/Finish) in C#. I know the property pages were the way to go in C++/MFC, but I don't know if it applies here. I couldn't find any documentation in MSDN.
Any suggestions?
Thanks,
Derek
|
|
|
|
|
Well I've thought about the same issue.
Actiprosoftware makes a control to create wizards although I haven't tried it. I've used some of their other controls which seem to work OK.
http://www.actiprosoftware.com/products/dotnet/wizard/default.asp
If you try it, would interested in feedback
|
|
|
|
|
Thanks - I did see that, but for such a "simple" task, I hate to add another 3rd party control to maintain and upgrade.
I'll keep searching and if I find an answer I'll make sure I post a reply here!
Derek
|
|
|
|
|
I agree. If you find any info on wizards, I would love to take a look at it, so feel free to publish it.
|
|
|
|
|
why just don't create one ??
you only have to make some panel with the things you need in and calculate the number of panel(windows) in an array and play with Next and Back using the array
|
|
|
|
|
As soon as I am finished cleaning/polishing my solution to another gap in .NET (The Header common control), I was going to take a look at implementing the Propery Sheet/Wizards as well. I will let you know...
Regards
|
|
|
|
|
I wonder if anybody could give me an advise on how a OleDbDataAdapter with Microsoft.Jet.OLEDB.4.0 provider can open a database with password !!!
a sample string would really help !
thanks.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
Mazdak wrote:
a sample string would really help
Does something like the following do anything for you?
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=f:\data\SomeData.mdb;User ID=SomeUser;Password=SomeUsersPassword"
Regards...
|
|
|
|
|
Thanks.
I use this string but it caused run time error:
connString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\\..\\Tennis.mdb;User ID=Admin;Password=mazy";
Any suggestion?
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
Nope, Tell you the truth, It's been a while since I have used OLEDB under the JET engines. I have been using the MSDE version of SQL Server for development.
What is the runtime error?
Regards
|
|
|
|
|
Neil Van Note wrote:
What is the runtime error?
When the messagebox appear,in the place of error message there is no message and its empyt.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
When I run this,
using System;
namespace trim
{
public class trim
{
static void Main()
{
string str = "Senkwe ";
Console.WriteLine(str.Length);
str.Trim();
Console.WriteLine(str.Length);
}
}
}
I get an output of 10 each time. Am I using trim improperly? I even tried specifying an array of characters to be reomoved ie char[] myChars = {' '}; and it still didn't work.
Any ideas?
Regards
Senkwe
Just another wannabe code junky
|
|
|
|