这是来自原始文章.
static Bitmap CaptureCursor(ref int x, ref int y)
{
Bitmap bmp;
IntPtr hicon;
Win32Stuff.CURSORINFO ci = new Win32Stuff.CURSORINFO();
Win32Stuff.ICONINFO icInfo;
ci.cbSize = Marshal.SizeOf(ci);
if (Win32Stuff.GetCursorInfo(out ci))
{
if (ci.flags == Win32Stuff.CURSOR_SHOWING)
{
hicon = Win32Stuff.CopyIcon(ci.hCursor);
if (Win32Stuff.GetIconInfo(hicon, out icInfo))
{
x = ci.ptScreenPos.x - ((int)icInfo.xHotspot);
y = ci.ptScreenPos.y - ((int)icInfo.yHotspot);
Icon …Run Code Online (Sandbox Code Playgroud) 在开发人员的控制台上,当你去发布你的Android应用程序时,屏幕截图需要以下规格,320 x 480,480 x 800,480 x 854,1280 x 720,1280 x 800 24位PNG或JPEG(无alpha)Full流血,没有艺术边界.现在,在这个链接上,它说:"你最多可以上传8个屏幕截图." 我的问题是,
我正在尝试与Facebook实现共享应用程序.我使用此代码截取屏幕截图:
CGSize imageSize = CGSizeMake(self.view.bounds.size.width, self.view.bounds.size.height);
UIGraphicsBeginImageContext(imageSize);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Run Code Online (Sandbox Code Playgroud)
它在iOS 6上运行良好,但在iOS 7中,图像看起来很糟糕.我使用了这个答案:iOS:以编程方式制作屏幕截图的最快,最高效的方法是什么? 试图解决它,它有帮助,仍然截图看起来很糟糕.屏幕获得另一种颜色,并且在拍摄的图像上没有显示某些对象(如标签).有帮助吗?
---- ----更新
我设法解决了大多数对象,通过改变它们来保留而不是弱.我的主要问题仍然是我的tableview,显示为一个大的白色块(它应该是透明的,带有白色文本的标签,所以我们看到的只是白色单元格).我确实尝试将表格背景定义为clearcolor,没有帮助..
- - 最后更新 - -
这里有很好的答案,并不是真的与我的问题有关..我想让它在iOS7上运行但不使用iOS7 SDK的设备上运行,因为在这一点上,当项目切换项目SDK需要花费很多精力差不多完成了.
无论如何,我添加了最终解决了我的问题的代码的和平:
这个改变只是解决了这个问题:
UIGraphicsBeginImageContextWithOptions(imageSize, NO , 0.0f);
Run Code Online (Sandbox Code Playgroud)
代替:
UIGraphicsBeginImageContext(imageSize);
Run Code Online (Sandbox Code Playgroud) 在旧版本的Xcode Simulator(Xcode 8)中,你可以按下Command + 1,它会显示模拟器的最大尺寸(100%),即使它涉及它扩展到可见的屏幕空间.然后,您可以按Command + S并从任何模拟器截取屏幕截图,并将其直接用于应用商店.(这将是正确的解决方案).我为iPad Pro 12.9"和iPhone 6s Plus做了这个,快速填写我的截图部分.
现在,在Xcode 9中,这不再适用.我尝试了所有选项:手动调整大小,设置为100%,放大/缩小等.所有选项都不允许我将模拟器扩展到屏幕的可见范围之外.它不会让你拖过角落的边界.所以当你按COMMAND + S来截取屏幕截图时,它会比ItunesConnect需要的更低.
那么我们现在如何才能使用模拟器截取屏幕截图,并让它们可以用于具有正确分辨率的商店?
我正在为客户开发企业iPhone应用程序,手头的问题是客户信息会显示在手机上.我的客户担心可以使用iphone屏幕捕获功能(家庭+电源按钮)捕获信息,然后通过电子邮件发送或同步.有没有办法禁用屏幕捕获功能?这可以通过编程方式完成,还是可以通过配置文件完成?
我正在Android中创建一个应用程序,我必须截取我的一个活动的截图并将其作为附件发送.
我想截取当前页面的截图,然后通过电子邮件,蓝牙,Twitter或Facebook分享.
我的代码如下:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menuselected1, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.ScreenShot:
try {
takeScreenShot(this);
}
catch (Exception e) {
System.out.println(e);
}
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private static void savePic(Bitmap b, String strFileName) {
FileOutputStream fos = null;
try {
fos = new FileOutputStream(strFileName);
if (null != fos) {
b.compress(Bitmap.CompressFormat.PNG, 90, fos);
System.out.println("b is:"+b);
fos.flush();
fos.close();
}
} catch (FileNotFoundException …Run Code Online (Sandbox Code Playgroud) 出于安全原因,我需要阻止我的应用用户截屏.我显示的内容是保密的,不应复制到设备上.我在Stack Overflow上看到了一个答案,但对于Android.
是否有可能在iOS中阻止屏幕捕获?
通过点击几个按钮将屏幕截图捕获到图库中对于用户来说是一个非常有用的功能,但是对它的预防也是有限的.有什么指针吗?
我使用Bing地图WPF控件创建了一个WPF应用程序.我希望能够只截取Bing地图控件.
使用此代码制作屏幕截图:
// Store the size of the map control
int Width = (int)MyMap.RenderSize.Width;
int Height = (int)MyMap.RenderSize.Height;
System.Windows.Point relativePoint = MyMap.TransformToAncestor(Application.Current.MainWindow).Transform(new System.Windows.Point(0, 0));
int X = (int)relativePoint.X;
int Y = (int)relativePoint.Y;
Bitmap Screenshot = new Bitmap(Width, Height);
Graphics G = Graphics.FromImage(Screenshot);
// snip wanted area
G.CopyFromScreen(X, Y, 0, 0, new System.Drawing.Size(Width, Height), CopyPixelOperation.SourceCopy);
string fileName = "C:\\myCapture.bmp";
System.IO.FileStream fs = System.IO.File.Open(fileName, System.IO.FileMode.OpenOrCreate);
Screenshot.Save(fs, System.Drawing.Imaging.ImageFormat.Bmp);
fs.Close();
Run Code Online (Sandbox Code Playgroud)
我的问题:
在Width和Height似乎是坏的(假值).生成的屏幕截图似乎使用了不良坐标.
我的截图:

我期待的是:

为什么我得到这个结果?我尝试在发布模式下,没有Visual Studio,结果是一样的.
我认为标题几乎涵盖了它,但我的活动中有一个webview.我已经在网页视图中加载了一个网址,我想要整个页面的截图(视口中的内容以及"下方"的内容).
我有代码可以对视口进行快照,我知道这可以通过在快照之前放大webview来在iOS中完成.我试过在这里使用相同的技术:
WebView browserView = (WebView) findViewById(R.id.browserView);
//Resize the webview to the height of the webpage
int pageHeight = browserView.getContentHeight();
LayoutParams browserParams = browserView.getLayoutParams();
browserView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, pageHeight));
//Capture the webview as a bitmap
browserView.setDrawingCacheEnabled(true);
Bitmap bitmap = Bitmap.createBitmap(browserView.getDrawingCache());
browserView.setDrawingCacheEnabled(false);
//Create the filename to use
String randomFilenamepart = String.valueOf(new SecureRandom().nextInt(1000000));
String filename = Environment.getExternalStorageDirectory().toString() + "/Screenshot_" + randomFilenamepart + ".jpg";
File imageFile = new File(filename);
//Stream the file out to external storage as a JPEG
OutputStream fout = null;
try { …Run Code Online (Sandbox Code Playgroud) iTunesconnect上的Mac应用程序的IAP屏幕截图应使用哪些尺寸?
我尝试上传PNG屏幕截图:
2560 x 1600 px
640 x 920 px
Run Code Online (Sandbox Code Playgroud)
无济于事......但上传似乎没有被接受......任何人都可以建议接受哪些尺寸?Apple指定640 x 920,但它不上传,也没有错误消息.