PrintPreviewDialog控件按钮可以自定义
.net中的打印时有一个自带的PrintPreviewDialog控件。
这个控件上面有几个按钮这几个按钮可以自定义吗,比如去掉一个?
[解决办法]
VB.NET的代码参考:
Private Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim p As New PrintPreviewDialog
If p.Controls.ContainsKey( "toolStrip1 ") Then
Dim ts As ToolStrip = TryCast(p.Controls.Item( "toolStrip1 "),ToolStrip)
Dim item As ToolStripItem
'For Each item In ts.Items
' Console.WriteLine(item.Name)
'Next
If ts.Items.ContainsKey( "printToolStripButton ") Then
ts.Items.Item( "printToolStripButton ").Visible = False
End If
End If
p.ShowDialog(Me)
End Sub