Page 1 of 1

Stamps palette questions...

Posted: Fri Sep 08, 2017 2:34 pm
by lidds
I am using the following command to open the Stamp Palette and I was wondering if there is a way to do the following:

Code: Select all

Me.docPreview.ShowPane("stampsView", Mode)
1. Bring the Stamp Palette form to the front or top most?
2. Also hide the close button (cross button on top right of the pane)?

Thanks

Simon

Re: Stamps palette questions...

Posted: Sat Sep 09, 2017 5:59 am
by Sasha - Tracker Dev Team
Hello Simon,

To hide the close button, try this:
https://www.pdf-xchange.com/forum3 ... 66&t=29528
As for the pane positioning try playing with this:
https://www.pdf-xchange.com/forum3 ... 29#p115881

Cheers,
Alex

Re: Stamps palette questions...

Posted: Mon Sep 11, 2017 12:07 am
by lidds
Alex,

I am using the following code to hide the close buttons on panes, however I cannot seem to find any Stamp Pane?

Code: Select all

            Dim layout As PDFXEdit.IUIX_Layout = Me.docPreview.Inst.MainFrm(2).View.DocViewsArea.Panes.Layout
            Dim pane As PDFXEdit.IUIX_Obj = Me.docPreview.Doc.ActiveView.CommentsView.Obj
            Dim paneLI As PDFXEdit.IUIX_LayoutItem = layout.GetItem(pane)
            paneLI.SetStyle(CInt(PDFXEdit.UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_NoClose), CInt(PDFXEdit.UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_NoClose))
Thanks

Simon

Re: Stamps palette questions...

Posted: Mon Sep 11, 2017 8:02 am
by Sasha - Tracker Dev Team
Hello Simon,

You will have to distinguish between the panes that belong to the Documents View and to the Main View. Basically this code should have worked, though it does not:

Code: Select all

int nID = pdfCtl.Inst.Str2ID("stampsView");
IUIX_Obj pane = pdfCtl.Inst.MainFrm[0].View.Panes.Active[nID].Obj;
IUIX_Layout layout = pdfCtl.Inst.MainFrm[0].View.Panes.Layout;
IUIX_LayoutItem li = layout.GetItem(pane);
li.SetStyle((int)UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_NoClose, (int)UIX_LayoutItemStyleFlags.UIX_LayoutItemStyle_NoClose);
I will ask a developer who made it to clear things out.

Cheers,
Alex

Re: Stamps palette questions...

Posted: Mon Sep 11, 2017 8:16 am
by lidds
OK Alex, thanks

Re: Stamps palette questions...

Posted: Mon Sep 11, 2017 8:34 am
by lidds
Also,

With your code specified, I cannot seem to make the pane topmost, if this is not possible then even to make the pane show an icon in Taskbar would be another solution.

Thanks

Simon

Re: Stamps palette questions...

Posted: Mon Sep 11, 2017 9:15 am
by lidds
Alex,

Your code does work, but only if the Stamp Palette is docked. If you make it a floating dock pane then the code does not work. Just thought I'd mention it so you can relay this to your developer.

Thanks

Simon

Re: Stamps palette questions...

Posted: Tue Sep 12, 2017 2:45 pm
by Sasha - Tracker Dev Team
Hello Simon,

You will have to work through the window's handles - this is how you remove a close button:

Code: Select all

[DllImport("user32.dll", EntryPoint = "GetWindowLong")]
static extern IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex);
public enum GWL
{
	GWL_WNDPROC = (-4),
	GWL_HINSTANCE = (-6),
	GWL_HWNDPARENT = (-8),
	GWL_STYLE = (-16),
	GWL_EXSTYLE = (-20),
	GWL_USERDATA = (-21),
	GWL_ID = (-12)
}
[DllImport("user32.dll")]
static extern int SetWindowLong(IntPtr hWnd, int nIndex, uint dwNewLong);
private void setNoCloseStyleViaHWNDToolStripMenuItem_Click(object sender, EventArgs e)
{
	int nID = pdfCtl.Inst.Str2ID("stampsView");
	IUIX_Obj pane = pdfCtl.Inst.MainFrm[0].View.Panes.Active[nID].Obj;
	while (pane != null)
	{
		uint hnd = pane.GetFirstWndHandle();
		IntPtr p = new IntPtr(hnd);
		IntPtr hStyle = GetWindowLongPtr(p, (int)GWL.GWL_STYLE);
		int dwStyle = hStyle.ToInt32();
		if ((dwStyle & 0x80000000) != 0) //WS_POPUP
		{
			dwStyle = dwStyle & ~0x00080000; //WS_SYSMENU
			SetWindowLong(p, (int)GWL.GWL_STYLE, (uint)dwStyle);
			break;
		}
		pane = pane.Parent;
	}
}
As for the topmost - this sample gives you the needed window handle - you will have to use it to achieve the needed window style.

Cheers,
Alex