.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create custom ribbon tab and buttons for Autocad mechanical 2011?

26 REPLIES 26
Reply
Message 1 of 27
SMachado
30630 Views, 26 Replies

Create custom ribbon tab and buttons for Autocad mechanical 2011?

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.

26 REPLIES 26
Message 21 of 27
deathman20
in reply to: raghulan

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?

Message 22 of 27
fenton.webb
in reply to: deathman20

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

Message 23 of 27
raghulan
in reply to: deathman20

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

Regards,

Raghulan Gowthaman Cert IV TAA, B.E,.
Senior Technical Consultant | Developer - R&D
A2K Technologies Sydney
Web : www.a2ktechnologies.com.au
www.civil3dforum.com | www.e4forums.com
www.zcodia.com.au
www.raghulangowthaman.com
Message 24 of 27
Mikko
in reply to: deathman20

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...

Message 25 of 27
raghulan
in reply to: Mikko

Thanks Mate, for the information.

Regards,

Raghulan Gowthaman Cert IV TAA, B.E,.
Senior Technical Consultant | Developer - R&D
A2K Technologies Sydney
Web : www.a2ktechnologies.com.au
www.civil3dforum.com | www.e4forums.com
www.zcodia.com.au
www.raghulangowthaman.com
Message 26 of 27

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 @Irvin 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
in reply to: SMachado

hellow

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

same one please advices me.

thanks

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost