|
Hi
Is there any method by which I can make an app transparent...like even if it appears(not completely transparent), it should not respond to mouse clicks (say if the ctrl key wasnt pressed along with a mouse click) and should transfer the ctrl to the app behind it...
Example:
Letz a scoreboard display and behind it IE...u dont need any user triggered event for it...so even if i click in the display, IE should respond and not the display..
Is there any method in C#?
Thanks
|
|
|
|
|
Oh most definately, there is a property in the System.Windows.Forms.Form class! Make a form with these properties:
/////
this.TransparencyKey = System.Drawing.SystemColors.Control;
this.Opacity = .8;
/////
Setting the TRANSPARENCYKEY to that will make the form seem invisible. Not visibly, but... like you said, it makes it so when the user clicks, it responds to whatever is running behind it.
Setting the OPACITY makes it look invisible. Setting it to "1.0" makes it very slightly invisible, however, when set to ".1" you can hardly see it.
Hope this helps!
|
|
|
|
|
kewl thanks..ill try it...
|
|
|
|
|
But is it possible to get the controls to this transparent window when needed (like it shud respond whenever i click the mouse along with the ctrl key)...?? Because from what you said..it seems that windows will manage the ctrls and decide only based on opacity and not on programmer's setting right?
|
|
|
|
|
Here ya are! Best I can come up with so far! Any questions?
<br />
public class Joshua : Form {<br />
[STAThread]<br />
public static void Main() {<br />
Application.Run(new Joshua());<br />
}<br />
<br />
public Joshua() {<br />
this.ClientSize = new Size(520, 310);<br />
this.Name = "Form1";<br />
this.ShowInTaskbar = false;<br />
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;<br />
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;<br />
this.TopMost = true;<br />
this.TransparencyKey = System.Drawing.SystemColors.Control;<br />
this.Opacity = .8;<br />
}<br />
<br />
protected override void OnKeyDown(KeyEventArgs kea) {<br />
if(kea.KeyCode == Keys.ControlKey) {<br />
this.TransparencyKey = System.Drawing.Color.Empty;<br />
}<br />
}<br />
<br />
protected override void OnKeyUp(KeyEventArgs kea) {<br />
if(kea.KeyCode == Keys.ControlKey) {<br />
this.TransparencyKey = System.Drawing.SystemColors.Control;<br />
}<br />
}<br />
}<br />
<br />
|
|
|
|
|
Yo buddy..
tat works...need to build my app (it is just a cricket(a game) scorecard )..as existing ones occupy my desktop
thanks again pal...tat was one awesome quickness uve got!!
|
|
|
|
|
Great! Glad I could help !
|
|
|
|
|
hi every body!
I want to write a program that can take all unread mail from OutLook, but don't know how to do it, any one have experience about it, please give me some suggest!
Thanks alot!
xyz
|
|
|
|
|
You could use a third party IMAP control. IMAP has a flag that can be checked if a message has been read. However, with IMAP, you will have to have the username and password to "login" to the account you want to check.
I have used the IMAP control from http://www.quiksoftcorp.com/.
|
|
|
|
|
hello dave,
how r u?? i hope u r okay,,,,as u r the one who advice me here very good advices...today i want to trace MSN Chat sessions...so what do u suggest??
and their history of course
|
|
|
|
|
hello there,
dave doesnt reply me so any1 knows how we know the msn chat sessions history programmatically???
|
|
|
|
|
I'm sure many of you have read several books on c# out there. I looked at the book reviews on here and didn't really find what i was looking for.
I would like a book if one exist. That takes you thru c# from beginning to advanced. Basically a book that assumes you know nothing about the language. Then when you turn the last page you know how to make real world applications with a pretty good syntax understanding. I just don't like books that say ok here is the code. and never really explains what does what. an example is great but only if you understand what the example is doing.
Is Professional C# any good?
I hate the Sam's books. They say learn in 24 hours, its more like 24 years.
I would like a book for visual c# if possible.
Thanks for your reply
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
|
|
hi,
I'm porting a program made in C to C# and I get blocked at this point
<br />
long UpdateCRC (unsigned long CRC, const char *buffer, long count)<br />
{<br />
<br />
if ( buffer && count )<br />
{<br />
do {<br />
CRC = ((CRC >> 8) & 0xFFFFFF) ^ CRCTABLE[(unsigned char)( (CRC & 0xff) ^ *buffer++ )]; <br />
} while(--count);<br />
<br />
}<br />
return CRC;<br />
}<br />
}<br />
My question is.... C# does not suppot --count and *buffer++...... how to solve it? it's better to make a dll from my old program and to call functions losing portability or there's a workaround??
thanks in advance
|
|
|
|
|
first you have to mark your method "unsafe" since it uses pointers..
unsafe long UpdateCRC (unsigned long CRC, const char *buffer, long count)
also , c# dont auto convert numbers into bools, so you have to do:
while(--count>0);
//Roger
|
|
|
|
|
and for what concern *buffer++??
I find extremly hard to use pointer in C#... =)
thanks for having answered me so fast
|
|
|
|
|
Normally you'd pass the buffer as a byte[] - you probably wouldn't even bother passing count as .NET arrays have the Length property. A non-literal translation would be:
public static uint UpdateCRC( uint CRC, byte[] buffer )
{
for ( int i = 0; i < buffer.Length; ++i )
{
CRC =
( CRC >> 8 ) & 0xFFFFFF ^
CRCTABLE[ (byte)( CRC & 0xFF ) ^ buffer[i] ];
}
return CRC;
} [EDIT] Forgot a cast [/EDIT]
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
thanks a lot for your help!
Paolo
|
|
|
|
|
Hi every one:
I want to get a picture from access.I try to do it in many way.
But I failed.Could you give me some addvices?
Best wishes
|
|
|
|
|
|
Thank you:
But it is a sql database.
I want to do it in Access database.
could you help me?
|
|
|
|
|
Don't remember how things are done in Access, but normally images are stored to BLOBs (SQL datatype). Try to look from Access documentation is there any help available from BLOB datatypes. I am also pretty sure that there is ready example somewhere for access also. Try to use some google
|
|
|
|
|
I've got an application that I'm writing that I want to use plugins with. I've looked through the plugin examples, and to the best of my knowledge have done the same (although in a slightly different fashion) as the examples.
Oh, and sorry about the lack of tabs...I can't seem to get the forum to display them...
My plugin interface:
// The terrain modifier plugin interface.
public interface ITerrainPlugin {
string Name{get;}
void ShowInterface();
void CalculateHeight(float[,] heights);
}
The test plugin (no actual meaningful code...):
// project created on 4/1/2004 at 12:58 PM
using System;
public class TerrainNoisePlugin : ITerrainPlugin {
public string Name {
get {
return "Deffie's Terrain Noise Plugin";
}
}
public void ShowInterface() {
System.Windows.Forms.MessageBox.Show("Interface? Ha! Not yet, bud ");
}
public void CalculateHeight(float[,] heights) {
}
}
And here's the code to load the plugins (each is located in App.StartupPath + "\\Plugins\\Terrain\\" and args contains the class name, which is the same as the dll file name minus the .dll):
try {
Type plugType = null;
Assembly asm = null;
asm = Assembly.LoadFrom(Application.StartupPath + "\\Plugins\\Terrain\\" + args + ".dll");
if (asm != null) {
plugType = asm.GetType(args);
} else {
MessageBox.Show("Assembly is null");
}
if (plugType != null) {
object instance = Activator.CreateInstance(plugType);
if (instance != null) {
MessageBox.Show("Instance isn't null...type is: " + instance.GetType());
} else {
MessageBox.Show("instance is null");
}
ITerrainPlugin plugin = (ITerrainPlugin)instance;
if (plugin == null) {
MessageBox.Show("plugin instance is null");
} else {
plugin.ShowInterface();
}
} else
MessageBox.Show("Type is null");
} catch (Exception eX) {
MessageBox.Show("Error: " + eX.Message, "Error");
}
It complains at this line:
ITerrainPlugin plugin = (ITerrainPlugin)instance;
With the complaint that this is not a valid cast.
Any ideas?
Aaron
|
|
|
|
|
Defiant00 wrote:
MessageBox.Show("instance is null");
TerrainPluginInterface plugin = (TerrainPluginInterface)instance;
Need i say more? [edit] actually I think I read it wrong (why dont ppl use {}?), what does the previous message box say? [edit]
top secret
|
|
|
|