Google Groups Home
Help | Sign in
WPF Image Control probem - help needed
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
AT  
View profile
 More options Nov 21 2008, 3:27 pm
From: AT <ananthasri...@gmail.com>
Date: Thu, 20 Nov 2008 20:27:54 -0800 (PST)
Local: Fri, Nov 21 2008 3:27 pm
Subject: WPF Image Control probem - help needed
Hello guys,

I am trying to do some HLSL effects with DirectX library. Basically I
want to freeze the screen and show a radially blurred screen using the
HLSL effects and a MessageBox on top of that which is active. The
whole effect is somewhat similar to Vista User Account Control effect
where the active screen turns gray and the messagebox is active and
shown in bright shades.

Just before I show the messagebox I capture an image of the entire
screen and save it to the directory (during development in Debug
folder).

            int sWidth = (int)
System.Windows.SystemParameters.PrimaryScreenWidth;
            int sHeight = (int)
System.Windows.SystemParameters.PrimaryScreenHeight;

            string path = Environment.CurrentDirectory;
            System.Drawing.Image bit = new Bitmap(sWidth, sHeight);

            Graphics gs = Graphics.FromImage(bit);
            try
            {
                gs.CopyFromScreen(new System.Drawing.Point(0, 0), new
System.Drawing.Point(0, 0), bit.Size);

                gs.Dispose();

                bit.Save(path + @"\tem.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg);

            }
            catch
            {

            }
            finally
            {
                bit.Dispose();
            }

At this point tem.jpg has been created.

I create an instance of a window with WindowState="Maximized" and
WindowStyle=None to occupy the full screen with an Image control.

<Window x:Class="FullScreenTest.Window2"
    Title="Window2" WindowState="Maximized"  WindowStyle="None"
Loaded="Window_Loaded" >
    <Grid>
        <Image Name="winBck" Height="Auto" Width="Auto"/>
    </Grid>
</Window>

At runtime I am trying to set the Image Source to the image I just
saved and then popping the MessageBox on top with the following line
as this.Close() so that when the user says 'OK' or 'Cancel' in the
message box I can close this Window2 and show the active window or
close the application.

            BitmapImage bmp = new BitmapImage();
            bmp.BeginInit();
            bmp.UriSource = new Uri(Environment.CurrentDirectory +
@"\tem.jpg", UriKind.Relative);
            bmp.EndInit();
            wndBack.Source = bmp;

Separately I have tried the radial blur and it works fine.

When the image is an embedded resource it gets displayed. But the
Image has to be updated every time the error occurs so that the exact
screen shot just before the error is captured and used.

I am not sure if this is the best way to implement the UAC display
effects. If there are better ways please do let me know.

If anyone can find/suggest a solution I would greatly appreciate it.

Thank you for your time.

AT


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google