Message 1 of 1
VB | Bigger button image
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I created a print tab on the ribbon in Inventor (See top screenshot). I am try to create the same thing in AutoCAD (See second screenshot). Notice how the image is smaller in the autocad button than the inventor button. Is there a way to make autocad's image bigger?
RibbonButton.Size is for large or collapsed buttons
RibbonButton.Width doesn't seem to make the button wider
If I set the image size to 64,64 the image stays the same size but the graphic gets bigger (See bottom screenshot).
I know it looks bigger, but I zoomed in to show the graphic better.\/
Public Class EzPrintApp
Implements CadRun.IExtensionApplication
Public Sub Initialize() Implements CadRun.IExtensionApplication.Initialize
Dim StartEzPrintCommands = New EzPrintCommands
StartEzPrint.EzPrintSetup
End Sub
Public Sub Terminate() Implements CadRun.IExtensionApplication.Terminate
DB.Writeline("Cleaning up...")
End Sub
End Class
Public Class EzPrintCommands
<CadRun.CommandMethod("EzPrintSetup")>
Public Sub EzPrintSetup()
Dim MainCui as CadCui.CustomizationSection
' Set Main Cui String
Dim CuiStr as String = CadApp.Application.GetSystemVariable("MENUNAME") & ".cuix"
' Get Main cui
MainCui = New CadCui.CustomizationSection(CuiStr)
' Establish a ribbon control
Dim RibCon As CadWin.RibbonControl = CadWin.ComponentManager.Ribbon
If RibCon isnot nothing then
' Get the Print Tab
Dim RibTab as CadWin.RibbonTab = RibCon.FindTab("EzPrint")
' If its already present then remove it
If RibTab isnot nothing Then : RibCon.Tabs.Remove(RibTab) : End If
' Setup Print ribbon tab
RibTab = New CadWin.RibbonTab()
RibTab.Title = "EZ-Print"
RibTab.Id = "EzPrint"
RibCon.Tabs.Add(RibTab)
RibTab.Panels.Add(AddDdPrintPanel())
End If
End Sub
Private Shared Function AddDdPrintPanel() As CadWin.RibbonPanel
' Establish a button and row break
Dim RibBtm As CadWin.RibbonButton
Dim RibBrk as CadWin.RibbonRowBreak
' Create the DD Admin Printer Panel
Dim DdPrinterPanelSc as CadWin.RibbonPanelSource = New CadWin.RibbonPanelSource()
DdPrinterPanelSc.Title = "DD Admin Printer"
Dim RibPnl As CadWin.RibbonPanel = New CadWin.RibbonPanel()
RibPnl.Source = DdPrinterPanelSc
' Fit to A button
RibBtn = New CadWin.RibbonButton()
RibBtn.Name = "FitA"
RibBtn.ShowText = True
RibBtn.Text = "Fit A"
RibBtn.ShowImage = True
RibBtn.Orientation = Windows.Controls.Orientation.Vertical
RibBtn.Width = 150 <-- Testing if this works. it doesn't
RibBtn.id = "FitA"
RibBtn.Size = Autodesk.Windows.RibbonItemSize.Large
RibBtn.LargeImage = IconToBitMap("PrintFitToA", 32, 32) ' My.Resources.PrintFitToA
RibBtn.Image = IconToBitMap("PrintFitToA", 16, 16)
DdPrinterPanelSc.Items.Add(RibBtn)
' Fit to B button
RibBtn = New CadWin.RibbonButton()
RibBtn.Name = "FitB"
RibBtn.ShowText = True
RibBtn.Text = "Fit B"
RibBtn.ShowImage = True
RibBtn.Orientation = Windows.Controls.Orientation.Vertical
RibBtn.Width = 150 <-- Testing if this works. it doesn't
RibBtn.id = "FitB"
RibBtn.Size = Autodesk.Windows.RibbonItemSize.Large
RibBtn.LargeImage = IconToBitmap("PrintFitToB", 32, 32) ' My.Resources.PrintFitToA
RibBtn.Image = IconToBitmap("PrintFitToB", 16, 16)
DdPrinterPanelSc.Items.Add(RibBtn)
Return RibPnl
End Function
Module Globals
Public Function IconToBitmap(ByVal IconName As String, ByVal Width As Integer, ByVal Height As Integer) As System.Windows.Media.Imaging.BitmapImage
Dim BitImg as System.Windows.Media.Imaging.BitmapImage
Dim BitImg2 as new System.Windows.Media.Imaging.BitmapImage
Dim Icn as System.Drawing.Icon = My.Resources.ResourceManager.GetObject(IconName)
Try
Dim BitMp as System.Drawing.Bitmap = Icn.ToBitmap
Dim Stream as New System.IO.MemoryStream
BitMp.Save(Stream, System.Drawing.Imaging.ImageFormat.Png) <-- For some reason use pgn not icon
BitImg2.BeginInit()
BitImg2.StreamSource = Stream
BitImg2.DecodePixelWidth = Width
BitImg2.DecodePixelHeight = Height
BitImg2.EndInit()
BitImg = BitImg2
Return BitImg
Catch ex As Exception
BitImg = Nothing
End Try
End Function
End Module