|
|
In which way are you going to "process" the status? It's a list of values that can be OR'ed to form an integer, nothing more, nothing less.
In the example, if you want to set several status bits in one go, you can write
characterStatus = Status.Poisoned | Status.Sleeping; which is equivalent to writing
characterStatus = 6; In order to colorize a box you'd write something like
Color boxColor = IsPoisoned ? Color.Green : Color.Red; with the IsPoisoned property implemented similar to IsHidden in my previous posting.
The reason you're getting integer values when you query the characterStatus is that Enum s are based on integers (Int32 IIRC) by default. You can use different data types (for example Int16 or byte ) if you write
public enum Status : byte Regards,
mav
|
|
|
|
|
Hi all,
I've used VS.NET to add my own counter category, but it's only on my machine! If I run my app on anohter machine, the category's not there. How do I create the category on other machines?
Do I have to build some kind of setup project to do it, or do I have to do it in my code: something that creates the category on app-startup and removes it on app-shutdown.
thanks...
/=/=/=/= Sagmam =\=\=\=\
|
|
|
|
|
hi
I'm a Korean student.
I'm studing C# and image processing.
I am reading a book, the book's name is GDI+ Programming wrote by you.
I'm studnig 16bit RAW image file.
But I did'nt display on screen.
How can i do?
please help and detail information.
-----my programming source is here -----
FileStream fs = File.Open(strFileName, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
BufferedStream buf = new BufferedStream (fs);
BinaryReader r = new BinaryReader(buf);
Bitmap bitmaps = new Bitmap (_Define._ImageWidth, _Define._ImageHeight, PixelFormat.Format16bppGrayScale);// .Format48bppRgb);
BitmapData bmData = bitmaps.LockBits (new Rectangle(0, 0, _Define._ImageWidth, _Define._ImageHeight), ImageLockMode.ReadWrite, PixelFormat.Format16bppGrayScale);
bitmaps.UnlockBits (bmData);
UInt16 *p = (UInt16 *)(void *)bmData.Scan0.ToPointer();
UInt16 swap;
int nTotal = _Define._ImageHeight*_Define._ImageWidth;
byte [] data = new byte [nTotal];
try
{
int nPer = nTotal / 10;
int nCnt = 0;
for(int y = 0; y < nTotal; y++) // 원본을 로드하기위한 For문...
{
if (y%nPer == 0) {
pLoading._Percent = nCnt;
nCnt += 10;
pLoading.Refresh ();
}
swap = (UInt16)(r.ReadInt16 ());
*(p) = swap;
p++;
}
}
catch(Exception fo)
{
MessageBox.Show(fo.ToString());
}
// m_pPanel is View
MDProcess.ImageObject pImage = new ImageObject (m_pPanel);
pImage._ImageName= strFileName;
pImage._rcBound = InitImagePT (iFiles);
pLoading._Percent = 100;
pLoading.Refresh ();
m_alImageList.Add (pImage);
pLoading._Counter = i;
pLoading._Total = alFiles.Count;
pLoading.Refresh ();
bitmaps.Dispose ();
fs.Flush ();
buf.Close ();
fs .Close ();
r.Close ();
|
|
|
|
|
i want to write a HighLight porgram, but i do not know how to match this string :
/*123adfadfr55543sttttt
adfdafeefefefefe
ddddghhhh*/
|
|
|
|
|
|
I don't understand - why do you need regex to match a constant string ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi there,
How to change UI(e.g. Menus)Labels in MDI Form? I'm using Localization for Multilingual Support. It is OK in childForm When CultureInfo object set to CurrentThread.CurrentCulture and CurrentUICulture. I want to change language on the spot without having to reload MDI form.(For example when change language menuitem click).How can I do for that?
I would like to know how to handle in your application situation like this?
Thanks in advance.
|
|
|
|
|
Hi, i'm trying to draw on the desktop...made the following code from combination of stuff i found on internet
[DllImport("user32.dll")]<br />
private static extern IntPtr GetDC (IntPtr hwnd);<br />
<br />
[DllImport("user32.dll")]<br />
private static extern void ReleaseDC (IntPtr hwnd, IntPtr hdc);<br />
<br />
private void button1_Click(object sender, System.EventArgs e)<br />
{<br />
IntPtr deskDC = GetDC(IntPtr.Zero);<br />
using (Graphics g = Graphics.FromHdc(deskDC))<br />
{<br />
g.FillRectangle(Brushes.Green, 100,100, 100,100);<br />
<br />
}<br />
ReleaseDC(IntPtr.Zero, deskDC);<br />
}
The problem is when you drag windows over what you drew...windows erases. I could just dump the drawing into a thread or timer but thats wrong...i want to somehow listen to the desktop's windows messages and paint when it paints...any ideas?
|
|
|
|
|
hmm, i put the draw in a while loop and i didn't like the resuts...it draws everywhere...not just "over the background image" like i was trying to achieve.
|
|
|
|
|
Can anybody tell me how to make the application start with windows?
thanks a lot.
|
|
|
|
|
You have to create a key in the registry, in
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
They key name doesn't matter, but the key value must be the full path to your executable (try Application.ExecutablePath ).
Use the Registry and RegistryKeys in the Microsoft.Win32 namespace.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
I am writing a keyboard hooker for a study that I want to run. That study requires that the program run all of the time (as it is analysing all of the text that is input into the keyboard). As I am likely going to slow down the computer a lot on mere merit that I am putting a system wide hook on the keyboard, I have another question. Where should I be running the interpretation code from? I was thinking that I should likely run this as a Windows service but I would appreciate input. Thanks a lot,
Jim
|
|
|
|
|
Esmo2000 wrote:
Where should I be running the interpretation code from?
Your hook procedure must reside in a DLL by itself. I recommend you put in this DLL the least possible amount of code, because it will be injected into every process.
It really doesn't matter (in terms of slowing down the computer) if your program (the one that installs the hook) is a service or a regular app, since it will only run once. But a service has de added benefit of capturing text while no user is logged on (eg. the logon sceen -- correct me if I'm wrong.)
I would reccomend writing your DLL in plain old C/C++ (without the .NET or MFC) because it (and the DLLs it requires) will be loaded into every process.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Thanks a lot, that helps greatly. Perhaps I should ask another question while I am at it.
I want to run some statistics on all of the text that I interpret. At what point should I do this? What I was thinking of doing was to simply keylog every stroke that comes my way and on a daily basis (or some other set time frame) run the statistic analysis from a windows service.
Here is my question:
At what point should my code commit the changes to hard drive? File IO is a pretty taxing process, so I was thinking that I should keep as much of the typed text as possible in RAM and commit them to some point on the hard drive as infrequentlf as possible. However, that poses another probem; As the code is injected into each process seperately, there will not be the consistency that I require. The text has to be stored in order.
How do I deal with this problem? Thanks a lot!
|
|
|
|
|
Esmo2000 wrote:
How do I deal with this problem?
In Win32 (not .NET) there are ways to have shared memory between all processes. Well, at least there used to be. I'm sorry I can't be of more help because I never had to use them, and it's been several years since I last used the Win32 API (.NET is so cool!), but I remember memory mapped files to have this capabiltity (at least in Win9x).
You probably could get better results if you ask in the Visual C++ Forum.
Good luck!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
|
I would create and set some registry key during my application installation, and remove them at the unistalling.
How can i do?
|
|
|
|
|
Hey
not sure what you are using
to make an installation ?
But can you program in what you mentioned
into the installer ?
i know various installer creation programs
like installshield, wise etc
can create and modify registry keys etc.
|
|
|
|
|
Hi Sasuko,
.NET allows us to develop setup and deployment project's for installing our applications. The sttup project provide's different editors for customizing the deploment. One among them is the RegistryEditor using which you can add registry keys and values to be added on to the target computer.
Regards
SGS
|
|
|
|
|
Hi there,
I hava a Form with 2 UserControls and 1 dialogBox. I want to use the DialogBox to set which UserControl will display on the Form.
-UserControlA(a button: buttonToB)
Form -UserControlB(a button: buttonToA)
-DialogBox(2 buttons: Ok & Cancel)
The Form will display UserControlA as StartUp, when buttonToB is clicked, the DialogBox appears, if Ok is pressed, then UserControlA will be removed and UserControlB will be add to the Form.
I have public menthods in the Form as follows:
public void RemoveUserControlA(){
this.Controls.Remove(UserControlA) // remove B
UserControlA.Dispose();
}
public void AddUserControlB(){
this.Controls.Add(UserControlB)
}
In the UserControlA, when the buttonToB is clicked
private void buttonToB_click(){
if(dialog.Result == Ok){
Form f = new Form();
f.RemoveUserContorlA();
f.AddUserControlB();
}
}
Questions
1) How can I have some methods in the Form, and then invoke it in the UserContolA (i.e. public methods ?)?
2) How can I remove the Usercontrols using the dialog?
thanks.
|
|
|
|
|
hi all
how can i read image into byte array and then store that image into Access DB
thank you ,
|
|
|
|
|
ok i found an answer of the first part of thte question that was
"How can i store image into byte array"
But What about the second Part
i know that i should use OlE object data type to image into it ...
"How can i store that byte array into Access DB?"
"How the query will be?"
|
|
|
|
|
This question has been asked several times, you should try searching the forums before posting a question, especially one that is so common.
Search results[^]
This[^] post might help.
Remember, most of the questions have already been answered, try searching the forums first, you'll get a quicker answer.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hello evrybody,
I need sample code in C# which open serial communication COM1 in .NET COMPACT FRAME.
Thanks for your helping.
|
|
|
|