|
actually my project is to control some actions on computer through cell phone using AT commands like i have to make call from my cell phone that should be received on computer and follow the instruction as given by me.
clear?
|
|
|
|
|
TAPI is the only way you're going to make this work. And you'll have to have a TAPI 3.0 compatible modem in the machine to receive the call. AT commands on your cell phone won't do you any good at all.
|
|
|
|
|
hmm ok. i do search on it.
thanks
|
|
|
|
|
I'm a mathematical simulation(FCFS-first come first served). I want to look a rectangular motion over time (in seconds) but I do not know how the code.
Suppose at first 2 seconds, then I will give a rectangular appearance and color flowed from left to phai.Trong the initial rectangle is 4 seconds to fill the rectangle appear in 4 seconds and travel moved into position under the rectangle 1.Khi rectangular rectangular bowl is finished, the original rectangular bowl first two starts. And there will be more rectangular rear again ...
This is the example.
http://cB8.upanh.com/22.902.29916387.iVy0/hinh.jpg[^]
When rectangle 1 is a bowl to 4 seconds, rectangle 2 appear and wait, When rectangle 1 is a bowl to 11 seconds,rectangle 3 appear and wait. When finished, rectangle 2 begin fill .and rectangle 3 fill when rectangle 3 finished .
Can you suggest some code for their home, or you share the code with your own. I thank you!
|
|
|
|
|
I understood only a fraction, and the link times out; but I guess the guide lines in this article[^] should be quite useful.
Luc Pattyn [My Articles] Nil Volentibus Arduum
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Please use <PRE> tags for code snippets, they improve readability. CP Vanity has been updated to V2.3
|
|
|
|
|
I mean I want to simulate FCFS algorithm using graphics
Can you help me?
|
|
|
|
|
I can help you once you have a clear description of the problem, and come up with specific questions. When related to animations, I will assume you have read my article.
Luc Pattyn [My Articles] Nil Volentibus Arduum
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Please use <PRE> tags for code snippets, they improve readability. CP Vanity has been updated to V2.3
|
|
|
|
|
Simulation algorithms FCFS (first come first served) - CPU scheduling:
Input: process name, arrival time, burst time
Output: average waiting time, Gantt chart showing the process of how work, simulation of processes running on the CPU with the graphics.
If you help me, I thank you!
|
|
|
|
|
You are not getting it, are you? You study the domain, you do your research, you use google, you try a couple of things, and then, when you are stuck, you can ask specific questions, and people here will be glad to help you. But we don't do your project for you.
Luc Pattyn [My Articles] Nil Volentibus Arduum
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Please use <PRE> tags for code snippets, they improve readability. CP Vanity has been updated to V2.3
|
|
|
|
|
I have calculated the average waiting time and Gantt chart.
Now I want to simulate.
How can a rectangle appear in some time.
Example: I want a rectangle appears at 3 seconds for 6 seconds. rectangle appears when the rectangle that is filled from left to right until the end.
While the original rectangular bowl is 5 seconds, then at the first two rectangles appear
|
|
|
|
|
read the article. use a timer. learn.
Luc Pattyn [My Articles] Nil Volentibus Arduum
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Please use <PRE> tags for code snippets, they improve readability. CP Vanity has been updated to V2.3
modified on Friday, June 10, 2011 8:51 PM
|
|
|
|
|
Are you talking about real time (i.e. using timers), or a time axis on a chart?
You can draw a rectangle on any control by handling its Paint event, or if it's a custom control, in the OnPaint method. Have a look at the Graphics class[^].
|
|
|
|
|
oh,i don't known use timer . you can help me?
this is my code :
private void FCFS (object sender, EventArgs e) <br />
{ <br />
/ / Quick_sort (0, processList.Items.Count - 1); <br />
Graphics g = panel1.CreateGraphics (); <br />
Font font = new Font ("Arial", 10, FontStyle.Bold); <br />
SolidBrush brush = new SolidBrush (Color.Blue) brush1 SolidBrush = new SolidBrush (Color.Red); <br />
int k, r = -1; <br />
int fc; <br />
int t = -1; / / system time <br />
int count; / / total number of boot process <br />
jobcount int = 0; / / Calculate the required process <br />
float total = 0; <br />
Hanging string; <br />
g.DrawString ("0", font, brush, 0, 80); <br />
g.DrawString (Dscv1 [0]. arrtime.ToString (), font, brush, Dscv1 [0]. arrtime * 10, 80); <br />
for (count = 0; count <processList.Items.Count; count + +) / / number of process <br />
{ <br />
by <br />
{ <br />
t + +; <br />
for (k = 0, k <i, j + +) <br />
{ <br />
if (Dscv1 [k]. arrtime <= t & & Dscv1 [k]. statue == "W") <br />
{ <br />
jobcount = 1; <br />
break; <br />
} <br />
} <br />
} While (jobcount == 0); <br />
do / / process waiting <br />
{ <br />
r + +; <br />
} While (Dscv1 [r]. Statue! = "W" & & r <(i - 1) & & Dscv1 [r]. Arrtime <= t); <br />
fc = Dscv1 [r]. arrtime; <br />
for (k = 0, k <i, j + +) / / The first time to run and no other process <br />
{ <br />
if (Dscv1 [k]. arrtime <= fc & & Dscv1 [k]. statue == "W" & & Dscv1 [r]. arrtime <= t) <br />
{ <br />
fc = Dscv1 [k]. arrtime; <br />
r = k; / / Number of <br />
} <br />
} <br />
<br />
richTextBox1.Text richTextBox1.Text + = "At the second number:" + t + "\ n"; / / uptime <br />
<br />
Dscv1 [r]. Startime = t; / / start time <br />
Dscv1 [r]. Fintime Dscv1 = t + [r]. Needtime; <br />
total = total + ((float) Dscv1 [r]. fintime - (Dscv1 [r]. startime Dscv1 + [r]. sertime ));
g.DrawRectangle (Pens.Black, 0, 40, t * 10, 40); <br />
g.DrawString ("P" + Dscv1 [r]. jobname.ToString (), font, brush1, Dscv1 [r]. fintime * 10 -5, 20); <br />
g.DrawRectangle (Pens.Black, 0.40, Dscv1 [r]. fintime * 10.40) / / Time to complete <br />
Dscv1 hook = [r]. fintime.ToString (); <br />
<br />
g.DrawString (Hook, font, brush, Dscv1 [r]. fintime * 10.80); <br />
<br />
<br />
Dscv1 [r]. Statue = "R", / / ready status <br />
Dscv1 t = [r]. fintime; / / system time changes <br />
<br />
for (k = 0, k <i, j + +) <br />
<br />
{ <br />
<br />
Dscv1 richTextBox1.Text = richTextBox1.Text + [k]. jobname + "|" + Dscv1 [k]. arrtime + "|" + Dscv1 [k]. sertime + "|" + Dscv1 [k]. startime + "| "+ <br />
Dscv1 [k]. Fintime + "|" + Dscv1 [k]. Statue + "\ n"; <br />
<br />
} <br />
<br />
Dscv1 [r]. Statue = "F"; / / Complete <br />
r = 0; / / Back to the top <br />
t -; <br />
jobcount = 0; <br />
<br />
textBox5.Text = (tong). ToString (); <br />
} <br />
g.Dispose (); <br />
}
I use that code to draw a Gantt chart and description on RichText
|
|
|
|
|
I refer you to Luc's post[^]. No-one is going to code your solution for you. Go away, read about the things you need to know, and work out how to do what you want to do.
If you get close and have some small, specific issues that you can't resolve yourself, that is when to ask questions. 'lolol code dis 4 me' is just going to get you disliked.
|
|
|
|
|
This Code is working well but wrong. Wrong because it lower all text -because of the MatchCase method.
How can I make it work without pre-changing anything inside (exception for color text to find)?
int posTxt = 0;
private void button2_Click(object sender, EventArgs e)
{
string searchText = textBox2.Text.ToLower();
string alltxt = richTextBox1.Text.ToLower();
if (alltxt.Contains(searchText))
{
richTextBox1.Text = alltxt;
while (posTxt != -1)
{
posTxt = richTextBox1.Find(searchText, posTxt, RichTextBoxFinds.MatchCase);
if (richTextBox1.SelectedText == searchText)
{
richTextBox1.SelectionLength = searchText.Length;
richTextBox1.SelectionColor = Color.Red;
}
posTxt = richTextBox1.Find(searchText, posTxt + 1, RichTextBoxFinds.MatchCase);
}
}
posTxt = 0;
}
|
|
|
|
|
You could use the lower-case versions of the search string and the text to locate the match (or matches); then remove whatever exists at the match position (you know position and length), and then insert the new text with its original casing.
Luc Pattyn [My Articles] Nil Volentibus Arduum
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Please use <PRE> tags for code snippets, they improve readability. CP Vanity has been updated to V2.3
|
|
|
|
|
|
please read my reply again: you search using the lower-case versions, only to find the location.
you modify using the actual text, not the lower-case one (the positions are the same for both!)
Luc Pattyn [My Articles] Nil Volentibus Arduum
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Please use <PRE> tags for code snippets, they improve readability. CP Vanity has been updated to V2.3
|
|
|
|
|
this is what i have done so far... but with the same result. The text in richTextBox1 is changing to lower and I dont see from where.
int posTxt = 0;
private void button2_Click(object sender, EventArgs e)
{
string searchText = textBox2.Text.ToLower();
string alltxt = richTextBox1.Text.ToLower();
RichTextBox rtb = new RichTextBox(); rtb = richTextBox1;
if (alltxt.Contains(searchText))
{
rtb.Text = alltxt;
while (posTxt != -1)
{
posTxt = rtb.Find(searchText, posTxt, RichTextBoxFinds.MatchCase);
if (rtb.SelectedText == searchText)
{
richTextBox1.SelectionLength = searchText.Length;
richTextBox1.SelectionColor = Color.Red;
}
posTxt = rtb.Find(searchText, posTxt + 1, RichTextBoxFinds.MatchCase);
}
}
posTxt = 0;
}
|
|
|
|
|
_q12_ wrote: The text in richTextBox1 is changing to lower and I dont see from where.
_q12_ wrote: string alltxt = richTextBox1.Text.ToLower();
_q12_ wrote: rtb.Text = alltxt;
Luc Pattyn [My Articles] Nil Volentibus Arduum
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Please use <PRE> tags for code snippets, they improve readability. CP Vanity has been updated to V2.3
|
|
|
|
|
yes... but...
only rtb.Text = richTextBox1.Text; not inverse.
RichTextBox rtb = new RichTextBox(); rtb = richTextBox1;
meaning:
richTextBox1.Text is not equal with rtb.Text.
anyway... its not about the new rtb.
|
|
|
|
|
_q12_ wrote:
rtb = richTextBox1;
WRONG!
you have copied the reference, so both rtb and richTextBox1 point to the same object.
the new RichTextBox you also created is dead right away, it is never used (it also is not needed!).
BTW: Eric already told you all that.
I suggest you choose, buy and thoroughly study an introductory book on C#.
Luc Pattyn [My Articles] Nil Volentibus Arduum
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Please use <PRE> tags for code snippets, they improve readability. CP Vanity has been updated to V2.3
|
|
|
|
|
As told earlier by Luc, rtb and richtextBox1 refer(point to the same object).
Think of it this way: rtb and richtextbox1 are just some names that help you deal the the real thing.
A guick fix for what you are trying to do with this line of code would be:
RichTextBox rtb = new RichTextBox(); rtb.Text = richTextBox1.Text;
Now rtb does not point to the same object but it just copied the text from richtexbox1.
Clearer than that I don't know how to explain.
All the best,
Dan
modified on Friday, May 27, 2011 3:35 PM
|
|
|
|
|
As Luc has already suggested:
Do not assign alltxt to rtb.Text nor richTextBox1.Text; Actually, remove rtb variable, you don't need it;
Use alltxt.IndexOf method instead of rtb.Find method to search for the text you want. The indexes will be the same.
Use these indexes to make the changes on your rich text box control.
The lines:
RichTextBox rtb = new RichTextBox(); rtb = richTextBox1;
are useless becouse RichTextBox is a reference type, so your local rtb variable and your richTextBox1 will both be pointing to the same object.
|
|
|
|
|
in some desperation I was using "RichTextBox rtb " variant, copying its locations to the real one...
But I managed to find the solution after all.
Thanks!
|
|
|
|