|
I have a program developed in C#. The form's WindowState property is set to Maximized, but when i change the resolution than the window doesn't fits on the screen.
Any ideas, what to do so that whatever the resolution is windows adjusts accordingly
|
|
|
|
|
Oh boy!
You will have to work on that. It's not a trivial problem, the best advice I can give is to suggest you start here: MSDN Automatic scaling in Windows Forms[^]
You may find that by using Panels and following the article you may be able to do it. But it would be better to re-design your app so you don't have a single, really busy, form...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
Or to use WPF - defining xaml's without any width/height information is just SO possible in WPF, making all windows fit to any screen or device.
Michael Mogensen
|
|
|
|
|
Indeed - but since the post is in the C# forum, rather than the WPF, I have to assume that the OP doesn't know WPF...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
Nouman Bhatti wrote: I have a program developed in C#. The form's WindowState property is set to Maximized, but when i change the resolution than the window doesn't fits on the screen.
Any ideas, what to do so that whatever the resolution is windows adjusts accordingly
Go to the computer-store and look at the screens. They come with different height/width ratios, which means that a perfect circle on screen 1 might look like an ellipse on screen 2. The resolutions only scale well if the aspect-ratio remains equal. The VS drag&drop IDE is not a WYSIWYG-editor.
You could design different form-layouts to fit each, but that would amount to a lot of work.
The best idea is to have controls that can grow/shrink to fill up any extra space. A label would not adjust anything, a datagridview would fill up the form.
I are Troll
|
|
|
|
|
You solution may be easier than you think. If you are referring to form elements like text boxes, buttons, etc... then you should experiment with the Anchor properties of those controls.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
hey guys..i want to open a new form inside my MainForm when i click datagridview cells.. to do that i wrote these
dtyfrm = new DetayForm();
dtyfrm.MdiParent = this;
dtyfrm.Show();
but when i wrote this my Up-Down buttons dont work on the datagridview and when i delete thse block and try it they work
my KeyDown even is like that
so what is wrong now ?
|
|
|
|
|
erdinc27 wrote: so what is wrong now ?
1. Your code is all commented out so there is nothing to do.
2. If you uncomment it you have try catch blocks that ignore any caught exceptions.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
try
{
if ((e.KeyCode == Keys.Down))
MessageBox.Show(" ");
try
{
if ((e.KeyCode == Keys.Up))
MessageBox.Show(" ");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
hey friend thanks for reply...i uncommented my codes but it doesnt give any error and the up-down buttons
and it doesnt move up-down
|
|
|
|
|
What the ....??
First, this code cannot possibly throw an exception, so why even bother with the Try/Catch blocks?? Remove them...
if (e.KeyCode == Keys.Down)
MessageBox.Show(@"Down");
if (e.KeyCode == Keys.Up)
MessageBox.Show(@"Up");
|
|
|
|
|
I was unable to respond earlier due to the move. However, as Dave says, why on earth are you using try catch around such simple code? No, don't answer that. I am still not sure why you think it necessary to capture the key events, since the gridview will do most of the work for you. Perhaps you could explain why you are doing it this way.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Trivi: You did'nt forget to += your KeyDown handler or some code removed it later?
As a last way out install a WndProc like
protected override WndProc( ref Message m )
{
// Do whatever here...
base.WndProc( ref m ); // May or may not need this call.
// ...or here.
}
I'm not updated on how messages are handled/filted for your grid type, byt this can be a last way out giving you a chance to milk msg's before they go in. The right word for this method should have been PreTranslateMessage(MSG*) like in the MFC days.
Michael Mogensen
|
|
|
|
|
hey guys
thanks for your help..the things i learnt are very usefull really
|
|
|
|
|
hi all
in neural networks algo of face detection a term is used a lot " training neural network". what does it mean? and a file is used with extension of NNCP which is loaded first. as for as i know that file contains different patterns of faces. i wana implement the neural network algorithm but i don't understand how to train neural network and how to make this NNCp file which contains different face paterens.
any suggestions links will be appreciated.
thanks
|
|
|
|
|
Please stop multi posting the same question.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
This is where you EARN your passing grade, and your degree, by doing your own research.
If this topic is something you picked, then you bit off more than you can chew before the end of the class. If it was assigned to you, then you've already been presented the materials during the class to get the job done.
|
|
|
|
|
yes sir i started my own research now.
|
|
|
|
|
If you spent as much time researching NNWs as you have posting here and here[^] you'd know at least how to train one.
Really, you need to look for a new project, you just won't cope with the one you have.
|
|
|
|
|
i understood the Neural Networks now by my self.
|
|
|
|
|
Except you don't: you don't even know what training a NNW is, this falls under the category "Basics".
|
|
|
|
|
I suggest you go and talk to Prof. S.M. Aqil Burney, you can get his e-mail here University of Karachi CS Faculty[^] he seems to be the expert at your Uni. I also suggest you stop spamming the lounge.
|
|
|
|
|
|
inayathussaintoori wrote: who are you
He is the one giving you good advise.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
Read my profile[^] on the code project, it's all there.
|
|
|
|
|
I have a dialog where I need to return a result. The result can be either a "standard class defined value" (an enum) or a user defined value (an int).
So I end up with something like:
enum SomeEnum
{
Val1 = 1,
Val2 = 2,
Val3 = 4,
Custom = 8
}
public SomeEnum Result
{
get
{
...
}
}
public int UserResult
{
get
{
...
}
}
The idea here is that if Result is Custom, they call UserResult to get the custom value. I'm not really keen on that idea because they have to look at 2 properties.
I could cast Result to an int and return it that way, but that idea, I'm not really happy with either because they'll be using the built in values 75% of the time, so having the code littered with casts isn't that great.
I could return (or accept) both as object, but that'd be a lot of "if (Result is ...)" checks.
On the drive in to work, I thought about having the user derive an enum from the built in enum and extend it, but apperently C# doesn't allow that .
Any other ideas?
|
|
|
|