Bitmap in a dialog... without surrounding space



  • Hi,

    I have a dialog that displays a bitmap. For that, I use a simple BitmapButton customgui. However, I want the bitmap to fill the whole width of the dialog, but that doesn't seem to be possible. There is always a small margin between bitmap and window borders.

    Here's some code:

    class AboutDialog : public GeDialog
    {
    	INSTANCEOF(AboutDialog, GeDialog);
    	
    	static const Int32 IDC_LOGOAREA = 10000;
    
    public:
    	virtual Bool CreateLayout() override
    	{
    		SUPER::CreateLayout();
    		
    		SetTitle(GeLoadString(IDS_ABOUTCOMMAND));
    		
    		GroupBorderSpace(0, 0, 0, 0);
    		GroupSpace(0, 0);
    		GroupBorderNoTitle(BORDER_NONE);
    
    		// Add logo to dialog title
    		BaseContainer logoBc;
    		logoBc.SetInt32(DESC_CUSTOMGUI, CUSTOMGUI_BITMAPBUTTON);
    		logoBc.SetInt32(BITMAPBUTTON_BORDER, BORDER_NONE);
    		logoBc.SetBool(BITMAPBUTTON_NOBORDERDRAW, true);
    		logoBc.SetBool(BITMAPBUTTON_BUTTON, false);
    		logoBc.SetBool(BITMAPBUTTON_TOGGLE, false);
    		logoBc.SetBool(BITMAPBUTTON_DRAWPOPUPBUTTON, false);
    		BitmapButtonCustomGui* logoButton = (BitmapButtonCustomGui*)AddCustomGui(IDC_LOGOAREA, CUSTOMGUI_BITMAPBUTTON, String(), BFH_CENTER|BFV_CENTER, SizePix(256L), SizePix(40L), logoBc);
    		if (logoButton)
    		{
    			const Filename logoFilename = GeGetPluginPath() + Filename("res") + Filename("logo.tif");
    			if (GeFExist(logoFilename))
    				logoButton->SetImage(logoFilename, false);
    		}
    
    		return true;
    	}
    
    

    I was hoping that GroupBorderSpace(0, 0, 0, 0);, GroupSpace(0, 0);, or GroupBorderNoTitle(BORDER_NONE); would do the trick. Or maybe setting BITMAPBUTTON_NOBORDERDRAW in the BitmapButton's container. But none of these changes anything. I also tried putting the BitmapButton into a group, and then again throwing all those above mentioned things into the group. No change at all.

    I noticed it works if I open the dialog with DLG_TYPE::ASYNC_POPUPEDIT, but I would prefer a dialog with a title bar and the standard window gadgets.

    Any tips?

    Thanks in advance & greetings,
    Frank



  • hello,

    just to be sure, could you post a screenshot of the part you want to avoid ? (just to avoid guessing)
    Is it a gap between the bitmap and the border or you want to avoid border itself ?

    Cheers,
    Manuel



  • Hi Manuel,

    not at home at the moment, so I can't make a screenshot right now.

    I want to avoid the gap between the bitmap and the edge of the dialog.

    Cheers,
    Frank



  • hi,
    Sorry but there's still area i don't understand.

    using you code i got this result:
    7c5d809a-15fb-45cf-b197-c1c2f861b700-image.png
    But my bitmap is larger than the size you provided.

    I'm missing something.
    The size of the bitmap you want to display ?
    Do you want to bitmap to scale when you scale the GeDialog ?

    Do you really want to use a BitmapButton or could you use a UserArea ?

    Cheers,
    Manuel



  • Hi Manuel,

    thanks for getting back to me!

    The size of the bitmap you want to display ?

    It's 320x116 pixels.

    Do you want to bitmap to scale when you scale the GeDialog ?

    No. I rather want the dialog to be just wide enough to fit the bitmap in it.
    And that seems to happen automatically. Even if I open the dialog with a width of e.g. 100 px, it doesn't get any smaller than (width_of_bitmap + strange_gap * 2).

    Is it possible that it's a macOS-only issue? Maybe it's the radius of the windows' round corners that gets added to the size.

    Anyway, maybe this issue isn't worth spending more of your time on. Since it works with a ASYNC_POPUPEDIT style dialog, I think I can live with what I got.