ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Image control (https://www.excelbanter.com/excel-programming/313372-image-control.html)

ojv[_2_]

Image control
 
Have code which loads a gif file to an image control. If I have a breakpoint
in the code the gif file loads beatuifully to the image sized as it should
be. If i do not have a breakpoint it appears to size somewhat at its own
will. Any suggestions why this could be? Code below.

n = ActiveSheet.ChartObjects.Count
ActiveSheet.ChartObjects(n).Height = Image1.Height '300
ActiveSheet.ChartObjects(n).Width = Image1.Width '320
.PlotArea.Left = 20
.PlotArea.Top = 15
.PlotArea.Height = Image1.Height - 30 '160
.PlotArea.Width = Image1.Width - 25 '300
If obXY.Value Then .Axes(xlCategory).AxisTitle.Top = Image1.Height
If .Axes(xlValue, xlPrimary).HasTitle = True Then
..Axes(xlValue).AxisTitle.Left = 1
If .HasTitle = True Then .ChartTitle.Top = 3
End With
Set CurrentChart = ActiveSheet.ChartObjects(n).Chart
'''Save chart as GIF
FName = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
CurrentChart.Export FileName:=FName, FilterName:="GIF"
'''Show the chart
Image1.Picture = LoadPicture(FName)

Frank Stone

Image control
 
hi,
check the autosize property of the image control. may sure
it is set to false.

-----Original Message-----
Have code which loads a gif file to an image control. If

I have a breakpoint
in the code the gif file loads beatuifully to the image

sized as it should
be. If i do not have a breakpoint it appears to size

somewhat at its own
will. Any suggestions why this could be? Code below.

n = ActiveSheet.ChartObjects.Count
ActiveSheet.ChartObjects(n).Height = Image1.Height '300
ActiveSheet.ChartObjects(n).Width = Image1.Width '320
.PlotArea.Left = 20
.PlotArea.Top = 15
.PlotArea.Height = Image1.Height - 30 '160
.PlotArea.Width = Image1.Width - 25 '300
If obXY.Value Then .Axes(xlCategory).AxisTitle.Top =

Image1.Height
If .Axes(xlValue, xlPrimary).HasTitle = True Then
..Axes(xlValue).AxisTitle.Left = 1
If .HasTitle = True Then .ChartTitle.Top = 3
End With
Set CurrentChart = ActiveSheet.ChartObjects(n).Chart
'''Save chart as GIF
FName = ThisWorkbook.Path & Application.PathSeparator

& "temp.gif"
CurrentChart.Export FileName:=FName, FilterName:="GIF"
'''Show the chart
Image1.Picture = LoadPicture(FName)
.


ojv[_2_]

Image control
 
It is set to false.

"Frank Stone" wrote:

hi,
check the autosize property of the image control. may sure
it is set to false.

-----Original Message-----
Have code which loads a gif file to an image control. If

I have a breakpoint
in the code the gif file loads beatuifully to the image

sized as it should
be. If i do not have a breakpoint it appears to size

somewhat at its own
will. Any suggestions why this could be? Code below.

n = ActiveSheet.ChartObjects.Count
ActiveSheet.ChartObjects(n).Height = Image1.Height '300
ActiveSheet.ChartObjects(n).Width = Image1.Width '320
.PlotArea.Left = 20
.PlotArea.Top = 15
.PlotArea.Height = Image1.Height - 30 '160
.PlotArea.Width = Image1.Width - 25 '300
If obXY.Value Then .Axes(xlCategory).AxisTitle.Top =

Image1.Height
If .Axes(xlValue, xlPrimary).HasTitle = True Then
..Axes(xlValue).AxisTitle.Left = 1
If .HasTitle = True Then .ChartTitle.Top = 3
End With
Set CurrentChart = ActiveSheet.ChartObjects(n).Chart
'''Save chart as GIF
FName = ThisWorkbook.Path & Application.PathSeparator

& "temp.gif"
CurrentChart.Export FileName:=FName, FilterName:="GIF"
'''Show the chart
Image1.Picture = LoadPicture(FName)
.




All times are GMT +1. The time now is 10:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com