我有这个类,可以保存桌面的图片截图。
#region Class Imports
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using System.ComponentModel;
#endregion
namespace Manager
{
public class ScreenShot
{
#region Global Variables
private Bitmap _screenShot;
protected static
我想我已经找到了一种在c#中复制位图的更快的方法。(如果它是有效的,我确信我不是第一个,但我还没有在任何地方看到过它。)
我能想到的最简单的问这个问题的方法是,断言我的想法是基于什么,如果没有人对它提出质疑,就假设这个想法是正确的:
void FastCopyRegion(Bitmap CopyMe, ref Bitmap IntoMe, Rectangle CopyArea)
{
//`IntoMe` need not be declared `ref` but it brings
// attention to the fact it w
有没有办法将图像从我加载到excel工作表中的对象加载到此图像框中,例如
if userform1.checkbox1=True Then
userform1.image.picture = loadpicture (Worksheets("Sheet1").shapes("Picture 1")) endif
看起来, 对剪贴板没有任何影响,请参阅以下琐碎代码:
Dim bitmap1 As Image = New System.Drawing.Bitmap(100, 100)
Using gr As Graphics = Graphics.FromImage(bitmap1)
gr.FillRectangle(System.Drawing.Brushes.Black, 0, 0, 99, 99)
gr.FillRectangle(System.Drawing.Brushes.White, 10, 10, 89, 89)
End Using
bitmap1.SetResolutio
为了将BitBlt用于应用程序,我在中找到了一个C#引用,并将其转换为VB.net。我主要使用VB.net,这也是我转换它的原因,并试图以此方式使用它。它在C#中运行得很好,但是在VB.net中它有一个内存泄漏,我不知道如何修复它。
代码:
C#版本(从上面的源代码修改)。打开新项目,添加1个按钮和1个picturebox,修改lstPics.Add():
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
us
根据我在哪台计算机上运行,这段代码会得到不同的缩放。
Metafile image;
IntPtr dib;
var memoryHdc = Win32Utils.CreateMemoryHdc(IntPtr.Zero, 1, 1, out dib);
try
{
image = new Metafile(memoryHdc, EmfType.EmfOnly);
using (var g = Graphics.FromImage(image))
我以前问过,但似乎没有人能回答。所以,我现在改变我的问题。实际上,我已经发现了这个代码,并将图片复制到剪贴板上。但是,当代码在WinXp上运行时,它似乎无法工作,甚至无法检测到Clipboard.ContainImage。那么,有人知道如何修复这个或任何指南吗?
For Each sp As EXCEL.Shape In xlsheet.Shapes
sp.Copy()
picname = sp.Name
If Strings.Left(picname, 5) = "