Skip to content

Commit 5f145c7

Browse files
committed
949272 - Added core and framework sample for hiding toolbar button in Winforms PdfViewer
1 parent 7109c44 commit 5f145c7

16 files changed

+520
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35707.178 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HideToolbarButton", "HideToolbarButton\HideToolbarButton.csproj", "{9B6257CA-7B0F-47CD-9A5B-67A0D637A20E}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{9B6257CA-7B0F-47CD-9A5B-67A0D637A20E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{9B6257CA-7B0F-47CD-9A5B-67A0D637A20E}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{9B6257CA-7B0F-47CD-9A5B-67A0D637A20E}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{9B6257CA-7B0F-47CD-9A5B-67A0D637A20E}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
5+
</startup>
6+
</configuration>

How-to/Hide-Toolbar-Button/HideToolbarButton/HideToolbarButton/Form1.Designer.cs

+40
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Data;
5+
using System.Drawing;
6+
using System.Linq;
7+
using System.Text;
8+
using System.Threading.Tasks;
9+
using System.Windows.Forms;
10+
using Syncfusion.Windows.Forms.PdfViewer;
11+
12+
namespace HideToolbarButton
13+
{
14+
public partial class Form1 : Form
15+
{
16+
PdfViewerControl pdfViewerControl;
17+
string file;
18+
public Form1()
19+
{
20+
InitializeComponent();
21+
this.WindowState = FormWindowState.Maximized;
22+
23+
//Creating PdfViewer control obkect and add it to the forms
24+
pdfViewerControl = new PdfViewerControl();
25+
pdfViewerControl.Dock = DockStyle.Fill;
26+
this.Controls.Add(pdfViewerControl);
27+
#if NETCOREAPP
28+
file = "../../../Data/PDF_Succinctly.pdf";
29+
#else
30+
file = "../../Data/PDF_Succinctly.pdf";
31+
#endif
32+
//Load the PDF
33+
pdfViewerControl.Load(file);
34+
35+
//Hide the open and save toolbar button
36+
pdfViewerControl.ToolbarSettings.OpenButton.IsVisible = false;
37+
pdfViewerControl.ToolbarSettings.SaveButton.IsVisible = false;
38+
39+
}
40+
}
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{9B6257CA-7B0F-47CD-9A5B-67A0D637A20E}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<RootNamespace>HideToolbarButton</RootNamespace>
10+
<AssemblyName>HideToolbarButton</AssemblyName>
11+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<Deterministic>true</Deterministic>
15+
<TargetFrameworkProfile />
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<PlatformTarget>AnyCPU</PlatformTarget>
19+
<DebugSymbols>true</DebugSymbols>
20+
<DebugType>full</DebugType>
21+
<Optimize>false</Optimize>
22+
<OutputPath>bin\Debug\</OutputPath>
23+
<DefineConstants>DEBUG;TRACE</DefineConstants>
24+
<ErrorReport>prompt</ErrorReport>
25+
<WarningLevel>4</WarningLevel>
26+
</PropertyGroup>
27+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
28+
<PlatformTarget>AnyCPU</PlatformTarget>
29+
<DebugType>pdbonly</DebugType>
30+
<Optimize>true</Optimize>
31+
<OutputPath>bin\Release\</OutputPath>
32+
<DefineConstants>TRACE</DefineConstants>
33+
<ErrorReport>prompt</ErrorReport>
34+
<WarningLevel>4</WarningLevel>
35+
</PropertyGroup>
36+
<ItemGroup>
37+
<packageReference Include="Syncfusion.PdfViewer.Windows" version="*" />
38+
<Reference Include="System" />
39+
<Reference Include="System.Core" />
40+
<Reference Include="System.Xml.Linq" />
41+
<Reference Include="System.Data.DataSetExtensions" />
42+
<Reference Include="Microsoft.CSharp" />
43+
<Reference Include="System.Data" />
44+
<Reference Include="System.Deployment" />
45+
<Reference Include="System.Drawing" />
46+
<Reference Include="System.Net.Http" />
47+
<Reference Include="System.Windows.Forms" />
48+
<Reference Include="System.Xml" />
49+
</ItemGroup>
50+
<ItemGroup>
51+
<Compile Include="Form1.cs">
52+
<SubType>Form</SubType>
53+
</Compile>
54+
<Compile Include="Form1.Designer.cs">
55+
<DependentUpon>Form1.cs</DependentUpon>
56+
</Compile>
57+
<Compile Include="Program.cs" />
58+
<Compile Include="Properties\AssemblyInfo.cs" />
59+
<EmbeddedResource Include="Properties\Resources.resx">
60+
<Generator>ResXFileCodeGenerator</Generator>
61+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
62+
<SubType>Designer</SubType>
63+
</EmbeddedResource>
64+
<Compile Include="Properties\Resources.Designer.cs">
65+
<AutoGen>True</AutoGen>
66+
<DependentUpon>Resources.resx</DependentUpon>
67+
</Compile>
68+
<None Include="packages.config" />
69+
<None Include="Properties\Settings.settings">
70+
<Generator>SettingsSingleFileGenerator</Generator>
71+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
72+
</None>
73+
<Compile Include="Properties\Settings.Designer.cs">
74+
<AutoGen>True</AutoGen>
75+
<DependentUpon>Settings.settings</DependentUpon>
76+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
77+
</Compile>
78+
</ItemGroup>
79+
<ItemGroup>
80+
<None Include="App.config" />
81+
</ItemGroup>
82+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
83+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFramework>net8.0-windows</TargetFramework>
6+
<Nullable>enable</Nullable>
7+
<UseWindowsForms>true</UseWindowsForms>
8+
<ImplicitUsings>enable</ImplicitUsings>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.PdfViewer.Windows" Version="*" />
13+
</ItemGroup>
14+
15+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
<ItemGroup>
5+
<Compile Update="Form1.cs">
6+
<SubType>Form</SubType>
7+
</Compile>
8+
</ItemGroup>
9+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35707.178 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HideToolbarButton_NET", "HideToolbarButton_NET.csproj", "{2EA46C42-3889-4E1C-ADA3-0CE924105123}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{2EA46C42-3889-4E1C-ADA3-0CE924105123}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{2EA46C42-3889-4E1C-ADA3-0CE924105123}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{2EA46C42-3889-4E1C-ADA3-0CE924105123}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{2EA46C42-3889-4E1C-ADA3-0CE924105123}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using System.Windows.Forms;
6+
7+
namespace HideToolbarButton
8+
{
9+
internal static class Program
10+
{
11+
/// <summary>
12+
/// The main entry point for the application.
13+
/// </summary>
14+
[STAThread]
15+
static void Main()
16+
{
17+
Application.EnableVisualStyles();
18+
Application.SetCompatibleTextRenderingDefault(false);
19+
Application.Run(new Form1());
20+
}
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyDescription("")]
9+
[assembly: AssemblyCopyright("Copyright © 2025")]
10+
[assembly: AssemblyTrademark("")]
11+
12+
// Setting ComVisible to false makes the types in this assembly not visible
13+
// to COM components. If you need to access a type in this assembly from
14+
// COM, set the ComVisible attribute to true on that type.
15+
[assembly: ComVisible(false)]
16+
17+
// The following GUID is for the ID of the typelib if this project is exposed to COM
18+
[assembly: Guid("9b6257ca-7b0f-47cd-9a5b-67a0d637a20e")]
19+
20+
// Version information for an assembly consists of the following four values:
21+
//
22+
// Major Version
23+
// Minor Version
24+
// Build Number
25+
// Revision
26+
//

How-to/Hide-Toolbar-Button/HideToolbarButton/HideToolbarButton/Properties/Resources.Designer.cs

+71
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)