Results 1 to 12 of 12

Thread: LINE()-() on UserControl

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2013

    LINE()-() on UserControl

    Somebody can explainme why this code draws incorrect border size up/left?

    New User Control -> Scale default as twips. ScreenperpixelX =ScreenperpixelY = 15 (screen is 1366x768). FLAT (no border), and autoredraw=true

    I mean , is suppose tht LINE () - (x2,y2),,BF where x2 & y2 is the last position to be painted.
    and that scalewidth , scaleheight = THE SIZE.

    So, the last position that is in a matrix that starts from ZERO, is scalewidth-1 and scaleheight-1

    so, what is wrong? why it paints nothing on bottom right, and a single line in top left.

    or if you change the Default_VarBorderWidth = 15 (the pixel size in twips), it paints two row/columns in top left, and 1 column in bottom , right? WHYYYYYYYY!!!!!!

    I observed this behaviour also in pixel scale, so it is not like a conversion thing.

    In all my usercontrols I have to deal with it, changing the formulas.

    Option Explicit
    Option Compare Binary
    Private Const Default_VarBorderWidth = 5
    Private VarBorderWidth As Integer
    Private Const Default_VarBorderColor = &HFFFFFF
    Private VarBorderColor As OLE_COLOR
    Private VarBackColor As OLE_COLOR
    Private VarPicture As StdPicture
    Private VarProgressBarLeftMargin As Integer
    Private VarProgressBarRightMargin As Integer
    Private VarProgressBarTopMargin As Integer
    Private VarProgressBarBottomMargin As Integer
    Private VarProgressBarBorderWidth As Integer
    Private VarProgressBarHeight As Integer
    Private VarProgressBarBorderColor As OLE_COLOR
    Private VarProgressBarBackColor As OLE_COLOR
    Private VarProgressBarForeColor As OLE_COLOR
    Private VarTextColor As OLE_COLOR
    Private VarFont As Font
    Private Sub UserControl_Initialize()
    VarBorderWidth = Default_VarBorderWidth
    VarBorderColor = Default_VarBorderColor
    End Sub
    Private Sub UserControl_Resize()
    Call Redraw
    End Sub
    Private Sub Redraw()
    If VarPicture Is Nothing Then
        UserControl.BackColor = VarBackColor
        UserControl.PaintPicture VarPicture, VarBorderWidth, VarBorderWidth, UserControl.ScaleWidth - VarBorderWidth * 2, ScaleHeight - VarBorderWidth * 2
    End If
    ' Arriba.
    Line (0, 0)-(UserControl.ScaleWidth - 1, VarBorderWidth - 1), VarBorderColor, BF
    ' Izquierda.
    Line (0, 0)-(VarBorderWidth - 1, UserControl.ScaleHeight - 1), VarBorderColor, BF
    ' Abajo.
    Line (0, UserControl.ScaleHeight - VarBorderWidth)-(UserControl.ScaleWidth - 1, UserControl.ScaleHeight - 1), VarBorderColor, BF
    ' Derecha.
    Line (UserControl.ScaleWidth - VarBorderWidth, 0)-(UserControl.ScaleWidth - 1, UserControl.ScaleHeight - 1), VarBorderColor, BF
    End Sub
    Last edited by flyguille; Jun 13th, 2019 at 09:27 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


Click Here to Expand Forum to Full Width