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

New Message on MumbaiUserGroup

-----------------------------------------------------------
From: Preeti
Message 20 in Discussion


Hi 
 

The code which can be used to 
flip a datgrid horizontally is given below. 
 
**************************************************************************************************

  
  
using 
  System.Drawing;
  
using 
  System.Drawing.Drawing2D;
  
private System.Windows.Forms.PictureBox pictureBox1;
  
private System.Windows.Forms.DataGrid 
  dataGrid1;
  
// Binding of datagrid on form 
  load
  
private void Form1_Load(object sender, 
  System.EventArgs e){
  
SqlConnection sConn= new 
  SqlConnection("server=preeti;User ID=sa;PWD=;database=pubs");
  
SqlDataAdapter sda=new 
  SqlDataAdapter("SELECT fname as name FROM employee",sConn);
  
DataSet ds=new 
  DataSet();
  
sda.Fill(ds);
  
dataGrid1.DataSource=ds;
  
} 
  
  
// End
  
// On paint event of the datagrid 
  
  
private void 
  dataGrid1_Paint(object sender, 
  System.Windows.Forms.PaintEventArgs ne){
  
Graphics gGrid = 
  dataGrid1.CreateGraphics();
  
Image MyImage = new 
  Bitmap(dataGrid1.ClientRectangle.Width, dataGrid1.ClientRectangle.Height, 
  gGrid);
  
Graphics gImage = 
  Graphics.FromImage(MyImage);
  
IntPtr hdcGrid = gGrid.GetHdc();
  
IntPtr hdcImage = gImage.GetHdc();
  
//BitBlt function does 
  transfer of color data from the specified source device context into a 
  destination device context in this case from dataGrid1 to MyImage
  
BitBlt(hdcImage, 0, 0, 
  dataGrid1.ClientRectangle.Width, dataGrid1.ClientRectangle.Height, hdcGrid, 0, 
  0, 13369376);
  
gGrid.ReleaseHdc(hdcGrid);
  
gImage.ReleaseHdc(hdcImage);
  
MyImage.RotateFlip(RotateFlipType.Rotate180FlipNone);
  
pictureBox1.Image =MyImage; 
  
}
  
// 
End
  
[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
  
);

 

**************************************************************************************************
Regards
Preeti

  ----- Original Message ----- 
  From: 
  BusyWizy 
  
  To: MumbaiUserGroup 
  Sent: Friday, July 18, 2003 11:12 
PM
  Subject: Re: How to rotate a 
  Datagrid
  
 
  
    
      
      New Message on MumbaiUserGroup
    
      

  How to 
    rotate a Datagrid


    
      
      
        Reply

        
          
            
            
               
              Reply to Sender   Recommend 
              Message 19 in 
                Discussion 
      
        
          
            
            
              From: BusyWizy 
            
              

hi preeti,

nice to know 
                that finally your problem is solved (so what if the arguments 
                
got a bit heated towards the end :-))

btw this is 
                quite an interesting issue and i am sure not many people would 
                
be aware on how u went about doing it.
would u mind 
                sharing the source code with the community or better still 
                
would u mind demonstrating it at our next user group meet on 
                27th Jul. ?

regards,
nauzad kapadia 
                [mvp]



At 06:34 PM 18/07/2003, you 
                wrote:
>-----------------------------------------------------------
>
>New 
                Message on 
                MumbaiUserGroup
>
>-----------------------------------------------------------
>From: 
                Preeti
>Message 18 in Discussion
>
>
>Hi 
                Kishor
>
>Hey what you suggested works. On 
                paint
>event of the datagrid, create an image object of 
                the datagrid, rotate &
>assign it to a 
                picturebox.
>Thanks a 
                lot.
>
>Regards
>Preeti
>
> ----- 
                Original Message -----
> From:
> 
                Kishor
>
> To: MumbaiUserGroup
> Sent: 
                Thursday, July 17, 2003 12:16
> PM
> Subject: Re: 
                How to rotate a
> 
                Datagrid
>
>
>
>
>
> New 
                Message on 
          MumbaiUserGroup
>



View other groups in this 
    category. 



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

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/mumbaiUserGroup/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to