Click here to Skip to main content
15,922,584 members
Home / Discussions / C#
   

C#

 
GeneralRe: Extender examples Pin
Zombies with Coffee, LLC20-Aug-02 11:21
professionalZombies with Coffee, LLC20-Aug-02 11:21 
GeneralSAS Dataset Pin
Jassim Rahma20-Aug-02 5:52
Jassim Rahma20-Aug-02 5:52 
GeneralRe: SAS Dataset Pin
Mazdak20-Aug-02 9:10
Mazdak20-Aug-02 9:10 
GeneralRe: SAS Dataset Pin
Ray Cassick20-Aug-02 9:20
Ray Cassick20-Aug-02 9:20 
GeneralRe: SAS Dataset Pin
Jassim Rahma23-Aug-02 9:42
Jassim Rahma23-Aug-02 9:42 
GeneralInsert a graphics in an other graphics Pin
troz20-Aug-02 5:47
troz20-Aug-02 5:47 
GeneralRe: Insert a graphics in an other graphics Pin
James T. Johnson20-Aug-02 7:59
James T. Johnson20-Aug-02 7:59 
GeneralRe: Insert a graphics in an other graphics Pin
troz20-Aug-02 21:32
troz20-Aug-02 21:32 
Thanks a lot Big Grin | :-D

there is the solution, found on http://www.syncfusion.com/FAQ/WinForms/FAQ_c55c.asp


[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 button1_Click(object sender, System.EventArgs e)
{
Graphics g1 = panel1.CreateGraphics();
Graphics g2 = panel2.CreateGraphics();

//Drawing on panel1 (g1)
//...

//Copy it to panel2
Size s = panel1.Size;
Image memImage = new Bitmap(s.Width, s.Height, g1);
Graphics memGraphic = Graphics.FromImage(memImage);
IntPtr dc1 = g1.GetHdc();
IntPtr dc2 = memGraphic.GetHdc();
BitBlt(dc2, 0, 0, panel1.ClientRectangle.Width,
panel1.ClientRectangle.Height, dc1, 0, 0, 13369376);
g1.ReleaseHdc(dc1);
memGraphic.ReleaseHdc(dc2);
g2.DrawImage(memImage,0,0);
}

It works with any Graphics object (you can copy a form, a MSChart ...)

Troz
GeneralInterfaces and Static methods - How could they!!! Pin
Ryan Cromwell20-Aug-02 4:11
Ryan Cromwell20-Aug-02 4:11 
GeneralRe: Interfaces and Static methods - How could they!!! Pin
leppie20-Aug-02 4:23
leppie20-Aug-02 4:23 
GeneralRe: Interfaces and Static methods - How could they!!! Pin
Ryan Cromwell20-Aug-02 4:43
Ryan Cromwell20-Aug-02 4:43 
GeneralRe: Interfaces and Static methods - How could they!!! Pin
Philip Fitzsimons20-Aug-02 4:48
Philip Fitzsimons20-Aug-02 4:48 
GeneralRe: Interfaces and Static methods - How could they!!! Pin
leppie20-Aug-02 5:13
leppie20-Aug-02 5:13 
GeneralRe: Interfaces and Static methods - How could they!!! Pin
Ryan Cromwell20-Aug-02 7:08
Ryan Cromwell20-Aug-02 7:08 
GeneralRe: Interfaces and Static methods - How could they!!! Pin
leppie20-Aug-02 7:29
leppie20-Aug-02 7:29 
GeneralRe: Interfaces and Static methods - How could they!!! Pin
James T. Johnson20-Aug-02 7:38
James T. Johnson20-Aug-02 7:38 
GeneralRe: Interfaces and Static methods - How could they!!! Pin
Ryan Cromwell20-Aug-02 7:52
Ryan Cromwell20-Aug-02 7:52 
GeneralIDE hangs up on executing ! Pin
EdgarBM20-Aug-02 0:16
EdgarBM20-Aug-02 0:16 
GeneralRe: IDE hangs up on executing ! Pin
Nnamdi Onyeyiri20-Aug-02 0:52
Nnamdi Onyeyiri20-Aug-02 0:52 
GeneralRe: IDE hangs up on executing ! Pin
James T. Johnson20-Aug-02 5:44
James T. Johnson20-Aug-02 5:44 
GeneralRe: IDE hangs up on executing ! Pin
Nnamdi Onyeyiri20-Aug-02 6:12
Nnamdi Onyeyiri20-Aug-02 6:12 
GeneralRe: IDE hangs up on executing ! Pin
Stephane Rodriguez.20-Aug-02 1:22
Stephane Rodriguez.20-Aug-02 1:22 
GeneralRe: IDE hangs up on executing ! Pin
EdgarBM20-Aug-02 1:26
EdgarBM20-Aug-02 1:26 
GeneralRe: IDE hangs up on executing ! Pin
Nnamdi Onyeyiri20-Aug-02 3:16
Nnamdi Onyeyiri20-Aug-02 3:16 
GeneralRe: IDE hangs up on executing ! Pin
leppie20-Aug-02 3:33
leppie20-Aug-02 3:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.