How do I prevent appearance inheritance?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fred Flintstone

    How do I prevent appearance inheritance?

    This is THE most annoying feature of VB.Net I've ever seen. *I'LL*
    decide what my controls will do and look like, thanks.

    I have an overridden panel control with a gradient background and 3D
    raised border. Any control I drag into this panel inherits the 3D
    border. (like transparent labels)

    How do I shut this feature off entirely? It's wasting an incredible
    amount of time.

    Thanks!

  • Herfried K. Wagner [MVP]

    #2
    Re: How do I prevent appearance inheritance?

    * Fred Flintstone <idontthinkso@n ospam.com> scripsit:[color=blue]
    > This is THE most annoying feature of VB.Net I've ever seen. *I'LL*
    > decide what my controls will do and look like, thanks.
    >
    > I have an overridden panel control with a gradient background and 3D
    > raised border. Any control I drag into this panel inherits the 3D
    > border. (like transparent labels)
    >
    > How do I shut this feature off entirely? It's wasting an incredible
    > amount of time.[/color]

    Inside the control, you can use 'Me.DesignMode' to check if the control
    runs in design mode.

    --
    Herfried K. Wagner [MVP]
    <URL:http://dotnet.mvps.org/>

    Comment

    • Chris Dunaway

      #3
      Re: How do I prevent appearance inheritance?

      On Tue, 22 Jun 2004 12:50:36 -0400, Fred Flintstone wrote:
      [color=blue]
      > I have an overridden panel control with a gradient background and 3D[/color]

      I don't have an answer for you, just a related question. When you inherit
      from the Panel control, where do you handle the painting to override the
      panel? In OnPaint? or in the Paint event? And do you call the
      MyBase.OnPaint, or MyBase.Paint? Just trying to understand it

      Thanks,

      --
      Chris

      dunawayc[AT]sbcglobal_lunch meat_[DOT]net

      To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
      replace certain words in my E-Mail address.

      Comment

      • Fred Flintstone

        #4
        Re: How do I prevent appearance inheritance?

        How does that disable visual inheritance?


        On 22 Jun 2004 20:13:54 +0200, hirf-spam-me-here@gmx.at (Herfried K.
        Wagner [MVP]) wrote:
        [color=blue]
        >* Fred Flintstone <idontthinkso@n ospam.com> scripsit:[color=green]
        >> This is THE most annoying feature of VB.Net I've ever seen. *I'LL*
        >> decide what my controls will do and look like, thanks.
        >>
        >> I have an overridden panel control with a gradient background and 3D
        >> raised border. Any control I drag into this panel inherits the 3D
        >> border. (like transparent labels)
        >>
        >> How do I shut this feature off entirely? It's wasting an incredible
        >> amount of time.[/color]
        >
        >Inside the control, you can use 'Me.DesignMode' to check if the control
        >runs in design mode.[/color]

        Comment

        • Fred Flintstone

          #5
          Re: How do I prevent appearance inheritance?

          In the Paint Event:

          Private Sub uc3DPanel_Paint (ByVal sender As Object, ByVal e As
          System.Windows. Forms.PaintEven tArgs) Handles MyBase.Paint
          Dim rec As Rectangle = New Rectangle(3, 3, Me.Width - 6,
          Me.Height - 6)
          Dim myBrush As Brush = New Drawing2D.Linea rGradientBrush( rec,
          GradientColor1, GradientColor2, GradientT)
          Select Case miDrawstyle
          Case 1
          ControlPaint.Dr awBorder3D(e.Gr aphics, ClientRectangle ,
          Border3DStyle.B ump)
          Case 2
          ControlPaint.Dr awBorder3D(e.Gr aphics, ClientRectangle ,
          Border3DStyle.E tched)
          Case 3
          ControlPaint.Dr awBorder3D(e.Gr aphics, ClientRectangle ,
          Border3DStyle.F lat)
          Case 4
          ControlPaint.Dr awBorder3D(e.Gr aphics, ClientRectangle ,
          Border3DStyle.R aised)
          Case 5
          ControlPaint.Dr awBorder3D(e.Gr aphics, ClientRectangle ,
          Border3DStyle.R aisedInner)
          Case 6
          ControlPaint.Dr awBorder3D(e.Gr aphics, ClientRectangle ,
          Border3DStyle.R aisedOuter)
          Case 7
          ControlPaint.Dr awBorder3D(e.Gr aphics, ClientRectangle ,
          Border3DStyle.S unken)
          Case 8
          ControlPaint.Dr awBorder3D(e.Gr aphics, ClientRectangle ,
          Border3DStyle.S unkenInner)
          Case 9
          ControlPaint.Dr awBorder3D(e.Gr aphics, ClientRectangle ,
          Border3DStyle.S unkenOuter)
          End Select
          If UseGradients = True Then
          e.Graphics.Fill Rectangle(myBru sh, rec)
          End If
          myBrush = Nothing
          End Sub

          I solved the inheritance problem (kind of) by drawing the gradient
          last. If I draw the gradient first and then apply the border, every
          control placed in the panel has that border. I also had to reduce the
          area drawn by the gradient because it would erase the border.
          However, it's a nifty accidental feature cause at 3 pixels or more, it
          retains the border and allows the true BackColor to come through as a
          seondary inside border.

          The only real problem left is that in design view, if you change a
          color, the change doesn't appear. I have to switch to code view then
          back to design to see the change. Don't know why or where to begin
          with that one.

          I'll post the entire source if I can get this figured out. I'd still
          like to know how to disable visual inheritance tho.

          Fred.


          On Tue, 22 Jun 2004 15:45:41 -0500, Chris Dunaway
          <"dunawayc[[at]_lunchmeat_sbcg lobal[dot]]net"> wrote:
          [color=blue]
          >On Tue, 22 Jun 2004 12:50:36 -0400, Fred Flintstone wrote:
          >[color=green]
          >> I have an overridden panel control with a gradient background and 3D[/color]
          >
          >I don't have an answer for you, just a related question. When you inherit
          >from the Panel control, where do you handle the painting to override the
          >panel? In OnPaint? or in the Paint event? And do you call the
          >MyBase.OnPaint , or MyBase.Paint? Just trying to understand it
          >
          >Thanks,[/color]

          Comment

          Working...