Create custom ribbon tab and buttons for Autocad mechanical 2011?

Create custom ribbon tab and buttons for Autocad mechanical 2011?

Anonymous
Not applicable
32,710 Views
26 Replies
Message 1 of 27

Create custom ribbon tab and buttons for Autocad mechanical 2011?

Anonymous
Not applicable

Hi everyone!

 

How do i create a ribbon tab and button for my application, can anyone give a sample code?

 

How do i interact the button click with my application?

 

Thanks.

0 Likes
32,711 Views
26 Replies
Replies (26)
Message 21 of 27

Anonymous
Not applicable

raghulan:  I have not experimented with button colors myself but my guess there should be some posibility to do it.  Just not sure to what extent is possible with it.  As a fall back you could just make images of different colors and drop them in instead.

 

Are you trying to create a drop down window for a color selection?

0 Likes
Message 22 of 27

fenton_webb
Autodesk
Autodesk

just in case you haven't seen this post http://adndevblog.typepad.com/autocad/2012/06/autocad-performance-gauges-app.html




Fenton Webb
AutoCAD Engineering
Autodesk

0 Likes
Message 23 of 27

Anonymous
Not applicable

Thanks guys, I would play around and update back when I find a good solution.

0 Likes
Message 24 of 27

Mikko
Advocate
Advocate

you could just add some colorful bitmaps into your application resources and then just covert them something like this:

 

Shared Function AddOnePanel() As RibbonPanel

Dim rb As RibbonButton

Dim rps As New RibbonPanelSource()

rps.Title = "ToDazeReality"

Dim rp As New RibbonPanel()

rp.Source = rps

Dim rci As New RibbonButton()

rci.Name = "cmdDoSomething"

rps.DialogLauncher = rci

rb = New RibbonButton()

rb.CommandParameter = "doSomething "

rb.Name = "btnDoSomething"

rb.CommandHandler = New tdrCommandHandler()

rb.Image = thumbConvert(BlaBlaBla.My.Resources.Resources.SomeBitMapImage)

rps.Items.Add(rb)

Return rp

End Function

 

Public Function thumbConvert(value As System.Drawing.Bitmap) As Object

If value Is Nothing Then

Return Nothing

End If

Dim myImageCodecInfo As Drawing.Imaging.ImageCodecInfo

myImageCodecInfo = GetEncoderInfo(Drawing.Imaging.ImageFormat.Png)

Dim myEncoder As Drawing.Imaging.Encoder

myEncoder = Drawing.Imaging.Encoder.Quality

Dim myEncoderParameter As Drawing.Imaging.EncoderParameter

Dim myEncoderParameters As Drawing.Imaging.EncoderParameters

myEncoderParameters = New Drawing.Imaging.EncoderParameters(1)

myEncoderParameter = New Drawing.Imaging.EncoderParameter(myEncoder, CType(75L, Int32))

myEncoderParameters.Param(0) = myEncoderParameter

Dim image = CType(value, System.Drawing.Image)

Dim bitmap = New System.Windows.Media.Imaging.BitmapImage()

bitmap.BeginInit()

Dim memoryStream As New IO.MemoryStream()

image.Save(memoryStream, myImageCodecInfo, myEncoderParameters)

memoryStream.Seek(0, System.IO.SeekOrigin.Begin)

bitmap.StreamSource = memoryStream

bitmap.EndInit()

Return bitmap

End Function

 

Private Function GetEncoderInfo(ByVal format As Drawing.Imaging.ImageFormat) As Drawing.Imaging.ImageCodecInfo

Dim j As Integer

Dim encoders() As Drawing.Imaging.ImageCodecInfo

encoders = Drawing.Imaging.ImageCodecInfo.GetImageEncoders()

j = 0

While j < encoders.Length

If encoders(j).FormatID = format.Guid Then

Return encoders(j)

End If

j += 1

End While

Return Nothing

End Function

 

Your mileage my vary doing it this way...

0 Likes
Message 25 of 27

Anonymous
Not applicable

Thanks Mate, for the information.

0 Likes
Message 26 of 27

Alexander.Rivilis
Mentor
Mentor

This is a very old topic, but I did not see in it the full solution for VB.NET

So I add full sample project used @Anonymous code. Rename VBRibbonSample.gzip to VBRibbonSample.zip

 

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 27 of 27

WryaG
Explorer
Explorer

hellow

iam new in vb.net. i am want course training for autocad vb.net 

same one please advices me.

thanks

0 Likes