|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
unable to paste from clipboardpicturebox on a form. The code I am using to copy is Globals.Profiles.Range("ProfileChart").CopyPicture(Excel.XlPictureAppearance.xlScreen, Excel.XlCopyPictureFormat.xlPicture) to paste the chart into a picturebox I first tried Me.PictureBox1.Image = Clipboard.GetImage That did not work and then I tried Me.PictureBox1.Image = DirectCast(Clipboard.GetDataObject().GetData(DataFormats.Bitmap, False), Bitmap) that did not work either. I can paste the bitmap into any other application like word, excel or outlook. When I query clipboard.containsimage I get false. Please help !!!!! Sai,
CopyPicture has always been a nightmare. You need to export the chart as a graphic file then load it to the picturebox. Here's an example in VB that should get you going. Private Sub Form_Load() Dim oXL As Excel.Application Set oXL = GetObject(, "Excel.Application") oXL.Sheets(1).ChartObjects(1).Chart.Export "c:\temp\chart.gif", "gif" Set oXL = Nothing Set Picture1.Picture = LoadPicture("c:\temp\chart.gif") End Sub If speed is critical, you could also have a look at Stephen Bullen's pastepicture routine which I use a lot in my XspandXL add-in to speed up my ChartBrowser routines. It should be somewhere here: http://www.oaltd.co.uk/Excel/Default.htm Robin Hammond www.enhanceddatasystems.com Show quoteHide quote "Sai" <s**@manam.net> wrote in message news:k-mdnXOW0oRM0MHfRVn-tA@comcast.com... >I am trying to copy a range as a picture from excel and paste that into a >picturebox on a form. > > The code I am using to copy is > Globals.Profiles.Range("ProfileChart").CopyPicture(Excel.XlPictureAppearance.xlScreen, > Excel.XlCopyPictureFormat.xlPicture) > > to paste the chart into a picturebox I first tried > Me.PictureBox1.Image = Clipboard.GetImage > > That did not work and then I tried > Me.PictureBox1.Image = > DirectCast(Clipboard.GetDataObject().GetData(DataFormats.Bitmap, False), > Bitmap) > > that did not work either. > > I can paste the bitmap into any other application like word, excel or > outlook. When I query clipboard.containsimage I get false. > > Please help !!!!! >
Translate C# to VB.net?
Splash window XmlTextReader not getting all Elements "Add Reference" hosed--doesn't display the dialog in VS.NET Combobox and DataSource PDF to Picturebox Newbie: substrings VB.net Datagrid Parent Row Open a form and select the tab page Changing text boxes contents interactively |
|||||||||||||||||||||||