Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
E

errorfunktion

@errorfunktion
About
Posts
15
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Semi Transparent Controls
    E errorfunktion

    Well I got it working. Here's a couple of screenshots: http://rapidshare.com/files/53533392/tccontrol1.bmp.html http://rapidshare.com/files/53531028/tcontrol2.bmp.html In the forms paint event I have drawn a circle in the upper left corner. I have also placed a button in the upper left corner. The arrow shaped thingy is my control. All You need is a derived control in my case: Public Class TransparentControl Inherits Control 'Set These Options: Public Sub New() SetStyle(ControlStyles.SupportsTransparentBackColor, True) BackColor = Color.Transparent 'It might be necessary to override the base 'backcolor property 'Add some code to the paint event to draw the control and use a color with alpha level less then 255. 'As you can see in the first screen capture the form background is visible, but the control is obscured. ' To make the button also visible through the control you can use the button's draw to bitmap method and set that bitmap as ' the controls background image. ' Right now this code is in the button's paint event handler and it makes things a bit twitchy. There's probably a better position for it. Private Sub Button1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Button1.Paint Dim control_rect As New Rectangle(Me.TransparentControl1.Location, Me.TransparentControl1.Size) Dim button_rect As New Rectangle(Me.Button1.Location, Me.Button1.Size) 'Checks If the control area's recangle interesects with the button's If control_rect.IntersectsWith(button_rect) Then 'Find the area of the intersection control_rect.Intersect(button_rect) 'Offset the area of intersection to account for the different positions control_rect.Offset(-Me.TransparentControl1.Location.X, -Me.TransparentControl1.Location.Y) Dim im As New Bitmap(Me.TransparentControl1.Width, Me.TransparentControl1.Height) Me.Button1.DrawToBitmap(im, control_rect) Me.TransparentControl1.BackgroundImage = im End If End Sub That's It. Thanks for the help Dave Gary

    Visual Basic css graphics tutorial question discussion

  • Semi Transparent Controls
    E errorfunktion

    Why the sarcasm Dave? After all you agree with me. :) Color.Transparent also tells the control to get its background image from it's container, and hence it does more than simply set it's own background to the same color. Semantics. Never mind. Meanwhile I've made some progress. I've created a derived button class called MyButton. I also have a regular old button, I've written this code in it's event handler: Dim img as New Bitmap(TransparentControl.Width,TransparentControl.Height) Dim GraphicsObject as Graphics=Graphics.FromImage(img) 'I now use a translation transform to account for the diffrence in position 'of the transparent control and the MyButton object: GraphicsObject.TranslateTransform( _ MyButton1.Location.X-TransparentControl.Location.X, _ MyButton1.Location.Y-TransparentControl.Location.Y) 'I now call the derived Button's OnPaint Event using the Graphics object I Just created. MyButton1.OnPaint(New PaintEventArgs( _ GraphicsObject,TransparentControl.DisplayRectangle)) 'And Finally I set the Transparent control background image to this image. TransparentControl.BackgroundImage=img The derived buttons shape (It's white body) is properly located and visible on the back of my control. But the buttons text caption is not translated for some reason. Is the the caption not drawn in the OnPaint Event or something?

    Visual Basic css graphics tutorial question discussion

  • Semi Transparent Controls
    E errorfunktion

    This is simply not true. There is one computer screen and hence only one set of pixels. If the form background is gray and one draws a green circle those pixels become green. The Form Background is still gray. If a control on top of the form obscures the circle and then moved the form paint event repaints the circle. The circle is by no means part of the background. Also Dave, It's not true that color.transparent simply gives the control the container background. If I manually give the control the same background as the form the circle is not visible. Meaning that color.transparent clearly does something more. What it does I don't know.

    Visual Basic css graphics tutorial question discussion

  • Semi Transparent Controls
    E errorfunktion

    Hi Dave, thanks for the fast response. I still don't understand. If the form has a gray background, on top of it is drawn a green circle. On top of this is my control. If my control background is gray does that mean that the form in some way paints the green circle on my control? If what you say is true that would be the only explanation, otherwise I would not see the circle. If this is the case can I employ this mechanism somehow to cause other controls to behave in this manner?

    Visual Basic css graphics tutorial question discussion

  • Semi Transparent Controls
    E errorfunktion

    Hi, If you paint on a form using a color with alpha level of less then 255 the form background is partially visible. I was trying to achieve the same effect with controls. I have a control derived from the control class. I have used this code: SetStyle(ControlStyles.SupportsTransparentBackColor) BackColor = Color.Transparent and the foreground is painted with say: color.fromarg(50,255,0,0) This works nicely with graphics that I have painted on the form background it is visible through the control. But other controls with a lower Z order should logically be visible through the control as well but they are not. Any thoughts on how to get it to work? thanks, Gary

    Visual Basic css graphics tutorial question discussion

  • Most Efficient Data Control
    E errorfunktion

    Not really sorry, A picture box provides a graphics object that you may use to draw paint whatever you like on, text included hence it can be used to show a table of data. I may have neglected to mention this: If this data was static then I wouldn't even bother asking the question. New data is constantly received and displayed in new lines while older lines are deleted, this is my concern with performance. The update rate is fast perhaps once a second. Updating a ListView control therefore might seem more efficient since it only requires two actions: add and remove item. Updating the tablepanel will take a loop of 500*NumberOfColumns actions. Which one of the ways I have listed is likely to take the least amount of CPU time?

    Visual Basic performance business question

  • Most Efficient Data Control
    E errorfunktion

    Hi, I need to display a data set in some sort of table format, which will be scrollable.. This set contains approximately 500 rows of data items, say contact information. Some rows need to be in a different color than the other rows according to some criteria which is why I can't use a big textbox. I was thinking about several ways to implement this: 1. Using a ListView Control 2. Using a DataGrid Control 3. Using a Picture box and simply painting the item information on it. I have no need to interact with the data just display it. 4. Using a TableLayooutPanel and filling it with labels. Which of these ways is the most efficient way to do this, performance wise, least memory requirements, best application responsiveness etc? Thanks, Gary

    Visual Basic performance business question

  • Transparent Mdi
    E errorfunktion

    I know. Kudos on the cookie analogy.;)

    Visual Basic help design docker

  • Transparent Mdi
    E errorfunktion

    Well, I know for sure it has been done. I got the inspiration for this from "Mathematica". But no, there's no way I can pull this off myself, I don't have the knowledge. I will find a way to work around this. Thanks

    Visual Basic help design docker

  • Transparent Mdi
    E errorfunktion

    Nah, using this line of code: mdiclient1.BackColor = Color.Transparent Generates the following exception: "Control does not support transparent background colors" But it works fine for any other color.

    Visual Basic help design docker

  • Transparent Mdi
    E errorfunktion

    Hi, I want to design an Mdi application but with a transparent background for the MdiClient container (and form). It should behave in a similar fashion to the way "Mathematica" behaves if you know that software. I have two screens. I want various child forms to be scattered across both screens but at the same time windows from a different application must be visible, and respond to mouse events, in screen areas where there are no child forms. Put it another way the MdiClient container must fill both screens but be transparent. The problem is that the class MdiClient in non inheritable and I can not override the appropriate method to not color the background. Setting transparentkey in the main form to some color and setting the MdiClient background to this color doesn't work either, the MdiClient control doesn't support transparent background colors. If you have a different idea how I can achieve this functionality that's fine by me. My desire is simply to able to use my screens working area with maximum efficiency and at the same time have the sub forms behave as child forms of a single application. Any help will be most appreciated, Gary

    Visual Basic help design docker

  • General design question
    E errorfunktion

    Thanks, This was what I was looking for. I am kind of a newbie to .net and the amount of classes is staggering. There is usually also no connection between object class names in the microsoft documentation to what they actually do, so figuring out what you need is quite difficult.

    Visual Basic question csharp design lounge

  • General design question
    E errorfunktion

    This might work, I would appreciate if you could post a link to some code demonstrating how to cause a vb app to accept and issue command lines. The data transfer rate needs to be very fast so I'm not 100% sure on this. Still this seems like a bit of a workaround. My original thinking was to implement something like the old com object interface, but I understand this is not really part of the new .net concept, so what is the equivalent? Is this an overkill for this type application? -- modified at 5:26 Tuesday 26th June, 2007 [edit] I have thought about it a bit and command lines are not good. The data transfer is about once a second. I can't have my standard I\O hijacked by some application listening for command lines. What if I want to use other command lines while the program is running?

    Visual Basic question csharp design lounge

  • General design question
    E errorfunktion

    But since internet connectivity between the applications isn't necessary, isn't this redundant, or at least not efficient?

    Visual Basic question csharp design lounge

  • General design question
    E errorfunktion

    Hi, I want to build two vb.net applications running on the same machine. One application needs to pass data to the other. How should I go about to implement this? Thanks, Gary

    Visual Basic question csharp design lounge
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups