|
the functionality is easy, just use a httpwebrequest to google and use define: {word}
but the only way I think it could be done without some magical code is to watch the clipboard and run code on it when ever it changes to get the definition.
Unless anyone else comes up with something more interesting?
Gav
|
|
|
|
|
Hey everybody!
I'm writing automation using the webbrowser controller. I already wrote this kind of automation in c# 2003, but this time I'm encountering a silly problem that I just can't find an answer to.
I'm getting a button as an HtmlElement from the HtmlDocument using the button's ID, and all I want is to click that button. for some reason I don't find any way to push the button!
can anyone help me with silly problem ???
THANKS!
|
|
|
|
|
You might get a faster answer if you post it in the ASP.NET forum.
|
|
|
|
|
Hey all!
Id like to write a piece of code which would display some text in directx.
But Id like it to display it while playing an online game (so that why playing in a corner
there would popup a halftransparent text about some statistics, for more details:
the online game is called America's Army ;]). But Im now quite sure how to do it, so
that the game wont minimize itself, like the communicator: xfire does.
Have anyone already tried that ? I would appreciate for any help or example code
in C#.
With regards,
Pawel
|
|
|
|
|
no real need for using directx, you can use a simple windowless form and set the transparency color the same of your background, tip: I usually use Magenta.
Now you can position your form where ever you want, and it will display the text as required.
Just make sure what ever you want to show isn't the same color as the transparency color.
Gav
|
|
|
|
|
sorry Im quite new to C#.. what do you mean by windowless form ? how to achiev it ?
|
|
|
|
|
Hi,
If the current day is anything less than 10, I want to save it to a string variable as 01, 02, 03, 04, etc. How does one do it like this?
I tried the follwoing, but it prints out as dd:
string strYY = String.Format("{0:dd}", objDateTime.Year);
Is this correct? If so, why is it not working?
Regards,
ma se
|
|
|
|
|
string strYY = objDateTime.Year.ToString("D2");
|
|
|
|
|
Thanks for the help.
Where did you get D2 from, what I mean is, what else can a person use?
|
|
|
|
|
From MSDN. See this:
http://msdn2.microsoft.com/en-us/library/dwhawy9k.aspx
|
|
|
|
|
Can you please elaborate a bit more on D2?
|
|
|
|
|
See the description in MSDN.
--------------------------------------------------------------------------------------------------
This format is supported only for integral types. The number is converted to a string of decimal digits (0-9), prefixed by a minus sign if the number is negative.
The precision specifier indicates the minimum number of digits desired in the resulting string. If required, the number is padded with zeros to its left to produce the number of digits given by the precision specifier.
--------------------------------------------------------------------------------------------------
|
|
|
|
|
|
Hi,
Sorry to bother again. I have a similar situation where I have a drop down, and the value of each item is the ID. How do I format this like D2 and put it into a string?
I used this and it didn't want to work, please advise what I am doing wrong:
string strOrderType = cboOrderTypes.SelectedItem.Value.ToString("D2");
It underlines cboOrderTypes in red saying:
The best overloaded method match for 'string.ToString(System.IFormatProvider)' has some invalid arguments
And it underlines "D2" in red saying:
Argument '1': cannot convert from 'string' to 'System.IFormatProvider'
So I did it like this which seems to work, but isn't there a shorter way than doing first a conversion to int, and then back to string again?
string strOrderType = Int32.Parse(cboOrderTypes.SelectedItem.Value).ToString("D2");
Please help.
Regards,
ma se
|
|
|
|
|
I don't think so. Because "Value" can be object or string. It can be also "0005" or "XZTR".
You must first convert string -> int -> string.
|
|
|
|
|
|
Hi
i have created a form with two radiobuttons Administrator and user.i want to insert either of this radiobttons to database so the problem is it only insert user.my line of code is like this.
Level= (rdbAdministrator.Checked)?"Administrator":"User";
|
|
|
|
|
Just use the event from rdbAdministrator_CheckedChanged and rdbUser_CheckedChanged and then use your code in the both methods. Try to debug, in my code it works just fine. Probably you have another problem, I mean not in this line of code.
|
|
|
|
|
Hi
I'm just starting to build a chess game and I ancounted a problem.
I have a PictureBox control with a picture of a piece. I tested to see if I can move the piece by the "Mouse up" and "Mouse down" events.
For some reason when I press, move my mouse curser and then leave it, my PictureBox always goes to the upper left corner of the form.
I used the debuger to check what's going on, and I saw that in the mouse up event I'm getting a point that's not related to the location of my mouse curser when I leaved (always in the upper left corner).
I was told that there are local and global coordinates.
Why am I getting in the mouse up event those values? how can I get the Picturebox values relative to my form?
The code is very simple.
On the mouse move event the code is:
bool IsPressed = true;
on the mouse up event the code is:
if(IsPressed == true)
{
IsPressed = false;
PictureBox.Location = new Point(e.X, e.Y);
}
How can I solve it? is ther a better way in your opinion to do it?
thanks
|
|
|
|
|
try out following codes
Point screenPoint = PointToScreen(new Point(e.X, e.Y));
Point parentPoint = PictureBox.Parent.PointToClient(screenPoint);
PictureBox.Location= parentPoint;
rahul
|
|
|
|
|
It still doesn't do it.
I want to understand something: the point that I insert in the property section of the picturebox is the point of the picture box relative to the form?
the point that I'm getting in the mouse up event is a point of what?
thank for your help
|
|
|
|
|
ThetaClear wrote: the point that I'm getting in the mouse up event is a point of what?
This one is relative within the control your mouse cursor was over when it was pressed.
|
|
|
|
|
thanks for the answer.
Ok. so it's relative to the form, I assume.
How can I get the point of the picture box when I move it, by the mouse down and mouse up events?
|
|
|
|
|
I'm just trying to playing with your code. I make it like this:
The old coordinate is in event MouseDown -> e.X and e.Y
The new coordinate is in event MouseUp -> e.X and e.Y
bool mousePressed = false;
int x = 0;
int y = 0;
private void pictureBox1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
int backX = this.pictureBox1.Location.X + e.X;
int backY = this.pictureBox1.Location.Y + e.Y;
if(this.mousePressed)
{
this.pictureBox1.Location = new Point(backX - this.x, backY - this.y);
}
}
private void pictureBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
x = e.X;
y = e.Y;
this.mousePressed = true;
}
private void pictureBox1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.mousePressed = false;
}
private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.mousePressed = false;
}
|
|
|
|
|