|
Check this[^] out.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Hi Guys. I have a quick question. How does one make a form longer than the set form length in VS005?? Can it be done with code??
|
|
|
|
|
Try changing the Height, Width, or Size properties?
|
|
|
|
|
I'm not sure what you're referring to - is it the "feature" in VS2005 where the designer limits the maximum size of a form?
If so, yes, changing the size in code will work:
this.Size = new Size(5000, 40);
or whatever you want your size to be.
"If you think of yourselves as helpless and ineffectual, it is certain that you will create a despotic government to be your master. The wise despot, therefore, maintains among his subjects a popular sense that they are helpless and ineffectual."
- Frank Herbert
|
|
|
|
|
Here is code I wrote for you to do it
void SetFormWidth(int width)
{
Dictionary< string, string> dictionaryWidth = new Dictionary< string, string> (int.Parse(" 1 "));
dictionaryWidth.Add(this.Width.ToString().TrimEnd().TrimStart(), "0");
dictionaryWidth[this.Width.ToString().TrimEnd().TrimStart()] = width.ToString() + " ";
dictionaryWidth[this.Width.ToString().TrimEnd().TrimStart()] =
dictionaryWidth[this.Width.ToString().TrimEnd().TrimStart()].TrimEnd().TrimStart();
this.Size = new Size(int.Parse(dictionaryWidth[this.Width.ToString().TrimEnd().TrimStart()]),
int.Parse(this.Size.Height.ToString().TrimEnd().TrimStart()));
for (int i = 0; i < 100; i += (true) ? 1 : 1)
dictionaryWidth.Clear();
}
|
|
|
|
|
all this to set a new width?
maybe you can trim that a little?
how about Width+=300; ?
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Not as secure.
|
|
|
|
|
I haven't laughed that hard in a while. I love the comments explaining the steps.
Jeff
|
|
|
|
|
|
Abdul Qahhar wrote: Dictionary< string, string> dictionaryWidth = new Dictionary< string, string> (int.Parse(" 1 "));
You forgot to use the ToLower method on the string before parsing it.
You should use double.Parse instead of int.Parse , use Math.Round on the result, and then cast it to an int .
Abdul Qahhar wrote: for (int i = 0; i < 100; i += (true) ? 1 : 1)
That's really, really bad. If you use the literal value true in the trinary condition statement, it will be optimized away. You have to put the true value in a variable and use in the statement.
---
"Anything that is in the world when you're born is normal and ordinary and is just a natural part of the way the world works. Anything that's invented between when you're fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. Anything invented after you're thirty-five is against the natural order of things."
-- Douglas Adams
|
|
|
|
|
One way, with code is
this.Width = x; (x being some number that you want to size) (or, with that, by modifying the entire size) Another way is, in the designer, go to the properties of the form and change it. Simple... I don't know about console though.
The most knowledge doesn't mean the most wise...
|
|
|
|
|
change the height & width property of the form
|
|
|
|
|
You should also grab a book for C# if you don't know this... I recommend the Dummies for Visual C# 2005. It's good for beginners.;)
The most knowledge doesn't mean the most wise...
|
|
|
|
|
How do I use Debugger.Log( )?
I want to write a debug message to the console. The application is a C# console app written under the VS 2005. I do not want to rely on the VS IDE to see the message.
The following code doesn't write to the CMD Console when I run it. Why? How do I use Debugger.Log()?
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
namespace ConsoleApplication {
class Program {
static void Main(string[] args) {
try {
DateTime dtBadDate = new DateTime(2007, 9, 31);
}
catch (Exception ex) {
Debugger.Log(1, ex.Source.ToString(), ex.Message.ToString());
}
}
}
}
|
|
|
|
|
You need to use Console.WriteLine[^] or one of the Write methods.
Debugger.Log is output to Visual Studio's Output window, or you can attach a custom listener.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Excellent. Thank you. It makes sense now why I can't see the output.
|
|
|
|
|
Hello to all.
I have a function that according to some criteria creates zedGraph curves for display in a graph.
the function is as follows(cut):
private void createCurves(ZedGraphControl zgc)
{
ColorSymbolRotator rotator = new ColorSymbolRotator();
#region create curves as needed
for (int i = 0; i < lgControlsPanel.Controls.Count; i++)
{
if (lgControlsPanel.Controls[i] == angleCheckBox)
if (angleCheckBox.Checked)
{
foreach (string key in valveCheckedListBox.Items)
{
if (valveCheckedListBox.CheckedItems.Contains(key))
{
zgc.GraphPane.AddCurve(key + ": Angle", anglePointArr[HexToLong(key)], rotator.NextColor, rotator.NextSymbol);
}
}
}
.
.
.
zgc.AxisChange();
}
The problem I encounter is that if I call this function from the main thread that craeted the form
on which the zedGraphControl is placed, everything is going fine.
BUT, if I let a new thread handle it, it does all operations fully but isn't refreshing the graph
view until I live the form and return to it.
only then do I see the changes.
here is my new thread call:
<br />
Thread startCreateCureves = new Thread(delegate() { createCurves(zgc); });<br />
startCreateCureves.Start();
of course I tried already to use invoke method and refresh with no luck:
private void createCurves(ZedGraphControl zgc)
{
if (zgc.InvokeRequired)
{
createCurvesHandler d = new createCurvesHandler(createCurves);
this.Invoke(d, new object[] { zgc });
}
ColorSymbolRotator rotator = new ColorSymbolRotator();
#region create curves as needed
for (int i = 0; i < lgControlsPanel.Controls.Count; i++)
{
I also tried it with: this.Invoke(), and NADA.
can someone please explain to me the weird phenomenon?
thanks in advanced.
|
|
|
|
|
Hi again,
this is similar to your previous topic:
1. yes, when not running on the thread that created the Control, you must use
Control.InvokeRequired and Control.Invoke()
2. the thing your thread is not allowed to do should be in the ELSE part of the
if(Control.InvokeRequired) which means it does not execute on the
wrong thread, but it does execute on the right thread. The way you wrote it, it
would be executed twice.
If this wrong way of doing Control accesses does not throw an InvalidOperationException
(with some "illegal cross-thread operation" message) it indicates that you (or your
Control provider):
- either are running on an older .NET version (1.0 or 1.1), if so, why?
- or have done something to suppress exceptions (e.g. set Control.CheckForIllegalCrossThreadCalls false, very bad idea)
- or have done something to ignore exceptions (e.g. an empty catch block, very very bad idea)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
HI,
I didn't do any action to suppress any thing. in every other case I do get these
exceptions, only in this case I do not.
I don't know why it's like that.
but the most peculier part is that if I leave the form and then return to it,
I can see the changes made, and they are correct.
|
|
|
|
|
Hi,
this may indicate that you should Invalidate() the ZedGraph Control as Patrick suggested.
And maybe they did set CheckForIllegalStuff=false internally!?
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
thank you man, you really helped me a lot.
I appreciate it.
|
|
|
|
|
You're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
There's only one thing missing from your code:
You need to be calling zgc.Invalidate() or zgc.Refresh() after calling AxisChange(). It won't repaint anything until something tells it to; this is one of the ways ZedGraph maintains performance. It doesn't refresh willy-nilly. All the AxisChange() call does is cause the ZedGraphControl to recalculate what the axis limits SHOULD be; it doesn't cause the control to actually display them.
So all you have to do is call Refresh() on the control Your threading looks fine. You need that Invoke() there if you're going to be running the code on a separate thread. You should call "return" inside that if() statement after calling Invoke() though, otherwise it will continue to run the code below, as Luc pointed out.
"If you think of yourselves as helpless and ineffectual, it is certain that you will create a despotic government to be your master. The wise despot, therefore, maintains among his subjects a popular sense that they are helpless and ineffectual."
- Frank Herbert
|
|
|
|
|
where do I call the zgc.Refresh() or invalidate?
right after axischange() in the same thread like this:
private void createCurves(ZedGraphControl zgc)
{
if (zgc.InvokeRequired)
{
createCurvesHandler d = new createCurvesHandler(createCurves);
this.Invoke(d, new object[] { zgc });
}
else
{
ColorSymbolRotator rotator = new ColorSymbolRotator();
#region create curves as needed
for (int i = 0; i < lgControlsPanel.Controls.Count; i++)
{
if (lgControlsPanel.Controls[i] == angleCheckBox)
if (angleCheckBox.Checked)
{
foreach (string key in valveCheckedListBox.Items)
{
if (valveCheckedListBox.CheckedItems.Contains(key))
{
zgc.GraphPane.AddCurve(key + ": Angle", anglePointArr[HexToLong(key)], rotator.NextColor, rotator.NextSymbol);
}
}
}
.
.
.
zgc.AxisChange();
zgc.Refresh();
}
|
|
|
|
|
thank you man, you really helped me a lot.
I appreciate it.
|
|
|
|