Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Centering an icon in a BITMAPBUTTON

    Cinema 4D SDK
    python
    2
    3
    622
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ?
      A Former User
      last edited by A Former User

      Hello,
      I'm creating bitmap buttons with the following code. To control the size of the icon, I'm using BITMAPBUTTON_FORCE_SIZE. If the Bitmap Button and the icon are different sizes, this puts the icon at the top left of the button. Is it possible to center the icon in the button? I didn't see any properties in the BITMAPBUTTON documentation that indicates that this is possible. If it is not, how could I go about getting the desired result (screenshot below) with a resized icon in GeDialog?

      bc = c4d.BaseContainer()
      bc.SetBool(c4d.BITMAPBUTTON_BUTTON, True)
      bc.SetInt32(c4d.BITMAPBUTTON_FORCE_SIZE, 12)
      bc.SetInt32(c4d.BITMAPBUTTON_ICONID1, 1026694)
      bc.SetString(c4d.BITMAPBUTTON_TOOLTIP, "<b>Title</b><br>Tooltip")
      bmpBtn = self.AddCustomGui(BUTTON_ID, c4d.CUSTOMGUI_BITMAPBUTTON, "Bitmap Button", c4d.BFH_LEFT | c4d.BFV_CENTER | c4d.BFV_SCALE, c4d.gui.SizePix(30), c4d.gui.SizePix(30), bc)
      

      Current:
      0000_BitmapButton-One.png

      Desired:
      0001_BitmapButton-Two.png

      Thanks!

      1 Reply Last reply Reply Quote 0
      • ManuelM
        Manuel
        last edited by Manuel

        hi,
        Here's the code for the bitmap button. As you can see, either -1 or >0 will make the bitmap to be drawn from 0,0. (top corner of the UserArea)

        		if (special_size == -1)
        		{
        			DrawBitmap(img, 0, 0, GetWidth(), GetHeight(), 0, 0, w, h, drawflags);
        		}
        		else if (special_size)
        		{
        			DrawBitmap(img, 0, 0, special_size, special_size_y, 0, 0, w, h, drawflags);
        		}
        		else
        		{
        

        The final else is for when you don't specify any size.

        So it's not possible in a BITMAPBUTTON.

        But maybe you can retrieve the icon you want, resize it, and register it as a new icon.

        Cheers,
        Manuel

        MAXON SDK Specialist

        MAXON Registered Developer

        ? 1 Reply Last reply Reply Quote 0
        • ?
          A Former User @Manuel
          last edited by

          @m_magalhaes Thank you for clarifying the Bitmap Button, Manuel.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post