带有图标和标签的按钮

问题描述 投票:0回答:1

您好,我目前正在寻找一种显示带有图标和标签的按钮的方法。

我希望图标在图标的左侧,标签在图标的右侧左对齐。

我认为这在openge中是不可能的,但也许有人对此有所了解。

progress openedge
1个回答
0
投票

如果您不是使用完全过时的Progress OpenEdge版本,则可以使用.Net控件,Progress Developer Studio for OpenEdge(PDSOE)中的可视设计器将使您一起拖放以下内容:

enter image description here

这将生成以下源代码(您也可以使用它们来生成表单):

USING Progress.Lang.*.
USING Progress.Windows.Form.

BLOCK-LEVEL ON ERROR UNDO, THROW.

CLASS button INHERITS Form: 

   DEFINE PRIVATE VARIABLE button1 AS System.Windows.Forms.Button NO-UNDO.
   DEFINE PRIVATE VARIABLE components AS System.ComponentModel.IContainer NO-UNDO.


   CONSTRUCTOR PUBLIC button (  ):


      SUPER().
      InitializeComponent().
      THIS-OBJECT:ComponentsCollection:ADD(THIS-OBJECT:components).
      CATCH e AS Progress.Lang.Error:
         UNDO, THROW e.
      END CATCH.

   END CONSTRUCTOR.

   METHOD PRIVATE VOID InitializeComponent(  ):

      /* NOTE: The following method is automatically generated.

      We strongly suggest that the contents of this method only be modified using the
      Visual Designer to avoid any incompatible modifications.

      Modifying the contents of this method using a code editor will invalidate any support for this file. */
      @VisualDesigner.FormMember (NeedsInitialize="true").
      DEFINE VARIABLE resources AS Progress.Util.ResourceManager NO-UNDO.
      resources = NEW Progress.Util.ResourceManager("button").
      THIS-OBJECT:button1 = NEW System.Windows.Forms.Button().
      THIS-OBJECT:SuspendLayout().
      /*  */
      /* button1 */
      /*  */
      THIS-OBJECT:button1:Image = CAST(resources:GetObject("button1.Image"), System.Drawing.Image).
      THIS-OBJECT:button1:ImageAlign = System.Drawing.ContentAlignment:MiddleLeft.
      THIS-OBJECT:button1:Location = NEW System.Drawing.Point(13, 212).
      THIS-OBJECT:button1:Name = "button1".
      THIS-OBJECT:button1:Size = NEW System.Drawing.Size(108, 42).
      THIS-OBJECT:button1:TabIndex = 0.
      THIS-OBJECT:button1:Text = "Exit".
      THIS-OBJECT:button1:TextAlign = System.Drawing.ContentAlignment:MiddleRight.
      THIS-OBJECT:button1:UseCompatibleTextRendering = TRUE.
      THIS-OBJECT:button1:UseVisualStyleBackColor = TRUE.
      /*  */
      /* button */
      /*  */
      THIS-OBJECT:ClientSize = NEW System.Drawing.Size(292, 266).
      THIS-OBJECT:Controls:Add(THIS-OBJECT:button1).
      THIS-OBJECT:Name = "button".
      THIS-OBJECT:Text = "button".
      THIS-OBJECT:ResumeLayout(FALSE).
      CATCH e AS Progress.Lang.Error:
         UNDO, THROW e.
      END CATCH.
   END METHOD.

   DESTRUCTOR PUBLIC button ( ):

   END DESTRUCTOR.

END CLASS.
© www.soinside.com 2019 - 2024. All rights reserved.