I have been working on a .net application that utilizes a Custom Palette. AutoCAD Mechanical 2016.
It was showing up in a nice window, like a properties window when you loaded it...but now all of sudden it is showing up in a corrupted way covering up my ribbon menu, and you can't even see all of it.
I did add a bunch of buttons/text boxes but I don't believe I resized the palette window to cause this corruption to happen. I don't even understand why it is happening.
static CustomPalette palette;
[CommandMethod("BORDER")]
public static void ShowPalette()
{
if (palette == null)
palette = new CustomPalette();
palette.Visible = true;
}
<UserControl x:Class="SimpleWpfPalette.PaletteUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SimpleWpfPalette"
mc:Ignorable="d" Height="406.466" Width="778.233">
<Grid Background="WhiteSmoke">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Grid.Row="2" Margin="65,294,623,-128" Content="Total Sheets:"/>
<TextBox x:Name="totalSheetsBox" Margin="145,295,534,-125" Grid.Row="2" TextChanged="nameBox_TextChanged"/>
<Button x:Name="okButton" Grid.Row="2" Margin="152,334,533,-163" HorizontalAlignment="Center" Content="Process" Height="24" Width="83" Click="okButton_Click"/>
<Label Grid.Row="2" Margin="74,15,623,151" Content="Originator:"/>
<TextBox x:Name="originatorBox" Margin="145,19,534,151" Grid.Row="2" TextChanged="nameBox_TextChanged"/>
<TextBox x:Name="dateBox" Margin="145,47,534,123" Grid.Row="2" TextChanged="nameBox_TextChanged"/>
<Label Grid.Row="2" Margin="0,47,628,119" Content="Date:" HorizontalAlignment="Right" Width="43"/>
<TextBox x:Name="identBox" Margin="145,79,534,91" Grid.Row="2" TextChanged="nameBox_TextChanged"/>
<Label Grid.Row="2" Margin="0,79,628,87" Content="Ident #:" HorizontalAlignment="Right"/>
<TextBox x:Name="weightBox" Margin="145,111,534,59" Grid.Row="2" TextChanged="nameBox_TextChanged"/>
<Label Grid.Row="2" Margin="0,113,628,53" Content="Weight:" HorizontalAlignment="Right"/>
<TextBox x:Name="englishBox" Margin="146,143,533,27" Grid.Row="2" TextChanged="nameBox_TextChanged"/>
<Label Grid.Row="2" Margin="0,143,627,23" Content="English Description:" HorizontalAlignment="Right" Width="120"/>
<TextBox x:Name="frenchBox" Margin="146,175,533,-5" Grid.Row="2" TextChanged="nameBox_TextChanged"/>
<Label Grid.Row="2" Margin="0,175,627,-9" Content="French Description:" HorizontalAlignment="Right" Width="118"/>
<TextBox x:Name="germanBox" Margin="146,207,533,-37" Grid.Row="2" TextChanged="nameBox_TextChanged"/>
<Label Grid.Row="2" Margin="0,207,628,-41" Content="German Description:" HorizontalAlignment="Right" Width="122"/>
<TextBox x:Name="indexBox" Margin="146,235,533,-65" Grid.Row="2" TextChanged="nameBox_TextChanged"/>
<Label Grid.Row="2" Margin="0,237,628,-71" Content="Index:" HorizontalAlignment="Right"/>
<TextBox x:Name="approverBox" Margin="145,267,534,-97" Grid.Row="2" TextChanged="nameBox_TextChanged"/>
<Label Grid.Row="2" Margin="0,267,628,-101" Content="Approver:" HorizontalAlignment="Right"/>
</Grid>
</UserControl>
namespace SimpleWpfPalette
{
public partial class PaletteUserControl : UserControl
{
public PaletteUserControl()
{
InitializeComponent();
}
private void okButton_Click(object sender, RoutedEventArgs e)
{
var doc = AcAp.DocumentManager.MdiActiveDocument;
if (doc != null)
doc.SendStringToExecute("UAIF " + totalSheetsBox.Text + "\n", false, false, false);
// doc.SendStringToExecute("UAIF " + totalSheetsBox.Text + originatorBox.Text + "\n", false, false, false);
}
private void nameBox_TextChanged(object sender, TextChangedEventArgs e)
{
}
}
}
So apparently the userform in Visual Studio does not directly match the Palette window 1:1, so I am playing around with the positioning to get it acceptable...but there is differences between the two.
Can't find what you're looking for? Ask the community or share your knowledge.