无法拍摄“S”的屏幕截图进行演示 [英] Not able to take screen shots of "S to make presentation

查看:71
本文介绍了无法拍摄“S”的屏幕截图进行演示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我对新闻组和C#相对较新。我从来没有感到失望

与团体一起得到了我的疑问的快速回复。这是另一个奇怪的问题,我面临的另一个奇怪的问题。请尽快帮我解决这个问题




所以我们走了......


我无法拍摄基于智能

客户端的Windows窗体的屏幕截图。在运行时申请。这是制作

演示文稿时的迫切需要。


直到现在我已尝试了4种方法...

--------------------------------

1)使用IrfanView软件
2)使用Snag-it

3)使用Camtasia_Capture& menumaker

4)使用下面给出的程序......


使用System;

使用System.Drawing;


使用System.Collections;


使用System.ComponentModel;


使用System.Windows.Forms;


使用System.Data;


使用System.Reflection;


使用Microsoft.Win32;


使用System.Runtime.InteropServices;


名称空间WindowsApplication1

{


///< summary>


/// Form1的摘要说明。


///< / summary>


公共类Form1:系统。 Windows.Forms的。表格


{


私有System.Windows.Forms.Timer timer1;


私有系统.ComponentModel.IContainer组件;


私有System.Windows.Forms.Button button1;


int i;


public Form1()


{


//


// Windows窗体设计器支持需要


//


InitializeComponent();


i = 0 ;


//


// TODO:在InitializeComponent调用后添加任何构造函数代码


//


}


///< summary>


///清洁任何正在使用的资源。


///< / summary>


protected override void Dispose(bool disposing)


{


if(处理)


{


if(components!= null)


{


components.Dispose();


}


}


base.Dispose(disposing);


}


[System.Runtime.InteropServices.DllImportAttribute(" gdi32.dll")]


private static extern bool BitBlt




IntPtr hdcDest,//目标DC的句柄

int nXDest,// x - 目的地左上角的


int nYDest,//目的地左上角的y-coord

int nWidth,/ /目标矩形的宽度


int nHeight,//目标矩形的高度

IntPtr hdcSrc,//来源DC的句柄


int nXSrc,//源左上角的x坐标

int nYSrc,//源左上角的y坐标


System.Int32 dwRop //光栅操作代码


);


private void Capture_Screen( string filename)


{


图形g1 = this.CreateGraphics();


Image MyImage = new Bitmap(this.ClientRectangle.Width,


this.ClientRectangle.Height,g1 );


MyImage =新的位图(this.ClientRectangle.Width,


this.ClientRectangle.Height,g1);


图形g2 = Graphics.FromImage(MyImage);


IntPtr dc1 = g1.GetHdc();


IntPtr dc2 = g2.GetHdc();


BitBlt(dc2,0,0,this.ClientRectangle.Width,


this。 ClientRectangle.Height,dc1,0,0,13369376);


g1.ReleaseHdc(dc1);


g2.ReleaseHdc(dc2) ;


MyImage.Save(@" d:\ rajat \ screen_captures \" + filename +" .jpg"

,System.Drawing.Imaging.ImageFormat.Jpeg);


}


#region Windows窗体设计器生成的代码


///< summary>


/// Designer支持所需的方法 - 请勿使用代码编辑器修改此方法的内容。


///< / summary>


private void InitializeComponent()

{


this.components = new System.ComponentModel.Container ();


this.timer1 = new System.Windows.Forms.Timer(this.components);


this.button1 = new System.Windows.Forms.Button();


this.SuspendLayout();


//


//计时器1


//


this.timer1.Enabled = true;


this.timer1.Interval = 1000;


this.timer1.Tick + = new System.EventHandler(this.timer1_Tick);


//
< br $>
//按钮1


//


this.button1.Location = new System.Drawing.Point(80 ,32);


this.button1.Name =" button1";


this.button1.TabIndex = 0;


this.button1.Text =" button1";


this.button1.Click + = new System.EventHandler(this.button1_Click); < br $>

//

// Form1


//


this.AutoScaleBaseSize = new System.Drawing.Size(5,13);


this.ClientSize = new System.Drawing.Size(232,101);


this.Controls.Add(this.button1);


this.Name =" Form1";


this.Text =" Form1";


this.WindowState = System.Windows.Forms.FormWindowState.Maximized;


this.Load + = new System.EventHandler(this.Form1_Load);


this.ResumeLayout(false);


}


#endregion


///< summary>


///应用程序的主要入口点。


///< / summary>


[STAThread]


static void Main()


{


Application.Run(new Form1());


}


private void Form1_Load(object sender,System .EventArgs e)


{


this.Hide();


}


private void Connecticon_Click(object sender,System.EventArgs e)


{

}


private void timer1_Tick(object sender,System.EventArgs e)


{

string filename;


试试


{


i = i + 1;


filename =" ; IMG" + i.ToString();

Capture_Screen(文件名);


}


catch(Exception exx)


{


MessageBox.Show(exx.Message.ToString());

this.Dispose( );


Application.Exit();


}


}


private void button1_Click(object sender,System.EventArgs e)


{

}


}


}

问题描述

-------------- --------


这些程序正在获取

windows应用程序背后的壁纸截图以及鼠标光标。所以它是很明显,

鼠标点击屏幕上的特定点,其中菜单或按钮

存在于我的应用程序中,但不会拍摄窗体的屏幕截图。难道不是吗?b $ b奇怪吗?另外这些程序正在拍摄其他基于windows的

应用程序的快照。


我可以拍摄我的应用程序的快照(对于<不可见) br />
以上节目)使用PrintScreen并将其粘贴在paint.Also我

能够拍摄一些应用程序的快照(使用上面的

4程序),其中有一个标签显示消息和一些背景

图像设置在运行时。


让我告诉你我的Windows应用程序使用的皮肤可以是

使用XML动态更改,并且表单中的
运行时设置的背景图像很少。我认为这个问题是因为某些属性

的应用程序或windows窗体。


我相信我已经很好地理解了这个问题。现在

球在你的球场上。请帮助我..........

问候,


Rajat Tandon。

DotNet Learner。

Hello there,

I am relatively new to the newsgroups and C#. I have never been disappointed
with the groups and always got the prompt replies to my queries.This is yet
another strange issue, I am facing. Please please help me to solve this as
soon as possible.

So here we go ...

I am not able to take the screen shot of the windows form based "Smart
Client" application at run time.This is urgently required for making the
presentation .

Till now I have tried 4 methods...
--------------------------------
1) Using IrfanView software
2) Using Snag-it
3) Using Camtasia_Capture&menumaker
4) Using the program which is given below...

using System;
using System.Drawing;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using System.Data;

using System.Reflection;

using Microsoft.Win32 ;

using System.Runtime.InteropServices;

namespace WindowsApplication1

{

/// <summary>

/// Summary description for Form1.

/// </summary>

public class Form1 : System.Windows.Forms.Form

{

private System.Windows.Forms.Timer timer1;

private System.ComponentModel.IContainer components;

private System.Windows.Forms.Button button1;

int i;

public Form1()

{

//

// Required for Windows Form Designer support

//

InitializeComponent();

i=0;

//

// TODO: Add any constructor code after InitializeComponent call

//

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if( disposing )

{

if (components != null)

{

components.Dispose();

}

}

base.Dispose( disposing );

}

[System.Runtime.InteropServices.DllImportAttribute( "gdi32.dll")]

private static extern bool BitBlt

(

IntPtr hdcDest, // handle to destination DC

int nXDest, // x-coord of destination upper-left corner

int nYDest, // y-coord of destination upper-left corner

int nWidth, // width of destination rectangle

int nHeight, // height of destination rectangle

IntPtr hdcSrc, // handle to source DC

int nXSrc, // x-coordinate of source upper-left corner

int nYSrc, // y-coordinate of source upper-left corner

System.Int32 dwRop // raster operation code

);

private void Capture_Screen(string filename)

{

Graphics g1 = this.CreateGraphics();

Image MyImage = new Bitmap(this.ClientRectangle.Width,

this.ClientRectangle.Height, g1);

MyImage = new Bitmap(this.ClientRectangle.Width,

this.ClientRectangle.Height, g1);

Graphics g2 = Graphics.FromImage(MyImage);

IntPtr dc1 = g1.GetHdc();

IntPtr dc2 = g2.GetHdc();

BitBlt(dc2, 0, 0, this.ClientRectangle.Width,

this.ClientRectangle.Height, dc1, 0, 0, 13369376);

g1.ReleaseHdc(dc1);

g2.ReleaseHdc(dc2);

MyImage.Save(@"d:\rajat\screen_captures\" + filename + ".jpg"
,System.Drawing.Imaging.ImageFormat.Jpeg);

}

#region Windows Form Designer generated code

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

this.components = new System.ComponentModel.Container();

this.timer1 = new System.Windows.Forms.Timer(this.components);

this.button1 = new System.Windows.Forms.Button();

this.SuspendLayout();

//

// timer1

//

this.timer1.Enabled = true;

this.timer1.Interval = 1000;

this.timer1.Tick += new System.EventHandler(this.timer1_Tick);

//

// button1

//

this.button1.Location = new System.Drawing.Point(80, 32);

this.button1.Name = "button1";

this.button1.TabIndex = 0;

this.button1.Text = "button1";

this.button1.Click += new System.EventHandler(this.button1_Click);

//

// Form1

//

this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);

this.ClientSize = new System.Drawing.Size(232, 101);

this.Controls.Add(this.button1);

this.Name = "Form1";

this.Text = "Form1";

this.WindowState = System.Windows.Forms.FormWindowState.Maximized;

this.Load += new System.EventHandler(this.Form1_Load);

this.ResumeLayout(false);

}

#endregion

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main()

{

Application.Run(new Form1());

}

private void Form1_Load(object sender, System.EventArgs e)

{

this.Hide();

}

private void Connecticon_Click(object sender, System.EventArgs e)

{
}

private void timer1_Tick(object sender, System.EventArgs e)

{
string filename;

try

{

i=i+1;

filename= "img" + i.ToString() ;
Capture_Screen(filename);

}

catch(Exception exx)

{

MessageBox.Show(exx.Message.ToString());
this.Dispose();

Application.Exit();

}

}

private void button1_Click(object sender, System.EventArgs e)

{
}

}

}
Problem Description
----------------------

These programs are taking the screenshots of the wallpaper behind the
windows application along with the mouse cursor .So it is apparent that
mouse is clicking on the particular points of screen where menus or button
exist in my application but doesn''t take the screen shot of form. Isn''t it
strange? Also these programs are taking the snapshot of other windows based
application.

I am able to take the snapshot of my application (which is not visible to
above programs) using "PrintScreen" and pasting it in the paint.Also I am
able to take the snapshots of some of the forms of application (using above
4 programs), which have a label to display the message and some background
image setup at runtime.

Let me tell you that my windows application uses the skins which can be
changed dynamically using XML and there are few background images setup at
runtime for the forms. I think that the problem is because of some property
of the application or windows form.

I believe that I have described the problem well enough to understand. Now
the ball is in your court. Please help me..........
Regards,

Rajat Tandon.
A DotNet Learner.

推荐答案

" Rajat Tandon" < RA ********** @ siliconbiztech.com>在消息中写道

新闻:Ot ************** @ TK2MSFTNGP15.phx.gbl ...
"Rajat Tandon" <ra**********@siliconbiztech.com> wrote in message
news:Ot**************@TK2MSFTNGP15.phx.gbl...
你好,

我对新闻组和C#相对较新。我从未对这些团体感到失望,并且总是迅速回复我的询问。这是另一个奇怪的问题,我正面临着。请尽快帮我解决这个问题。

所以我们走了......

我无法拍摄的屏幕截图基于Windows窗体的智能
客户端在运行时申请。这是制作
演示文稿的迫切需要。

直到现在我已尝试了4种方法......
---------- ----------------------
1)使用IrfanView软件
2)使用Snag-it
3)使用Camtasia_Capture& menumaker
4)使用下面给出的程序......
Hello there,

I am relatively new to the newsgroups and C#. I have never been
disappointed
with the groups and always got the prompt replies to my queries.This is
yet
another strange issue, I am facing. Please please help me to solve this as
soon as possible.

So here we go ...

I am not able to take the screen shot of the windows form based "Smart
Client" application at run time.This is urgently required for making the
presentation .

Till now I have tried 4 methods...
--------------------------------
1) Using IrfanView software
2) Using Snag-it
3) Using Camtasia_Capture&menumaker
4) Using the program which is given below...




怎么样

5)点击[Prt Scr] ,启动mspaint和粘贴。


David



How about
5) Hit [Prt Scr], launch mspaint and paste.

David


我怀疑海报在他说在运行时时以编程方式表示br />
所以我怀疑打印屏幕是否能够满足他的需求。


但是,这就是说,我想到了一个简单的方法(而且我没有''' t测试

这个,所以我可能错了),可能只需通过Win32 SendInput()API函数发送打印屏幕按键

然后获取位图来自

剪贴板。


Pete


" David Browne" < davidbaxterbrowne没有盆栽 me**@hotmail.com >写在

消息新闻:OP ************** @ TK2MSFTNGP14.phx.gbl ...
I suspect that the poster meant programmatically when he said "at runtime"
so I doubt print screen is going to meet his needs.

But, that said, it occurs to me that a simple way (and I haven''t tested
this, so I may be wrong), might be to simply send the print-screen keystroke
via the Win32 SendInput() API function and then get the bitmap out of the
clipboard.

Pete

"David Browne" <davidbaxterbrowne no potted me**@hotmail.com> wrote in
message news:OP**************@TK2MSFTNGP14.phx.gbl...
" Rajat Tandon" < RA ********** @ siliconbiztech.com>在消息中写道
新闻:Ot ************** @ TK2MSFTNGP15.phx.gbl ...
"Rajat Tandon" <ra**********@siliconbiztech.com> wrote in message
news:Ot**************@TK2MSFTNGP15.phx.gbl...
你好,


所以我们走了......

我无法拍摄的屏幕截图基于Windows窗体的智能
客户端在运行时申请。这是制作
演示文稿的迫切需要。

直到现在我已尝试了4种方法......
---------- ----------------------
1)使用IrfanView软件
2)使用Snag-it
3)使用Camtasia_Capture& menumaker
4)使用下面给出的程序...
Hello there,

I am relatively new to the newsgroups and C#. I have never been
disappointed
with the groups and always got the prompt replies to my queries.This is
yet
another strange issue, I am facing. Please please help me to solve this as soon as possible.

So here we go ...

I am not able to take the screen shot of the windows form based "Smart
Client" application at run time.This is urgently required for making the
presentation .

Till now I have tried 4 methods...
--------------------------------
1) Using IrfanView software
2) Using Snag-it
3) Using Camtasia_Capture&menumaker
4) Using the program which is given below...



如何
5)点击[Prt Scr],启动mspaint并粘贴。 />
大卫



How about
5) Hit [Prt Scr], launch mspaint and paste.

David



嗨大卫和大家,


谢谢你早回复。当然PrintScreen是一个选项,但不是一个好的

一个,因为我必须做演示。打印屏幕和粘贴将需要我

这样做数千次.Hence我想要自动化方式。


寻找更多回复


再见

Rajat Tandon

DotNet Learner


" David Browne" < davidbaxterbrowne没有盆栽 me**@hotmail.com >写在

消息新闻:OP ************** @ TK2MSFTNGP14.phx.gbl ...
Hi David and everybody,

Thank you for early reply. Of course PrintScreen is an option but not a good
one, As I have to make presentation. Print Screen and paste will require me
to do this for thousands of time.Hence I want the automated way.

Looking for more replies

Bye
Rajat Tandon
A DotNet Learner

"David Browne" <davidbaxterbrowne no potted me**@hotmail.com> wrote in
message news:OP**************@TK2MSFTNGP14.phx.gbl...
" Rajat Tandon" < RA ********** @ siliconbiztech.com>在消息中写道
新闻:Ot ************** @ TK2MSFTNGP15.phx.gbl ...
"Rajat Tandon" <ra**********@siliconbiztech.com> wrote in message
news:Ot**************@TK2MSFTNGP15.phx.gbl...
你好,


所以我们走了......

我无法拍摄的屏幕截图基于Windows窗体的智能
客户端在运行时申请。这是制作
演示文稿的迫切需要。

直到现在我已尝试了4种方法......
---------- ----------------------
1)使用IrfanView软件
2)使用Snag-it
3)使用Camtasia_Capture& menumaker
4)使用下面给出的程序...
Hello there,

I am relatively new to the newsgroups and C#. I have never been
disappointed
with the groups and always got the prompt replies to my queries.This is
yet
another strange issue, I am facing. Please please help me to solve this as soon as possible.

So here we go ...

I am not able to take the screen shot of the windows form based "Smart
Client" application at run time.This is urgently required for making the
presentation .

Till now I have tried 4 methods...
--------------------------------
1) Using IrfanView software
2) Using Snag-it
3) Using Camtasia_Capture&menumaker
4) Using the program which is given below...



如何
5)点击[Prt Scr],启动mspaint并粘贴。 />
大卫



How about
5) Hit [Prt Scr], launch mspaint and paste.

David



这篇关于无法拍摄“S”的屏幕截图进行演示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆