0

Good day all! I have a very tricky for me question. In my application I have button with image inside. All properties of this button:

    Me.cmdSelectAll.BackColor = System.Drawing.SystemColors.Control
    Me.cmdSelectAll.Image = CType(resources.GetObject("cmdSelectAll.BackgroundImage"), System.Drawing.Image)
    Me.cmdSelectAll.ImageAlign = Drawing.ContentAlignment.BottomRight
    Me.cmdSelectAll.Cursor = System.Windows.Forms.Cursors.Default
    Me.cmdSelectAll.Font = New System.Drawing.Font("Arial", 8.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.cmdSelectAll.ForeColor = System.Drawing.SystemColors.ControlText
    Me.cmdSelectAll.Location = New System.Drawing.Point(0, 282)
    Me.cmdSelectAll.Name = "cmdSelectAll"
    Me.cmdSelectAll.Padding = New System.Windows.Forms.Padding(0, 0, 0, 0)
    Me.cmdSelectAll.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.cmdSelectAll.Size = New System.Drawing.Size(22, 22)
    Me.cmdSelectAll.TabIndex = 11
    Me.cmdSelectAll.TabStop = False
    Me.ToolTip1.SetToolTip(Me.cmdSelectAll, "Select All Channels")
    Me.cmdSelectAll.UseVisualStyleBackColor = False

When I run it with default text size of win7, the image appears in the center, it's all ok. But when I set some custom value of text size (115%) my image suddenly goes more right and down. It occurs with all of my button's images. Could you please answer me why does this happen and how can i fix this issue? Thanks

Viaches
  • 143
  • 1
  • 16
  • probably because you aligned the image to bottom right in the 3rd line.. Try changing the alignment to where you want it.. – Madushan Jul 05 '13 at 10:22
  • Yeah, I thought about it) you see, I don't know why but BottomRight alignment places my image in the center of the button. It's pretty strange. – Viaches Jul 05 '13 at 10:31
  • how do you set the text size ? – Madushan Jul 05 '13 at 10:43
  • Personalize -> Display -> Set custom text size (DPI) – Viaches Jul 05 '13 at 10:47
  • refer to this question. You may have to disable Auto Scaling on the `Form`. http://stackoverflow.com/questions/4009150/c-sharp-winforms-disable-dpi-scaling – Madushan Jul 05 '13 at 10:55

0 Answers0