"Carl Gilbert" <(E-Mail Removed)> wrote
>
> I am developing a custom on screen keyboard. So far I have an array of
> buttons and then using SendKeys to send the text of the button to the active
> control to receive the text.
>
> The only problem is that the application is rather slow at painting the
> buttons. Ideally I wanted to allow the user to re-size the control and
> change the text and style of the buttons without such rendering issues.
> (I have a tool to re-size the buttons, its just the paint that is an issue
> here)
>
> Is there anyway to render a series of controls in a more efficient way than
> going something like:
>
> Friend WithEvents Button1 As Button
> Me.Button1 = New Button
> Me.Button1.Location = New System.Drawing.Point(32, 32)
> Me.Button1.Name = "Button1"
> Me.Button1.Size = New System.Drawing.Size(24, 24)
> Me.Button1.TabIndex = 0
> Me.Button1.Text = "Q"
>
> and so on for all the other keys.
That creates a new control, (IMHO) it does nothing about rendering.
Rendering is the action needed to make the control visible on the screen,
just the painting part, not the creation of a new control.
In any case, you could loose all your button controls, and manage the
keys yourself using regions, or simple X and Y calculations. You'd keep
a backbuffer of the keyboard image for use in the paint event, and draw
directly to the screen for user interaction. You can use the ControlPaint
class to help with drawing the 3D buttons.
A while ago someone else wanted Toolbar type buttons, where drawing
them in code was the only way to get them. Here is that example:
http://groups.google.com/groups?selm...TNGP09.phx.gbl
HTH
LFS