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

Scrollbars in custom toolpalette

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
RPeter
923 Views, 8 Replies

Scrollbars in custom toolpalette

I've created a custom toolpaletteset based on a user control named uc_Gewicht, however I don't know/can't access the scrollbars?

 

Imports System.Runtime
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.Internal

Public Class cls_Commando
    Friend Shared m_ps As Autodesk.AutoCAD.Windows.PaletteSet = Nothing
    <CommandMethod("MASSABEPALING")> Public Sub MassaBepaling()
        If m_ps = Nothing Then
            m_ps = New Autodesk.AutoCAD.Windows.PaletteSet("Massabepaling MM")
            m_ps.Add("Massabepaling MM", New uc_Gewicht)
        End If
        m_ps.Visible = True
    End Sub
End Class

 Regards

 

Peter

8 REPLIES 8
Message 2 of 9
arcticad
in reply to: RPeter

I don't think there are scroll bars in a palette.

Add your controls into a panel and then add the panel to palette.

Set your anchor points

Then set Panel's AutoScroll to true.

---------------------------



(defun botsbuildbots() (botsbuildbots))
Message 3 of 9
RPeter
in reply to: arcticad

Thanks for your reply, now I get the vertical scrollbars. At the moment I haven't got the horizontal scrollbars. But I think I can manage to get them now.

 

Thanks!

Message 4 of 9
andred
in reply to: arcticad

Hello,

 

I think I don't understand how to do that. I add a panel in my user control and put all my controls in that panel. I adjust the Autoscroll property to True on my panel but I don't see any difference.

 

I know you write "Add you controls into a panel and add the panel to palette" but I don't know how to create a panel and attach a user control by code  (maybe I have to create a user form???) and add it to the palette???? actually I add my userControl.

 

And what are the anchor points???

 

Do you have code sample?

 

Regards,

 

André

 

Message 5 of 9
RPeter
in reply to: RPeter

Step 1.

Create a User Control that you want.

 

Step 2.

Create a User Control that wraps the Control made in step 1.

You kan add it with the handler mybase.load

Private Sub uc_Step_2_load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
	Me.Controls.Add(New uc_Step_1)
End Sub

 

 In command you will create a palleteset to uc_Step_2 (the wrapper), make sure you've set the AutoScroll to True.

Public Class cls_Commando
    Friend Shared m_ps As Autodesk.AutoCAD.Windows.PaletteSet = Nothing

    <CommandMethod("MYPS")> Public Sub MYPS()
        If m_ps = Nothing Then
            m_ps = New Autodesk.AutoCAD.Windows.PaletteSet("My Custom PS")
            m_ps.KeepFocus = True
            m_ps.Add("My Custom PS", New uc_Step_2)
        End If
        m_ps.Visible = True
    End Sub
End Class

 

Regards

 

Peter

 

 

 

 

Message 6 of 9
arcticad
in reply to: RPeter

 myPanel.Anchor = CType(Windows.Forms.AnchorStyles.Bottom + _
                                         Windows.Forms.AnchorStyles.Left + _
                                         Windows.Forms.AnchorStyles.Right + _
                                         Windows.Forms.AnchorStyles.Top, Windows.Forms.AnchorStyles)

 

---------------------------



(defun botsbuildbots() (botsbuildbots))
Message 7 of 9


@arcticad wrote:
 myPanel.Anchor = CType(Windows.Forms.AnchorStyles.Bottom + _
                                         Windows.Forms.AnchorStyles.Left + _
                                         Windows.Forms.AnchorStyles.Right + _
                                         Windows.Forms.AnchorStyles.Top, Windows.Forms.AnchorStyles)

 


Except that you don't use the addition (+) operator, you use the bitwise Or operator.

 

 

 

 

Message 8 of 9
andred
in reply to: RPeter

Sorry guys,

 

I'm not able to figure it. The only way I found to have a scrolling bar is to set the AutoScroll property of the control itself to True. But it doesn't work as AutoCAD native palette, the scrolling bar is at the right and doesn't have the same appearance.

 

I attached a project sample. I add directly the user control to the user control wrapper inside a panel but each time I run the project, I had to change manually the reference to my user control, After loading the project hou have to type ShowTestPalette.

 

If you can help.

 

Regards

 

André

 

Message 9 of 9
arcticad
in reply to: andred

here you go.

 

And strangly + works, but you should use OR.

 

if you dock the panel you don't need to worry about it anyways.

 

---------------------------



(defun botsbuildbots() (botsbuildbots))

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