Search results for query: *

  • Users: VicJ
  • Order by date
  1. VicJ

    Graphics interpolation issue

    Use InterpolationMode. None of the modes you listed are relevant to your question. TextRenderingHint might have been if you were using Graphics.DrawString, but it doesn't apply to DrawImage. The mode you need for resizing an image (e.g. with DrawImage) is Graphics.InterpolationMode. The "best"...
  2. VicJ

    Deleted

    Do you have the listbox anchored or docked so that it resizes whenever you resize the form? I have been doing a few tests and it seems that even a well-filled standard ListBox can flicker a bit when you resize it, and a custom drawn one seems to be even more prone to laggy redrawing. Making the...
  3. VicJ

    Deleted

    I can't see why it happens but try setting DoubleBuffered=True as I suggested. ControlStyles.OptimizedDoubleBuffer only works in combination with another ControlStyle (UserDraw if I remember correctly). But the use of SetStyle statements for this purpose was superseded by the DoubleBuffered...
  4. VicJ

    Deleted

    You could if you wanted make a double buffered ListBox by inheriting ListBox and setting DoubleBuffered=True in the constructor. But are you actually getting any flickering? There's nothing in the posted painting code (different brushes, different fonts etc.) that could cause flickering any...
  5. VicJ

    Question Draw a line

    You have the right idea. "Me" refers to the form that contains the code. For another form, you have to give the name of the form. BB
  6. VicJ

    Question Draw a line

    You should draw the line in a Paint event handler, for example: Private Sub Form1_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint Dim blackPen As New Pen(Color.Black, 3) e.Graphics.DrawLine(blackPen, x1, y1, x2, y2) blackPen.Dispose...
  7. VicJ

    Question Filter Form Graphic

    That's a useful CodeProject entry, but you could achieve the same result with much less code just by using form Opacity. Here's a code example which works perfectly and also deals with eventualities such as dragging, resizing or minimizing the form. For demo purposes, add a TrackBar (TrackBar1)...
  8. VicJ

    Shadow/Glow goes black on invalidate

    There are other ways to do it. I could mention Layered Windows, about which you can find information in msdn and examples in the CodeProject. But in my view they have been superseded by WPF which is more versatile (Layered Windows can't host controls) and easier. It gives you subtle drop...
  9. VicJ

    Question Check if image exists in another image.

    This question was resolved on another forum: see here. Cocer, please do not cross post different forums, because it can waste the time of people who try to help you. If necessary, try one first and then another if you do not get the help you need. VicJ (aka boops boops).
  10. VicJ

    Question Dial Gauge Meters are not easy to make

    I just meant to give you an example. I tried my code and it works as I intended (I had to change TrackBar1 to VScrollBar1 but I hope you noticed that). You didn't say what the button was supposed to do. I'm not sure if I understand what you say, but I guess you want to start and stop the button...
  11. VicJ

    Question Dial Gauge Meters are not easy to make

    Hi Syed, You should do the Graphics in the PictureBox Paint event handler, instead of in the Timer Tick event handler. Instead of using CreateGraphics, you get the Graphics object form the PaintEventArgs (e.Graphics). Assuming you want to draw the gauge in PictureBox1, this is how it will look...
  12. VicJ

    Question Make vector graphics file format

    Assuming you want all the lines in the drawing to be antialiased, you only need to set the SmoothingMode once for the Graphics object with which you are drawing on the screen. Windows has its own vector file format (WMF/EMF) but unfortunately the .Net framework doesn't provide a way to save...
  13. VicJ

    Question Smooth round borderless form corner

    JB, the question is not how to shape the form but how to smooth its edges. Both TransparencyKey and Region produce jagged edges on curves and diagonals. rarva, the method I suggested in post #2 can work well for a static form on an unchanging background. But it's a bit unreliable otherwise...
  14. VicJ

    Simple sprite movement help pretty please?

    Unfortunately I've been very busy myself, so maybe this comes a bit late. You can add lines to the form in various ways. If you have the VB.Net PowerPack for .NET 2003 you could use the the LineShape tool to add lines in the designer. Alternatively you could draw lines in the form's Paint event...
  15. VicJ

    Simple sprite movement help pretty please?

    Well done so far Mark. What you are asking about now is called "collision detection" and it's not as difficult as its name suggests. The easiest way is to use the Rectangle.Intersects function, for example: If spriteBounds.Intersects(Label1.Bounds) Then ... 'stop or change direction of sprite...
  16. VicJ

    Simple sprite movement help pretty please?

    Google for vb.net sprite sheet. You'll find plenty of examples. You will probably have to measure up your sprite sheet to find the pixel sizes of the rows and columns. Vic
  17. VicJ

    Sorting a colour grid in to order

    The reason I suggested sorting by brightness was because it said in post #1: and because sorting by one HLS variable at a time is easy to implement. I took that too literally. He has managed to sort the colours of the pixels into some kind of order, but apparently not in a way that usefully...
  18. VicJ

    Sorting a colour grid in to order

    It's true that sorting by Lightness/Brightness only isn't going to provide the answer mickle026 wants, but otherwise the problem is much more difficult to solve. The subtle tints in post #1 are a good illustration of why comparing all three variables one by one won't work. Suppose c1 is...
  19. VicJ

    Sorting a colour grid in to order

    The above comparison function is wrong. You can only sort on one of the HSL variables at a time. To sort by Lightness, the function should be: Public Function HLSComparison(c1 As Color, c2 As Color) As Integer Return c1.GetBrightness.CompareTo(c2.GetBrightness) End...
  20. VicJ

    Smoothing the Pen

    Hi k3nn, it was a good idea to make a fresh start if you don't need all the code for drawing rectangles, ellipses etc. The reason your line strokes were not "stacking" is that you were drawing the whole graphics path with the same pen. Just putting in StartFigure won't help. Figures are a...
Back
Top