|
I think you're better of googling for a tutorial or on article on this matter than asking about it here.
|
|
|
|
|
Keep the data access methods away from the GUI.
|
|
|
|
|
PLEASE HELP,
All of the sudden, EVERY control on my winform has gone.
All of the files and source code are still there for all controls, and the program compiles and runs, but every single control, other than the menu bar have gone.
I have tried to reseach on the net, but I cant seem to find out what is going on.
Please does anyone know what I may have done.
Thank you
Steve
|
|
|
|
|
stephen.darling wrote: Please does anyone know what I may have done.
No. I trust you're capable of unthinkable things.
Here is a suggestion (after you have made a backup just in case):
- open your main (or only?) Form in Visual Designer
- click the Form
- watch for the Properties pane, it should now show the properties of that Form
- on top of it is a ComboBox listing all the Controls (and Components) that sit on that Form; pick one, say a pretty large one, maybe ECGdisplay
- now the Properties pane shows its properties, which you can edit by clicking and typing all inside the properties pane.
- check the Visible property, check the Size property, check the Location property
- if that doesn't help, check you didn't accidentally cover up everything with a huge object, say a Panel: click somewhere and watch what the ComboBox now shows.
Happy hunting!
BTW: when a reply is pretty good/pretty bad, it wouldn't hurt if you voted it up/down. That is how people get their reputation updated after all.
|
|
|
|
|
Hi Luc,
Well that didnt help (God only knows what Iv managed to do )
Thank you anyway, and as for the voting, forgive me, I didnt realise.
Ill do that from now on.
Thank you
Steve
|
|
|
|
|
stephen.darling wrote: that didnt help
That is not very informative.
Are the controls still listed in the ComboBox? if so, it must be some minor detail.
If not, all may be lost indeed. Unless you have more than one Form (maybe accidentally) and are looking at the wrong one.
You could close VS and restart it.
Or even close VS and reboot.
If it was a bug in VS, that would probably solve it.
It it was you doing something very wrong, that would most certainly further reduce your chances.
|
|
|
|
|
I have restarted VS, all is the same.
I have only one main form, with 2 picturebox controls, a tab control, main menu bar, status bar, and my ecg display.
The main menu and status bar are still there.
All the code appears to be unchanges, and the program compiles without any errors.
All of the controls are listed in the form.resx.cs file, and I tried to add this.addcontroll code manualy like was sugested after searching on the net but this just raised may errors so I deleted the lines.
This has me realy baffled, it happened suddenly and I had not placed any control or code, I simply ran the program.
Steve
|
|
|
|
|
If you're in Belgium right now, you get up real early man...
V.
|
|
|
|
|
Since it compiles and I guess you use your controls in code, the controls should still be there. After all, if your textbox1 is gone in the designer, the code will not recognise the variable in code and will consequently not compile.
I think Luc is right and probably you moved your controls of the dialog (check by making it larger) or you have the size on 1 pixel or something.
You can do several things I think.
- Open the [myform].designer.cs file and check if the variable of your control is defined, I think all the properties are set right after the declaration so make sure to check for errors there. Changing the designer.cs is not an option, your designer will overwrite this file.
- Try setting some properties of your control to valid values (location and size). I don't think Visible is a problem here, because you should still see the control in the designer, it only becomes not visible at runtime.
- I'm not sure if it is possible, but since menu is the only control there, the controls might have ended up behind it, or like Luc suggested you have a panel or something similar on top of all controls. Do you create/add/change controls in code?
Good luck.
V.
|
|
|
|
|
Hi.
Nope, All controls are set to their original sizes (as shown in properties)
Also, I did not select, move or add any control when it happened, and were talking about 7 or 8 controls in total all dissapering at the same time.
Aw well, I have re-designed the form and put this one down to experience. Back up from now on...
Thank you for the advice though!
Steve
|
|
|
|
|
Did you drop a control, say a Panel, on the form covering up the controls?
|
|
|
|
|
I had this happen a couple of years ago (using VS2005 IIRC) and it was a change I made to a menu item that was screwing things up. If it's not too big it may be worth posting the contents of your form's designer.cs file
|
|
|
|
|
No guarantees, but try this:
0) Exit VS2008.
1) Copy the csproj file to a safe location
2) Delete the csproj file from its original location.
3) Start VS2008
4) Load the solution.
See if that doesn't straighten things out for you.
If that doesn't work,
create a new project and copy all of the files from the old solution to the new one (and don't forget to re-add them to the solution).
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
There seems to be a bug in Visual Studio which causes this. It happened to me a few months ago, and it took me a while to find a way to fix it.
Things like this emphasise the good practice of having backups We were using PerForce so I could at least get everything working again quickly, but doing the same edits caused the same problem every time. It looks like it's been reported in versions from 2003 onward, but still no fix...
I eventually found the solution after a bit of searching. I can't find the link at the moment, but I think it was something I had to edit in the "whatsit.Designer.cs" file, and possibly deleting one of the VS temp working files. If I can find the link I'll add it here.
Days spent at sea are not deducted from one's alloted span - Phoenician proverb
|
|
|
|
|
This happened to me once. After some frantic hacking, I eventually discovered that I had eliminated the call to InitializeComponent() in the class' constructor.
|
|
|
|
|
Sorry to post again so soon.
My following overriden ondraw function draws a graph
protected override void OnPaint(PaintEventArgs e)
{
if (machineStatusON)
{
for (int i = 0; i < ECGArray.Length; i++)
{
if (x > this.Width) x = 0;
x += 1;
px = x;
p = 60 - (ECGArray[i] / 3 + 50);
e.Graphics.DrawLine(yelgpen, px, pp + 30, x, p + 30);
e.Graphics.DrawLine(blackpen, x + 1, 0, x + 1, this.Height - 1);
pp = p;
pq = q;
pr = r;
}
}
}
As you can see, it uses ECGArray, but, I have a number of different arrays representing different graphs.
How can I setup my OnDraw() to display a different graph, based on what info is passed into my ecg object at runtime?
Thank you
Steve
|
|
|
|
|
You have been getting a lot of help here but honestly ask yourself, is this project beyond you?
If you are creating an application to draw seperate graphs then each graph should be seperate from any other graph. As you have been advised, creating a control or user control is the best (and only) solution. This control should get the information it needs to render itself independently of any other instance. In which case you would need to pass to it the graphics context, if necessry, and any data necessary to render.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
stephen.darling wrote: How can I setup my OnDraw() to display a different graph, based on what info is passed into my ecg object at runtime?
A simple solution.
you need to create Property
example:
public enum Graphs {Graph1, Graph2, Graph3);
private Graphs graphs;
public Graphs GraphType
{
get
{
return graphs;
}
set
{
if (graphs==value)
return;
graphs = value;
this.Invalidate();
}
}
after that use in a if or case statment inside OnPaint to select correct graph. But graphs are fairly complicated thing, so i suggest add sevreal methods for each graph and pass parameter Graphics.
And you can use for GDI a DoubleBuffer in orther to avoid some flickers. For better look you can applay antialiasing with a performance cost.
Also Mark makes good point
|
|
|
|
|
Hi.
I have a number of different sounds associated with defferent objects.
e.g.
ECGMachine objeect - beep1.wab, beep2.wav
Patient - breathNormal.wav, breathFast.wav, shout.wav
etc
Should I add the file path and relevent code of the sounds in each class, or create a soundPlay object?
If I do create a seperate object to play all sounds, what is the best way for all my objects to interact with it?
Thank you
Steve
|
|
|
|
|
I guess the classes you created that work together (with the possible exception of the application itself) are going to end up in one separate namespace and DLL file? If so, the sounds they use should all be resources, embedded in that same DLL (unless they logically belong to your app, and not those classes).
|
|
|
|
|
Thank you again, Luc.
Regards,
Steve
|
|
|
|
|
I've read this article Nested Set Model Treebuilder[^] and run into an issue. I can't figure out how to use proposed Nested Set algorythm to process not only a binary tree? How can I extend the current implementation to support building a tree with any structure?
|
|
|
|
|
I'd start by thoroughly understanding the node numbering algorithms of the binary tree version (see Trees in SQL - nested set model
[^] as referenced in the Nested Set Model Treebuilder[^] article.
Then, I'd devise and test (on paper) an algorithm with 3, 10, 100, or whatever, nodes at each level. This is about understanding the data model: it is not about implementing anything in code.
Only when I thoroughly understood how to number nodes, and how to move, insert and remove nodes (and adjust the node numberings accordingly) would I start to design an implementation of classes that build a tree in my application.
Also, if you are thinking of having a variable number of child nodes on a node, the move/insert/remove logic may become exceedingly complex.
You may find that you can 'simply' replace the left and right delegates with a selector delegate - which must now be a Func<T, int, V> , where the int identifies the child node of interest. I think you'll also have to supply a comparator delegate to aid with sorting nodes - but sorting nodes may now have to account for 'sibling position' which is a concept new to the Nested Set Model as implemented in the article.
To reiterate - I strongly recommend studying the theory of the data models you're wanting to implement before attempting to write any code.
Have fun and let us know how it turns out!
Chris
|
|
|
|
|
Thanks for your reply! I'm not going to implement moving/insert, but could you please show an example of recursion through Nested Set for the multi-child case? I just need to convert Nested Set table flat structure to multi-dimensional array. Thanks in advance!
|
|
|
|
|
I'm sure I could show an example of how to do so, but: "Give a man a fish - feed him for a day. Teach a man to fish - feed him for life" ... so I'm not going to.
There is much more value for you in attempting to think about the problem than having us spoon feed you with the solution.
If you share with us the thoughts you've had about how to adapt the binary tree problem to an n-ary problem you'll get some useful feedback. If you just ask us to do your job for you, you're unlikely to get any support.
|
|
|
|
|