Click here to Skip to main content
15,907,906 members
Home / Discussions / C#
   

C#

 
QuestionRegular Expression Pin
Inderjeet Kaur3-Nov-09 22:28
Inderjeet Kaur3-Nov-09 22:28 
AnswerRe: Regular Expression Pin
padmanabhan N3-Nov-09 22:34
padmanabhan N3-Nov-09 22:34 
QuestionHow do you convert a number to a string in Crystal Reports? Pin
PravinYog3-Nov-09 22:25
PravinYog3-Nov-09 22:25 
AnswerRe: How do you convert a number to a string in Crystal Reports? Pin
Calla3-Nov-09 22:29
Calla3-Nov-09 22:29 
GeneralRe: How do you convert a number to a string in Crystal Reports? Pin
PravinYog3-Nov-09 22:49
PravinYog3-Nov-09 22:49 
QuestionRead xml node value from the xml file without loading the file Pin
Pankaj Saha3-Nov-09 21:57
Pankaj Saha3-Nov-09 21:57 
AnswerRe: Read xml node value from the xml file without loading the file Pin
dan!sh 3-Nov-09 22:30
professional dan!sh 3-Nov-09 22:30 
QuestionGlass Effect in XP using dwmapi.dll Pin
Viswa Teja3-Nov-09 21:57
Viswa Teja3-Nov-09 21:57 
hii I am desining a form that has glass effect. Well this code works on vista but i need it on Xp. The i am using gets an error saying that "DllNotFound Exception was unhandled". Well I have copyied all the dll that reqired for glass effect from vista.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.DirectX.AudioVideoPlayback;
using System.Diagnostics;
using System.Drawing.Drawing2D;


namespace welcome_page
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
this.FitGlass();
}
Video video;
private welcome_page.VistaGlassEffect.VistaApi.Margins marg;
private Rectangle topRect = Rectangle.Empty;
private Rectangle botRect = Rectangle.Empty;
private Rectangle lefRect = Rectangle.Empty;
private Rectangle rigRect = Rectangle.Empty;

private void FitGlass()
{
// If DWM is not enabled then get out
if (!this.IsGlassEnabled())
{
return;

}

// Set the Margins to their default values
marg.Top = 600; // extend from the top
marg.Left = 400; // not used in this sample but could be
marg.Right = 200; // not used in this sample but could be
marg.Bottom = 860;// not used in this sample but could be

this.Paint += new PaintEventHandler(this.Form1_Paint);

// call the function that gives us glass,
// passing a reference to our inset Margins
welcome_page.VistaGlassEffect.VistaApi.DwmExtendFrameIntoClientArea(this.Handle, ref marg);
}


private void apply()
{
this.Paint -= new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
this.RecreateHandle(); //needed if changing on the fly
this.FitGlass();

}


private bool IsGlassEnabled()
{
//if (Environment.OSVersion.Version.Major < 6)
//{
// Debug.WriteLine("How about trying this on Vista?");
// return false;
//}

//Check if DWM is enabled
bool isGlassSupported = false;
welcome_page.VistaGlassEffect.VistaApi.DwmIsCompositionEnabled(ref isGlassSupported);
return isGlassSupported;
}

// Alpha-blending Paint after the glass extension
// this seems better than the winforms transparency approach because here we can click on the glass!
private void Form1_Paint(object sender, PaintEventArgs e)
{
// black brush for Alpha transparency
SolidBrush blackBrush = new SolidBrush(Color.Black);

Graphics g = e.Graphics;

if (this.IsGlassEnabled())
{
// setup the rectangles
topRect = new Rectangle(0, 0, this.ClientSize.Width, marg.Top);
lefRect = new Rectangle(0, 0, marg.Left, this.ClientSize.Height);
rigRect = new Rectangle(this.ClientSize.Width - marg.Right, 0, marg.Right, this.ClientSize.Height);
botRect = new Rectangle(0, this.ClientSize.Height - marg.Bottom, this.ClientSize.Width, marg.Bottom);
// Fill Rectangles
g.FillRectangle(blackBrush, topRect);
g.FillRectangle(blackBrush, lefRect);
g.FillRectangle(blackBrush, rigRect);
g.FillRectangle(blackBrush, botRect);
}

blackBrush.Dispose();
}





protected override void WndProc(ref Message m)
{
base.WndProc(ref m);

if (m.Msg == welcome_page.VistaGlassEffect.VistaApi.WM_NCHITTEST // if this is a click
&& m.Result.ToInt32() == welcome_page.VistaGlassEffect.VistaApi.HTCLIENT // ...and it is on the client
&& this.IsOnGlass(m.LParam.ToInt32())) // ...and specifically in the glass area
{
m.Result = new IntPtr(welcome_page.VistaGlassEffect.VistaApi.HTCAPTION); // lie and say they clicked on the title bar
}
}

private bool IsOnGlass(int lParam)
{
// sanity check
if (!this.IsGlassEnabled())
{
return false;
}

// get screen coordinates
int x = (lParam << 16) >> 16; // lo order word
int y = lParam >> 16; // hi order word

// translate screen coordinates to client area
Point p = this.PointToClient(new Point(x, y));

// work out if point clicked is on glass
if (topRect.Contains(p) || lefRect.Contains(p) || rigRect.Contains(p) || botRect.Contains(p))
{
return true;
}

return false;
}
void buttn()
{

}
private void Form2_Load(object sender, EventArgs e)
{

int width = panel1.Width;
int height = panel1.Height;
System.Uri u = new Uri(@"Z:\B090105\Teja\C2\teja.avi");
video = Video.FromUrl(u);
video.Owner = panel1;
video.Play();
panel1.Size = new Size(width, height);
//this.apply();



}

private void button1_Click(object sender, EventArgs e)
{
this.Close();
//SpVoice sp = new SpVoice();
//sp.Speak("Who is this bich", SpeechVoiceSpeakFlags.SVSFlagsAsync);
//sp.WaitUntilDone(Timeout.Infinite);
}




}
}
Reply Me fast please
AnswerRe: Glass Effect in XP using dwmapi.dll Pin
Ghydo3-Nov-09 22:31
Ghydo3-Nov-09 22:31 
AnswerRe: Glass Effect in XP using dwmapi.dll Pin
padmanabhan N3-Nov-09 22:52
padmanabhan N3-Nov-09 22:52 
AnswerRe: Glass Effect in XP using dwmapi.dll Pin
The Man from U.N.C.L.E.3-Nov-09 23:16
The Man from U.N.C.L.E.3-Nov-09 23:16 
Questionvb Pin
singhsunita3393@yahoo.com3-Nov-09 21:47
singhsunita3393@yahoo.com3-Nov-09 21:47 
AnswerRe: vb Pin
Vikash Yadav3-Nov-09 21:54
Vikash Yadav3-Nov-09 21:54 
AnswerRe: vb Pin
Pete O'Hanlon3-Nov-09 21:59
mvePete O'Hanlon3-Nov-09 21:59 
AnswerRe: vb Pin
Nagy Vilmos3-Nov-09 22:34
professionalNagy Vilmos3-Nov-09 22:34 
GeneralRe: vb Pin
Pete O'Hanlon3-Nov-09 22:56
mvePete O'Hanlon3-Nov-09 22:56 
GeneralRe: vb Pin
Luc Pattyn3-Nov-09 23:19
sitebuilderLuc Pattyn3-Nov-09 23:19 
QuestionNeed Product Key of Dot net 2005 Pin
Vikash Yadav3-Nov-09 21:30
Vikash Yadav3-Nov-09 21:30 
AnswerMessage Closed Pin
3-Nov-09 21:33
stancrm3-Nov-09 21:33 
GeneralRe: Need Product Key of Dot net 2005 Pin
Vikash Yadav3-Nov-09 21:35
Vikash Yadav3-Nov-09 21:35 
GeneralMessage Closed Pin
3-Nov-09 21:39
stancrm3-Nov-09 21:39 
GeneralRe: Need Product Key of Dot net 2005 Pin
harold aptroot3-Nov-09 23:24
harold aptroot3-Nov-09 23:24 
GeneralRe: Need Product Key of Dot net 2005 Pin
dan!sh 3-Nov-09 21:44
professional dan!sh 3-Nov-09 21:44 
GeneralRe: Need Product Key of Dot net 2005 Pin
Vikash Yadav3-Nov-09 21:52
Vikash Yadav3-Nov-09 21:52 
GeneralRe: Need Product Key of Dot net 2005 Pin
Nagy Vilmos3-Nov-09 22:36
professionalNagy Vilmos3-Nov-09 22:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.