|
|
Try to move it into Form.Shown event handler Code:
private void Form1_Shown(Object sender, EventArgs e)
{
pdfToolStripSearch1.Items["btnSearchBar"] as ToolStripControlHost).Control.Controls[0].Controls[0].Controls[0].Controls[0].Text = "document";
}
|
|
|
I call in the constructor when i get this error. Code: public ToolsFrm(Patagames.Pdf.Net.Controls.WinForms.PdfViewer viewer)
{
Patagames.Pdf.Net.PdfCommon.Initialize();
this.PdfViewer = viewer;
InitializeComponent();
(pdfToolStripSearch1.Items["btnSearchBar"] as ToolStripControlHost).Control.Controls[0].Controls[0].Controls[0].Controls[0].Text = "document";
cpt++;
}
|
|
|
At what point do you call this code? May be at this moment the toolbar does not initialized yet?
|
|
|
thanks for your answer.
When i use your first method i have an error : (System.NullReferenceException)
at Patagames.Pdf.Net.Controls.WinForms.ToolBars.PdfToolStripSearch.StopSearch() at Patagames.Pdf.Net.Controls.WinForms.ToolBars.PdfToolStripSearch.StartSearch(SearchBar sb, String searchText) at Patagames.Pdf.Net.Controls.WinForms.ToolBars.PdfToolStripSearch.OnNeedSearch(ToolStripControlHost item, String searchText) at Patagames.Pdf.Net.Controls.WinForms.ToolBars.PdfToolStripSearch.SearchBar_NeedSearch(Object sender, EventArgs e) at Patagames.Pdf.Net.Controls.WinForms.ToolBars.SearchBar.OnSearch() at Patagames.Pdf.Net.Controls.WinForms.ToolBars.SearchBar._onsearchTimer_Tick(Object sender, EventArgs e) at System.Windows.Forms.Timer.OnTick(EventArgs e) at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at Planche.App.Main() in C:\Users\9305924K\Desktop\Planche main\Master\Planche\Planche\obj\Debug\App.g.cs:line 0 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
|
|
|
Well... I can suggest a ugly hack Code:
(pdfToolStripSearch1.Items["btnSearchBar"] as ToolStripControlHost).Control.Controls[0].Controls[0].Controls[0].Controls[0].Text = "document";
or you can make some changes in source code: change the visibility of the following classes to public instead internal. internal class ToolStripSearchBar internal class SearchBar in ToolStripSearchBar change the internal SearchBar property to public in PdfToolStripSearch write somthing like this: Code:
public SearchBar SearchBar
{
get
{
return (this.Items["btnSearchBar"] as ToolStripSearchBar).Control as SearchBar;
}
}
and now you can use it like this: Code:
pdfToolStripSearch1.SearchBar.SearchText = "document";
|
|
|
Hi,
is it possible to set text in the search bar in toolbox dynamically ?
In Patagames.Pdf.Net.Controls.WinForms.ToolBars.PdfToolStripSearch()
Thanks
|