|
It is the FileSystemWatcher class. It responds to different events such as create, change, renamed etc.
|
|
|
|
|
Hi,
I'm trying to detect if XP themes are enabled or not in code (using .NET 2.0). This not as
easy as it seams, however. I thought Application.VisualStyleState would be
of a lot of help, but unfortunately, it was not.
Basically, I need something similar to this (pseudo-code that might look like VB to some ):
If LegacyOS Then ' Older browsers with no theme support: W2K, W98, WME
return False
ElseIf OsSupportsThemes Then ' For example: XP, 2k3, Longhorn
If ThemesEnabled Then ' Application.EnableVisualStyles was called, or manifest is present
Return True
Else
Return False
End If
End If
Is there a method I'm not aware of in the .NET 2.0 framework, or a good way to do this?
Thanks!
Carl
|
|
|
|
|
Checkout the Environment class.
if(Environment.OSVersion.Platform == PlatformID.Win32NT &&
Environment.OSVersion.Version.Major >= 5 &&
Environment.OSVersion.Version.Minor >= 1) {
Application.EnableVisualStyles();
}
WM.
What about weapons of mass-construction?
|
|
|
|
|
Ok... but if the user is using XP but running in Classic themes... that won't help
|
|
|
|
|
Sorry, I didn't mean to post anonymously!
|
|
|
|
|
It should savely ignore the call anyway
WM.
What about weapons of mass-construction?
|
|
|
|
|
Application.RenderWithVisualStyles ?
|
|
|
|
|
EXACTLY! It works... Too bad I didn't see this property before
Thanks a lot!
On another note, is it possible to get the THEME that is currently displayed? Would be useful for me to theme controls that I'm drawing from code.
|
|
|
|
|
Take a look at the API functions in uxtheme.dll. OpenThemeData gives you a handle to the theme currently displayed. You then pass this handle to all of these functions to draw themed controls.
I hope this helps.
Human beings were not meant to sit in little cubicles staring at computer screens all day, filling out useless forms and listening to eight different bosses drone on about about mission statements. -- Peter Gibbons
|
|
|
|
|
Very useful, thanks! I will definately take a look.
|
|
|
|
|
hi everyone,
i need to write a program (c#) that will do the following:
- list all users existing on the computer
- enter different keys into the windows registry for each of the users (these will be used by another application to enable/disable some of its features).
i could do the first part with ADSI, but this doesn't give me access to the registry or I could access the registry directly, but in this case I don't know how to figure out the keys (and names) of the existing users.
any hints?
thanks,
frankk
|
|
|
|
|
hi,
i'm trying to find a way that i can manage the use of a windows application by making use of an activation code which be used to enable the application and allow the user to use it.
i want to be able to generate a fixed length code of not more than 20 characters..
i have been unsucessfull in searching the web for guidance in this matter...
any help or pointers to articles will be great..
Thanks ,
Afzal Hassen
|
|
|
|
|
It's unlikely that many people will publish their approach to this, because they use it to protect their app. Look into the Cryptography namespace for ideas on established algorithms you can play with to come up with a way to create a code. If you do some sort of hash, never just use the users name, someone will work that out. Put some noise in there.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
that makes sense...
thanks Christian
Afzal Hassen
|
|
|
|
|
Hi
Is it possible to integrate set up file for my project and Windows Service in one set up file
Right now i have made set up files for both individual installer one for my projetc set up file and another set up files for Windows Service
pls tell me the procedure for that
Any help
Urgent
Thanks
Sanjeev
|
|
|
|
|
You could make a separate setup project and add all files to that setup.
I don't know how it works with the service installer, but you should be able to integrate that one into the setup as well.
WM.
What about weapons of mass-construction?
|
|
|
|
|
hi WillemM,
Thanks for your reply.
Do u know how to add both set up file in one set up file
I have made two separate set up files
for both two project
thanks
sanjeev
|
|
|
|
|
Hi!
I'm beginer in visual c# and i have a big problem. Please explain me how to work with an acces database from c#. How to read articles from database, how to write and so on. Thank you!
|
|
|
|
|
Google[^] is your friend.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I used in constructor of my panel next string:
SetStyle(ControlStyles.DoubleBuffer|ControlStyles.AllPaintingInWmPaint|ControlStyles.UserPaint,true);
And i Still see flicking...
And Another one question - how to make real double buffering...
For Example i draw very difficult figure on the screen, when i finished, another window covers it, anw on OnPaint message i need to redraw, i would like to get the same image( i've already drawn) on the screen... Something like reserve buffer, that doesnt't change, until i didn't change any data...
|
|
|
|
|
Every time your window gets changed in size, dispose and then recreate a bitmap the size of the screen. Draw your stuff to this bitmap when you do this. In your paint message, just draw the image unscaled to the screen.
Double buffering means to have two bitmaps like this, and to draw to one while the other is displayed.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I can't understand, do you know any links about this theme???
Because i got problems with it :
1) Flicking;
2) When i change the size of window it repaints only the old (small) part of window
3) Sometimes my control (Panel), where i draw repaint, then clears with background color...
|
|
|
|
|
If you look up double buffering on google, I'm sure there are plenty of C++ articles that explain the concept. It's really simple, you should draw the image direct to the Graphics object in your Paint handler, and you should have the image already drawn and ready to go.
When you resize your window, it's up to you to set up the drawing code to draw to the new size. Doing what I said will take care of this.
Don't use a panel, just draw the bitmap onto the window.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yes i know this method, but it what image ("you should have the image already drawn ")i should draw?
I read that only controls can CreateGraphics...
Will it be the right way, if i dynamicly create a panel, but will not show it on the screen, draw on it, then copy image from it to my form???
|
|
|
|
|
Here is some pseudocode.
class MyForm
{
private Bitmap myBitmap;
MyForm()
{
InitialiseBitmap();
}
OnSizeChanged()
{
InitialiseBitmap();
Invalidate();
}
OnPaint()
{
e.gr.DrawImageUnscaled(myBitmap, 0, 0);
}
InitialiseBitmap()
{
if (myBitmap != null)
{
myBitmap.Dispose();
myBitmap = null;
}
myBitmap = new Bitmap(the size of your drawing window);
using (Graphics gr = Graphics.FromBitmap(myBitmap))
{
draw some stuff on the bitmap
}
}
Christian Graus - Microsoft MVP - C++
|
|
|
|