台灣最大程式設計社群網站
∣
免費加入會員
∣登入
∣回首頁∣
您好
線上人數
1822
會員總數:
246276
討論主題:
189810
討論區
程式下載/上傳
科技新聞
專欄文章
會員中心
加值服務
外包接案
求職求才
登入
登出
歡迎您
免費
加入會員
討論區選單
新手必讀
我要提問!!
討論區
個人討論區
我的關注主題
我的黑名單
討論區EP英雄榜
專家等級說明
討論區常見問題
兌換發問點數QP
扣點申請加值服務
申請版主
開發工具
ASP
ASP.NET
C#
VB.NET
VB6
C/C++
PHP
Java
Java Script/ Node.js
AJAX / JSON / jQuery
其他語言
行動裝置開發
Android APP 開發
iOS APP/ swift 開發
Windows Phone APP
資料庫
ACCESS
MS SQL
MySQL
Oracle
其他DB
多媒體 / 網管
CSS/HTML5/Bootstarp
影像處理
office VBA / WinOS
Windows 伺服器
Linux / Unix
網管 / 資安 / VM
硬體 / 週邊 / 其他
綜合
求職求才
外包接案
心情甘苦談
網站經營 / 合夥 / 證照
建言 / 公告
文章區
專欄文章
科技新聞
Blog精華文章
討論區列表
>>
VB6
>> 如何調整VB6 OLE物件EXCEL 圖表的相關設定
[]
[
我要回覆
]
如何調整VB6 OLE物件EXCEL 圖表的相關設定
價值 : 50 QP
點閱數:2608 回應數:0
樓主
青仔
15
21
401
37
發送站內信
請教各位VB6前輩:
以下為我搜尋到的程式碼,請問如何加入調整VB6內OLE物件EXCEL圖表的圖例字體大小及位置 & 座標軸格式的字型大小 & 繪圖區及圖表區的顏色(若能漸層顏色更佳),謝謝!
Const xlArea = 1 Const xlBar = 2 Const xlColumn = 3 Const xlLine = 4 Const xlPie = 5 Const xlRadar = -4151 Const xlXYScatter = -4169 Const xlCombination = -4111 Const xl3DArea = -4098 Const xl3DBar = -4099 Const xl3DColumn = -4100 Const xl3DLine = -4101 Const xl3DPie = -4102 Const xl3DSurface = -4103 Const xlDoughnut = -4120 ' Excel orientation constants: Const xlRows = 1 Const xlColumns = 2 Dim objChart As Object 'Object reference to Excel 'Chart Dim objXL As Object 'Object reference for Excel Dim objSheet As Object 'Object reference to Excel 'Worksheet Dim iRow As Integer 'Index variable for the 'current Row Dim iCol As Integer 'Index variable for the 'current Row Dim cRows As Integer 'Number of rows Dim cCols As Integer 'Number of Columns Dim cwSource As String 'Named Range Static cwGallery(15) As Integer 'Array for Chart types Static iGallery As Integer 'Index for Chart type array Dim cwFormat As Integer 'Format of Chart type Dim cwPlotBy As Integer 'How data is taken from 'Worksheet Dim cwCategoryLabels As Integer 'Rows/Cols with Catagory 'labels Dim cwSeriesLabels As Integer 'Rows/Cols with Catagory 'Labels Dim cwHasLegend As Integer 'Display Legend Dim cwTitle As String 'Chart Title Dim cwCategoryTitle As String 'Category Title Dim cwValueTitle As String 'Value Title Dim cwExtraTitle As String 'Extra Title for some Charts 'disable this button ' Fill in array with possible Chart types: cwGallery(1) = xlArea cwGallery(2) = xlBar cwGallery(3) = xlColumn cwGallery(4) = xlLine cwGallery(5) = xlPie cwGallery(6) = xlRadar cwGallery(7) = xlXYScatter cwGallery(8) = xlCombination cwGallery(9) = xl3DArea cwGallery(10) = xl3DBar cwGallery(11) = xl3DColumn cwGallery(12) = xl3DLine cwGallery(13) = xl3DPie cwGallery(14) = xl3DSurface cwGallery(15) = xlDoughnut ' Embed a new Excel 5.0 Chart into the OLE control: OLE1.CreateEmbed "", "Excel.Chart.5" 'BEGIN FIX FOR DIFFERING OBJECT MODELS BETWEEN VERSIONS 7 & 8 ' Set object references to Chart, Worksheet, and Application 'objects: If Left(OLE1.object.Application.Version, 1) = "7" Then 'Excel 95's object model is different from Excel 97's Set objChart = OLE1.object ' Chart1 default chart Else 'assume all future excel object models are going to be 'the same Set objChart = OLE1.object.ActiveChart 'ole1.object is in 'Excel 97 the workbook End If Set objSheet = objChart.Parent.Worksheets(1) ' Sheet1 default ' data Set objXL = objChart.Application 'END FIX ' Set the number of columns and rows used for data: cCols = 10 cRows = 3 ' Create Series Labels on Worksheet: For iRow = 1 To cRows objSheet.Cells(iRow + 1, 1).Value = "SL" & iRow Next ' Create Category Labels on Worksheet: For iCol = 1 To cCols objSheet.Cells(1, iCol + 1).Value = "CL" & iCol Next 'exiting here leaves the default chart drawn with sample data ' Create random data on Worksheet: Randomize Timer For iRow = 1 To cRows For iCol = 1 To cCols objSheet.Cells(iRow + 1, iCol + 1).Value = _ Int(Rnd * 50) + 1 Next iCol Next iRow ' Name the Range containing the previously added data: objSheet.Range(objSheet.Cells(1, 1), objSheet.Cells(cRows + _ 1, cCols + 1)).Name = "ChartDataRange" 'objSheet.Range(objSheet.Cells(1, 1), objSheet.Cells(cRows + _ 1, cCols + 1)).Clear ' Set the ChartWizard parameters: cwSource = "ChartDataRange" 'Name of Named Range iGallery = iGallery Mod 15 + 1 'Iterate through 15 Chart 'types cwFormat = 1 'Use default format of Chart 'Type cwPlotBy = xlRows 'Rows = Series orientation cwCategoryLabels = 1 '1 Row contains Category 'Labels cwSeriesLabels = 1 '1 Column contains Series 'Labels cwHasLegend = 1 'Display the Legend cwTitle = "Embedded Chart" 'Chart Title cwCategoryTitle = "Categories" 'Category Title cwValueTitle = "Values" 'Value Title cwExtraTitle = "Extras" 'Extra Title ' Use the ChartWizard method to fill in the Chart: objChart.ChartWizard cwSource, cwGallery(iGallery), cwFormat, cwPlotBy, cwCategoryLabels, cwSeriesLabels, cwHasLegend, cwTitle, cwCategoryTitle, cwValueTitle, cwExtraTitle ' Shut Down Excel and erase objects: Set objXL = Nothing Set objChart = Nothing Set objSheet = Nothing
本篇文章發表於2012-08-02 22:07
目前尚無任何回覆
回覆
如要回應,請先
登入
.
|
網站導覽
|
網站介紹
|
4P點數說明
|
電子報
|
小舖活動
|
大事紀
|
廣告刊登
|
常見問題
|
聯絡我們
|
版權所有 ©copyright 2000 All Rights Reserved