Interface And Graphics :: Make A Class For A Custom Button?
Jan 2, 2012i want to make a class for a custom button for which the user of the class can choose his own images for Normal, mouse over and mouse down state.
View 5 Repliesi want to make a class for a custom button for which the user of the class can choose his own images for Normal, mouse over and mouse down state.
View 5 RepliesI'm making a custom class that mocks the System.Drawing.Rectangle class because the Rectangle class doesn't have a name property. I need a name property because I am adding all of my rectangles to a collection and I need a little more info stored than just their locale and size. So I changed the _onPaint event but nothing is working out when I run the program?
Public Class Rectanglar : Inherits UserControl
Public BackgroundColor As Color = Color.Blue
Public Sub New(ByVal name As String, ByVal XY As Point, ByVal Widthy As Integer, ByVal Heighty As Integer)
[code].....
im making a program that needs to make a new button for each .exe file in a directory? Kinda similar to PortableApps program that will recognize each program in the directory.
View 3 RepliesOk, I want to create a class that will handle a special rectangle graphic.In my form, I want to have two of these special rectangles. So, basically, I need two instances of that class in my form, right?I manage to initialize two, alright. But, how exactly am I supposed tomanage drawing/graphics etc in a class, and the results to be displayed in my form?
View 13 RepliesI'm trying to make a .dll that contains a lot of basic functionality that a program can use. Currently i am trying to use interfaces to make a lot of this functionallity independend of the program using it but i hit a snag. The Basic idea is that a programmer will create his own object using the interface discribed in my .DLL file. Then implements those functions as he likes. He can then instanciate a controller (found in the same DLL) and sends his custom object implementing the interface to that Controller. The controller can then be started and will take over all the work. I do not know what type of object is send to the controller and idealy i want to program it in such a fashion that i shouldn't care as long as the object send implements that interface.In code I am trying to achieve the following: (quite simplyfied)
.Dll:
Code:
Public Interface MyInterface '<----Decleration of the interfaceFunction GetData() As Integer
Function SetData(Data As Integer)
end interface
[code]....
this propperly. I know that the second i set the interface adaptor in the Controller VS comes nagging that it can not be converted to a "MyInterface" Class. Obviously i am doing something wrong. I can change the datatype that the controller expects to the "MyController" type but that would completely ruin the whole idea of flexibillity. I am hoping someone sees what i am trying to do and can point out where i made the thinking error.
I'm having some problems with custom controls and anchors today. I made a custom control containing a picture box and a vertical scroll bar. When I adjust the form the custom control outer area (the blank part) will adjust to the size of the form but the picture box and scroll bar do not. I have the picture box anchored to all sides and the vertical scroll bar anchored to the right side. They just will not adjust with the control when it is resized on the form.
View 4 RepliesI'm trying to build a custom ListBox control as inspired by the 'Audi Infotainment System' on high-end Audi vehicles. The only difference is i would like to have a 'boundary' where when scrolling up/down moves the actual list up or down. Basically, i would like my list to act like a normal ListBox except i would like to show say one or two items above and below normally only visible items.
View 3 RepliesI'm trying to bring up a simple right-click menu on a listbox and I'm having little luck with it. I created a basic ContextMenuStrip named "ContextMenuStrip1" and I'm trying to call it in the ListBox's Mouse Click method:
Code:
Private Sub ListBox1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseClick
If (e.Button = Windows.Forms.MouseButtons.Right) Then
ContextMenuStrip1.Show(MousePosition)
End If
End Sub
So here's what it's actually doing. The right mouse button doesn't seem to activate MouseClick at all for this object. It is caught in MouseDown, but when I try to call this from that method, the ListBox Index doesn't change. How can I get a right-click to be called from the MouseClick (Not imperative) and how do I get the ListBox to change the index with a right-click?Also, the menu looks like one of Office's right-click menu that can have an image to the left of the text. When I don't have an image the text is about 50 pxls or so away from the left edge. This looks weird. Can I change that?
Is there a way to make custom scollbars in listview? And could someone please show me how, step by step. I'm completely new at this
View 2 RepliesI created an application in VS2005 that draws text with a custom font and color. The images look great from my XP machine. But from another machine running Windows Vista, the graphics are messed up. It seems that the transparencies inherit the default black background so there's this gray'ish/black haze around the text...
View 1 Replies[URL] This is for vb6, and I know this is a .net forum, but hopefully some one may know the answer as I have tried countless other places. The buttons appear properly after they are clicked or issued a .refresh command.
View 1 RepliesOk..I think it's very simple but I'm still a begineerI'll try to make it clear I need to draw a rectangle when I click on the button..what is the required code?
Quote:
Public Class Form1
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
[code].....
I plan on using a scrollbar for, well, scrolling an image. The image is 200x500, however, the only visible area is 200x250.
So I set the max value to 250, and the min value to 0. The idea is that if I drag the scrollbar's button to the bottom, 250 pixels will have moved for the image, right?
But wait, the scrollbar's button is.... very small. And the scrollbar is actually pretty long. Is there a way to make the scrollbar's button longer?
I was wondering if there is a way to have a button/label that would change the selected item color of the combobox from the standard black into a certain color (say green), but not change all of the items' color into green. This is for a to-do list type of application where a user clicks the button to signify that the current item is finished..This is what I was thinking (not in VB code) When button1 is clicked, combobox1. selecteditem. color = green
View 1 RepliesThis is VB 2008, under Vista. I can't seem to change the background color of a button without the gradient disappearing.Strangely enough, you can even set the background color to itself and the gradient disappears. How do you keep the gradient but change the color?
Here's an example:
Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Button1.BackColor = Button1.BackColor ' This should do nothing!
[code]....
I can tell when the user clicks on my picturebox. Can I tell which mouse button was used? Left or right?
View 1 RepliesI have a form with buttons, and the user can change the colors of the buttons with the color dialog box for fun:
Button_Play.BackColor = ColorDialog.Color
There is a reset button to put the colors to how they were without any special coloring, but I can't get them to go back to how they originally looked.They go to gray in the middle, instead of the nice shaded blue/gray style. I have tried a few different things:
Button_Play.BackColor = Button.DefaultBackColor
Button_Play.BackColor = SystemColors.Control
Button_Play.BackColor = Color.Empty
I am using VB '08 Express on Win XP with the Desktop, Display Properties, Appearance, Windows and Buttons: set to Media Center Style and Color Scheme: set to Energy Blue. how to (with this theme) get the button to look like default after changing the color?
I need to visually moves the cursor using keyboard keys.
1) I need to get the mouse to where the button is
2) Simulate the mouse movement to the button from whereever it is
3) and simulate a button click.
Only after I select a button I can start drawing on my form. I have a code here, when I hold the Ctrl key and press the arrow keys, the mouse will start drawing straight lines. But what happen when I need to use controls like buttons, comboboxes etc.?
how to enable the "import" button when at least one of the checkboxes is checked.I have two buttons : "Deselect all" and "Select All" for the checking of the boxes, to import the specific files' data they want to Excel. (the files are in listbox, and the checked boxes is for selecting the files' parameters that they want to see in excel)
One option:When the user deselect all, the "import" button is suppose to be disable to prevent the user from importing the files' data parameters.
2nd option:(if i do not want to disable the import button) or show message that they have to select at least one box and at the same time, prevent the import button to work if there's no checked checkbox. So my deselect all button code :
Code:
CO2checkbox.Checked = False
NH3checkbox.Checked = False
DBcheckbox.Checked = False
[code]....
but the button still remain disabled if I click "unchecked all" button and then checked at least one box. how do I enable it?And how do i...show error message and prevent the files' data to be imported when the user click "import" when there's no checked checkbox if I choose the alternative option of using message to alert them without disabling the button and yet prevent importing of data?
PS: If I did not click "deselect all" button but click the "select all" button, the import button is enabled and working.
So now I will try to make something more complex, still playing around with this graphics thing.I want a picturebox to display a tileset (a bunch of 32x32 tiles normally used for creating game levels etc), the picturebox is inside a container (which has autoscroll ON). The picturebox is larger than the container, so the container will make scrollbars automatically.Now, I need to be able to choose a tile or multiple tiles (if I click & drag the mouse)Basically I want to draw a 32x32 "red" box over each selected tile (so the user knows what tiles are selected).So first of all, I need to know when the mouse clicks the picture. Good. It works.Now, I need to know which 32x32 tile was clicked. Well, I think I can calculate that just fine.BUT, what if the user drags the mouse while clicking on a tile? I want to support multiple tiles selected, but I am clueless about tracking what tiles were chosen.If we solve that problem, I would have another curiosity: You know the "red boxes" that tell you which tiles are selected? What would happen if I dragged the scroll bar? I need the redboxes to move along with the picture, and hide if they go to an invisible area.
View 6 Repliesi am making a program with graphics and im using a picturebox for a button. The image inside picturebox is transparent .gif. The problem is that i don't know how to make picturebox transparent. I searched the internet but all exaples didn't work. Does someone know how to fix this problem?
View 4 RepliesI am trying to incorporate in my vbdotnet application a form in which I would like to make a thumbnail from an image. So what I have is two picture boxes, one with the source image and the other with the destination image, I would like to crop the image from picture box 1 and display it on picture box 2, but the way I wan to crop it is not giving the coordinates of the selected area box but to simulate a selection area box in which the mouse can move the box and select the area of the picture to be cropped. This selection area box would give me the coordinates i need in order to proceed the cropping. The problem is I don't know how to create this selection area box. It is like doing the cropping on a graphic design software like Macromedia Fireworks, Adobe photoshop, even paint.
View 5 RepliesI'm trying to find a script to create a slider button.
View 2 RepliesI'm developing a GUI for a touchscreen, so when user wants to scroll he/she uses their fingers. Now the thing is that the scrollbar width (with the vertical scrollbar) IS adjustable but the button stays the same height and isn't sufficient for a finger. So the question is : Are the buttons in the scrollbar allso adjustable in size/dimensions.
[Code]...
I tried to create a lineshape and make it visible when a timer ticks. Also tried to set everything that would matter when creating it(border colors and thickness etc)
But still, I got no results.
Code:
Dim line = New Microsoft.VisualBasic.PowerPacks.LineShape(CX, CY, ccx, ccy)
line.Parent = New Microsoft.VisualBasic.PowerPacks.ShapeContainer()
line.Enabled = True
[Code]....
i make a Form transparant where i dont want form background. So say like i got a round form and i can transparant the white background of the round even possible?
View 6 RepliesI can't seem to make a GUI in the shape a circle...
something other than square/rectangle.
I have a red, green, and blue color that I am making with this method:
Code:
Dim Red1 As Color = Color.FromArgb(75, Color.Red)
and a brighter red:
[code].....
Any recommendations? I like the fact that 255,255,255 is white. Is there a way to create color by combining three colors that were made from argb? I may just have to make my 20 different colors set and then refer to them.
When a button is focused by pressing Tab key, a rectangle appears on it. Even if the button's TabStop property is set to false, when the button is clicked with mouse the rectangle appears. Is it possible to
stop the rectangle from appearing?
I need to disable a button after its pressed so the user does not have the ability to click it again as this would replicate the process in some cases. After alot of searching I found some tips - alot of code I found I could not understand.This is what I have come up with:
[code]...
I also read somewhere that I should use: System.Threading.Thread.Sleep(1000) to delay the process or something - not entirely sure why I would do this though.Although, the problem with my above code is that when the code behind page performs validation checks, it exits sub before executing my INSERT SQL code - so when it does this it also disables the button.I am not entirely sure if the above method is fool proof or whether it is a **** piece of code that won't work 100% of the time.On another website I found a script to put on the actual HTML page with <script> tags:
[code]...
But although this works, it does not execute my VB code in the code behind page so I am a little confused where to go here.