Novo

Forum kao aplikacija na telefonu

Dodajte forum na početni ekran i koristite ga kao aplikaciju, sa menijem na dnu ekrana.

  • 2 odgovora
  • 2.714 pregleda

Najnovija ↓

Re: Treba mi nesto ovako: Bitmap.FromGraphics 21.07.2006. u 15:34 · pre 246 meseci #3
To je to, hvala

Evo klase

Code:

public static class MyBitmap
{
    [DllImport("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
        uint dwRop // raster operation code
        );
        
    public static Bitmap FromGraphics(Graphics g)
    {
        int w = (int) g.VisibleClipBounds.Width;
        int h = (int) g.VisibleClipBounds.Height;
        Bitmap b = new Bitmap(w, h, g);
        Graphics bg = Graphics.FromImage(b);
        IntPtr gdc = g.GetHdc();
        IntPtr bgdc = bg.GetHdc();
        BitBlt(bgdc, 0, 0, w, h, gdc, 0, 0, 0x00CC0020);
        g.ReleaseHdc(gdc);
        bg.ReleaseHdc(bgdc);
        bg.Dispose();
        return b;
    }
}
Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme