|
the simplified coding is :
<br />
for (index1=0; index1<10; index1++)<br />
{<br />
ptf[index1] =new PointF(105 + 28,250);
}<br />
}<br />
myGraphics.DrawLine(myPen, ptf[drawLineIndex1], ptf[drawLineIndex1+1]);
i hope this help.
Chris
|
|
|
|
|
Hi,
i can understand ur code... but the problem is...
I have developed a Windows form Project in C# and in tht i am opening different bitmap images....now in tht when a bitmap is active and the user selects a menu button "Histogram"... i have to display the histogram of tht image in a seperate window.
Hope i am clear now... if u have any ideas plz share with me...
thanks,
Suman
|
|
|
|
|
Chris wrote:
for (index1=0; index1<10; index1++)<br />
{<br />
ptf[index1] =new PointF(105,(-375/maxValue)* -2.3);<br />
}
Please clearify. The above code is supposed to be generating your points right? It doesn't accomplish anything since its always going to be the same PointF .
Another thing GDI drawing starts with the top left corner and goes down and right across. So you have to flip on the Y axis. Once you get the Point[] you can call DrawPolygon .
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Hello,
Iam new to c#
My Problem is something like this.
Create a sample windows application, having 2 textboxes & a command
button
Set the forms controlbox property to True
Write validation event for the textbox
private void txtpassword_Validating(object sender,System.ComponentModel.CancelEventArgs e)
if (txtempno.Text=="")
{
MessageBox.Show("Please Enter User Id and password","Invalid Data",MessageBoxButtons.OKCancel);
e.Cancel = true;
}
while running the application when the user clicks the button1
even button1 causes validation set false
the focus is still in of the textbox,
the validation event of the textbox still fire.
Same is the case when the user clicks the [X] button on the control box.
i.e validation event is fired and form is not closed
Form Causesvalidation property aslo set flase.
if i write the code in the Form1_closing event then also the problem is not being solved.
This is because the validation event of the textboxes is fired first so the execution never reaches the Form1_closing event.
How can i close my Form when user user click [X] button on the control box.
or button1??????????????????
|
|
|
|
|
You can override the form close event. and can give your own event handler. So what you can do is ,set e.Cancel=false inside the overrided handler.
eg:
<br />
protected override void OnClosing(CancelEventArgs e)<br />
{<br />
try<br />
{<br />
if(MessageBox.Show("This Will Close Your Form . Do You Want To Continue ?","Conformation",MessageBoxButtons.YesNo,MessageBoxIcon.Information) == DialogResult.No)<br />
{<br />
e.Cancel = true;<br />
base.OnClosing (e);<br />
}<br />
else<br />
{<br />
this.Dispose();<br />
<br />
}<br />
}<br />
catch(Exception Ex)<br />
{<br />
MessageBox.Show("Ex.Message.ToString(),"Information",MessageBoxButtons.OK,MessageBoxIcon.Information);<br />
<br />
}<br />
}<br />
Sreejith Nair
[ My Articles ]
|
|
|
|
|
It works but validate event fires first before closing event ? again message displays that "please enter user id and pass word".............? after this closing
How can i handle this event in button click???
|
|
|
|
|
Im trying to crontrol a Buttons Visablity on the main Form1..
I've searched all over the internet for help on this subject and couldnt find any soo I will post my question here
My Code:
if (blargh == verc)
{
Form1 f = new Form1();
f.btn_Start.Visible = true;
f.btn_Patcher.Visible = false;
}
else
{
Form1 f = new Form1();
f.btn_Start.Visible = false;
f.btn_Patcher.Visible = true;
}
}
|
|
|
|
|
Is this code in Form1 itself?
in which case you should have
this.btn_start.Visible = true;
|
|
|
|
|
No its in a special class that checks a binary stream..
its not part of Form1..
|
|
|
|
|
The button has to be declared "public" (or "internal" if you are in the same project and dont want other projects to be able to do the same). And this should work:
Form1 f = new Form1();<br />
if (blargh == verc)<br />
{<br />
f.btn_Start.Visible = true;<br />
f.btn_Patcher.Visible = false;<br />
}<br />
else<br />
{<br />
f.btn_Start.Visible = false;<br />
f.btn_Patcher.Visible = true;<br />
}<br />
f.Show();
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Thanks for trying Alex, that didnt work either.
|
|
|
|
|
That way *has* to work. You probably have some code that changes the visibility during the Load event or something. Or maybe you are using a different button implementation that has a bug.
You can try another way. Pass the value to the Form and then handle the Load event and do what you need.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Hi all,
I am able to find all the values tht are needed to draw a histogram (graph) of an image... but i don't know how to draw a histogram (basically a 2D plot) for it. I want to display the histogram (graph) on a seperate window, whenever i click on a menu button.
Plz... gimme me some ideas or suggestions on how to implement tht...
thanks in advance,
Suman
|
|
|
|
|
You have the values. Now just loop and use DrawLine(); Based on the value calculate so that you have a different line height. Increase your X value and continue for the next value.
If this doesn't work for you - you might end up having to use SetPixel method.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Hi,
i can understand ur code... but the problem is...
I have developed a Windows form Project in C# and in tht i am opening different bitmap images....now in tht when a bitmap is active and the user selects a menu button "Histogram"... i have to display the histogram of tht image in a seperate window. So i have to initialise a new window(form) and i have to display the histogram(plot), which i don't know how to do tht...
Hope i am clear now... if u have any ideas plz share with me...
thanks,
Suman
|
|
|
|
|
Hello all,
Tell me, what is Resource Gloablization? and how is it work? Give me example to it.
|
|
|
|
|
|
DirectShow.
in the other word how can i play multi-file once?
thanks!
|
|
|
|
|
Hi All,
I am connecting to a SQL 2000 Server database by using a datareader.
I am getting this error.
An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll
Additional information: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
1. How can I lengthen the time out on my connection?
2. How can I make sure there are no connections and that all connections are released by me and returned to the pool?
Thanks for any help.
Stephen
|
|
|
|
|
It would help if you could provide us with some code, and where the exception occurs.
|
|
|
|
|
|
is there anything special that needs to be done when interopping with objects of type System.__ComObject? without good docs, how do you know what to cast to if all u got is a C# type object?
|
|
|
|
|
It greatly depends on what you're doing. All types (doesn't matter which language, BTW) are IDispatch implementations unless you expose an interface differently using different enums for either the InterfaceTypeAttribute<?code> (for interfaces) or <code>ClassInterfaceAttribute (auto-generated class interface; never use auto-generated class interfaces, though).
When you cast an object to a COM-defined interface (attributed with ComImportAttribute ) a QueryInterface is actually performed using the interface to which you're trying to cast. This means you have to have some idea of what you're trying to cast, otherwise you can either cast it as IDispatch (if it's a dispatch object) or - at the very least - IUnknown , which honestly gives you anything useful.
As I've told many people, understanding COM interop with .NET well requires that you understand COM well. I would recommend picking up a book on COM programming, as well as a book on COM interop if you need further explanation.
There's also several good articles here on this site that explain bits and pieces, but the bigger pictures requires a deeper understanding of just how COM works and how .NET interop works with (and for) COM.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hello,
I am trying to output a txt file to a Windows form in C# of course. I have coded how to read the file, that is not a problem anymore. And I can outpout it to the console. But I have been unsuccessful on how to output it on a Form instead of a console.
Can anyone help please?
A Newbie in tha block
|
|
|
|
|
Add a control (such as the Label or TextBox) to the form and set its Text property to the contents of the file.
Regards,
Alvaro
Our enemies are innovative and resourceful, and so are we. They never stop thinking about new ways to harm our country and our people, and neither do we. - George W. Bush
|
|
|
|