PC Review


Reply
Thread Tools Rate Thread

Button Array with faster painting

 
 
Carl Gilbert
Guest
Posts: n/a
 
      15th Nov 2004
Hi

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.

And then when the user clicks the CapsLock button I would then go through
all the buttons setting the text ToUpper ot ToLower.

Regards, Carl Gilbert


 
Reply With Quote
 
 
 
 
Larry Serflaten
Guest
Posts: n/a
 
      15th Nov 2004

"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


 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      15th Nov 2004
Carl,

As long as you are not using system.drawing for the painting of a button,
that should go fast.

In my opinion is there probably something else what stops your program
showing those buttons than the code you showed us.

Just my thought,

Cor

> Hi
>
> 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.
>
> And then when the user clicks the CapsLock button I would then go through
> all the buttons setting the text ToUpper ot ToLower.
>
> Regards, Carl Gilbert
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Which is faster--Array or ADO vanderghast Microsoft Access VBA Modules 5 3rd Jul 2009 04:46 PM
Re: Which is faster--Array or ADO Albert D. Kallal Microsoft Access VBA Modules 1 3rd Jul 2009 04:04 PM
how to painting in non-client windows & add button to it in c# Eric Microsoft Dot NET Framework Forms 0 1st Mar 2006 03:38 PM
Painting when Button gets klicked Stefan Richter Microsoft VB .NET 8 13th May 2004 01:53 AM
Loading Excel Array from VB Array Faster ExcelMonkey Microsoft Excel Programming 3 22nd Jan 2004 02:49 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:31 PM.