|
Maybe my description has some confusion for you. Here is my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace RFCart
{
public partial class Main : Form
{
private int drawMode;
private bool mouseIsInShelf;
private Shelf currentShelf;
private ShelfArray shelfs = new ShelfArray();
private void Main_Load(object sender, EventArgs e)
{
drawMode = Constant.SHELF_MODE;
}
private void picImage_MouseDown(object sender, MouseEventArgs e)
{
switch (e.Button)
{
case MouseButtons.Left:
Point mousePoint = new Point(e.X, e.Y);
if (drawMode == Constant.SHELF_MODE)
{
currentShelf = new Shelf();
currentShelf.StartPoint = mousePoint;
}
break;
}
}
private void picImage_MouseUp(object sender, MouseEventArgs e)
{
switch (e.Button)
{
case MouseButtons.Left:
Point mousePoint = new Point(e.X, e.Y);
if (drawMode == Constant.SHELF_MODE)
{
currentShelf.EndPoint = mousePoint;
shelfs.Add(currentShelf);
picImage.Invalidate();
}
break;
}
}
private void picImage_MouseMove(object sender, MouseEventArgs e)
{
Point mousePoint = new Point(e.X, e.Y);
foreach (Shelf shelf in shelfs)
{
if (shelf.Contains(mousePoint))
{
mouseIsInShelf = true;
break;
}
else
{
mouseIsInShelf = false;
}
}
}
private void picImage_Paint(object sender, PaintEventArgs e)
{
foreach (Shelf shelf in shelfs)
{
shelf.Draw(e.Graphics, Color.Red);
}
}
}
}
Shelf.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace RFCart
{
class Shelf
{
private Rectangle boundRectangle;
private Point startPoint;
private Point endPoint;
public Point StartPoint
{
get
{
return startPoint;
}
set
{
startPoint = value;
}
}
public Point EndPoint
{
get
{
return endPoint;
}
set
{
endPoint = value;
}
}
public Rectangle BoundRectangle
{
get
{
return boundRectangle;
}
set
{
boundRectangle = value;
}
}
public void Draw(Graphics graphics, Color color)
{
int width = Math.Abs(EndPoint.X - StartPoint.X);
int height = Math.Abs(EndPoint.Y - StartPoint.Y);
int x = Math.Min(StartPoint.X, EndPoint.X);
int y = Math.Min(StartPoint.Y, EndPoint.Y);
boundRectangle = new Rectangle(x, y, width, height);
GraphicsPath path = new GraphicsPath();
Pen pen = new Pen(color, Constant.PEN_WIDTH);
path.AddRectangle(boundRectangle);
graphics.DrawPath(pen, path);
pen.Dispose();
}
public bool Contains(Point point)
{
return boundRectangle.Contains(point);
}
}
}
ShelfArray.cs
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace RFCart
{
class ShelfArray : CollectionBase
{
public void Add(Shelf shelf)
{
List.Add(shelf);
}
public Shelf this[int index]
{
get
{
return (Shelf)List[index];
}
set
{
List[index] = value;
}
}
}
}
After I draw 2 rectangles, when I move mouse into the first rectangle, mouseIsInShelf will change to true. But when I move the mouse into the second rectangle, mouseIsInShelf still false. I think it should be true.
Help me more! Thanks a lot!
I'm ...
a fan of Manchester United
a fan of Ozzy Osbourne
a King of Nothing
|
|
|
|
|
hello, i have a string that i need data to be extracted from, but i do not know much about regex. can someone please show me how to do this? thanks.
i start with this string:
[09.17.2005 15:22:58] VIOLATION (GAME INTEGRITY) #20006: ^r||^cS^rF^cO^r||^cSin^rner (slot #6) Violation (GAME INTEGRITY) #20006 [dfcbd87f99e62f4915732e0b26f804e9(VALID:78) 87.211.1.131:27960] i need to extract the following information, and save it in a new string string1, string2, string3, etc.:
09.17.2005 15:22:58
always starts as 2nd character and ends as 20th character
GAME INTEGRITY
always starts as 33rd character, ends at first ) after it starts
20006
always starts 3 characters after the (GAME INTEGRITY), and is 5 digits long
^r||^cS^rF^cO^r||^cSin^rner
name, always starts 2 characters after the 20006, and ends at the (slot #
dfcbd87f99e62f4915732e0b26f804e9
32-digit long GUID, starts at 2nd character after the 2nd (last) #2006 (or 5 digit ID)
87.211.1.131
the ip, starts 1 character after (VALID:78) where 78 is a number between 1 and 9999
thanks for the help, hopefully there is a way of doing this.
sam kline
<a href="http://dying.about.com/gi/pages/poll.htm?poll_id=2068629450">YES</a>
|
|
|
|
|
\[(.{19})\]([^)]+\)).{2}(.{5}):\s*([^\(]*)\(slot #[\d]+\) [^\d]*\d{5}^\w*(.{32})[^\)]*\)\w*([\d\.]*)
That should work, but to be honest, Expresso threw a fit and stopped giving me any more than 4 match groups ( but kept on working while I worked through the regex ). The matches should all be grouped, so you need just iterate through the groups to get them all.
If you google and download Expresso, you'll find it's very useful for working on RegEx.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi, could you please give me an example of how to open an executable file on remote machine using WMI? I have worked on it for a whole day without any result. Thank you in advance.
Erick
|
|
|
|
|
There are problems with what you're doing. The first of which, a process launched on a remote computer cannot be interactive. This means that you won't see it appear on the desktop, but it will show up in the remote machine's Task Manager.
You can read more about it here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi I wat to pass objects than have ToString(strig Format) and Parse(string value) in method's parameter.
So I want to know what interface use for pass double, int, datetime, etc. that have these methods
public void AddFormat( iteface? param,string format)
{
this.txtValue.Text = param.ToString(format);
}
public object GetValue()
{
return myObject.Parse(this.txtValue.Text);
}
Thank you
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
Maybe you must pass param as object ? Then you can pass in everything you want (enum, int, float, double, etc.).
Pompiedompiedom...
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick
|
|
|
|
|
Yes but I want only objects that have ToString(string format) and Parse(string value), like int,double, datetime and others.
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
I guess you'll have to use reflection for that.
public object GetValue()
{
MethodInfo method = myObject.GetType().GetMethod("Parse");
ParameterInfo[] parameterList = method.GetParameters();
if (parameterList.Count == 1 && parameter[0].ParameterType == typeof(string))
{
method.Invoke(...);
}
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
wow is a good aproach.
I really like when peopple answer question i differents ways!
I theink a use it.
Thank you very much!!!
La realidad no es más que impulsos eléctricos del cerebro - Morpheus
|
|
|
|
|
Frankly, I have just finish a new project, and I want to create A setup file for it, but the problem is how to attach the database files ...
I want to know if it was possible to make the application attach a dataBase file automatically or not, and if it was possible, HOW ??
By the way, i use SQL server 2000
Thnkas in advance
Bagie
|
|
|
|
|
If you use the Visual Studio Setup Project, then to do what you want without extra work you must create an executable that gets installed on the target machine and set it as a Custom Action in the Commit install event. Use that executable to call SQL Server 2000 to attach the database files.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
thanks for your care,
i'm sorry to say that but can you illustrate it to me in steps
as I'm still confused
thanks
Bagie
|
|
|
|
|
- Create a backup of the database.
- Add it to your setup program.
- Create an executable that will connect to a datasource and run the following SQL statement
RESTORE DATABASE TestDB
FROM DISK = '[source_file]'
WITH MOVE '[db_name]' TO '[data_file_name]',
MOVE '[db_name]_log' TO '[log_file_name]'
- Build the execuatble and add it to your Setup project.
- Add the executable to the list of custom actions in the commit section.
For more information, please see the Transact-SQL Reference.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
THANK YOU VERY MUCH
That helps me a lot
I appreciate your care ..
Bagie
|
|
|
|
|
No problem. Happy coding!
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
i have some problems with Crystal Reports ...
i can't provide it with data correctly
so, can anybody send me an example of using it [ IN STEPS ]
Thanks in advance
Bagie
|
|
|
|
|
Just do a bit search from this site....
<< >>
|
|
|
|
|
thx for your replay
I tried, and I found one ...
but I need more illustration
and I'm still a beginner
so, I wish I found help
thanks
Bagie
|
|
|
|
|
|
Thank You for your great effort
|
|
|
|
|
You're welcome...
Happy coding
<< >>
|
|
|
|
|
I know i can just use the RunOnce bit in the registry, but then the application would just be taking up space, never to run again
|
|
|
|
|
Just a suggestion... But never try
Crazy idea...hehehhe
Before the app being died, read the entry from FAT table that points to the exe file and marked it as deleted file....
<< >>
|
|
|
|
|
Obviously, you've been using too much of your namesake. That's the most convoluted solution to this problem that I've ever seen. Besides, you can't do that in NTFS and it would take an extraordinary amount of effort to do something so simple.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|