NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 74 75 76 77 78 … 93 Next »
Fast Find - Keyboard Design Question

 
  • 0 Vote(s) - 0 Average
Fast Find - Keyboard Design Question
Dubya
Offline

Member

Posts: 149
Threads: 37
Joined: Dec 2004
#1
2005-03-13, 05:31 PM
Hey Jorm,

First, please bear with my stupidity... This is the first time I've really done any windows coding... I'm really keen on learning though. So anyway I thought I would dig into Fast Find and try and redesign the keyboard. Having said that I was wondering if you might be able to tell how I can go about centering the text inside the buttons on the on screen keyboard.

Once again sorry for the dumb question.

Thanks,

Dubya
jorm
Offline

Posting Freak

Posts: 2,014
Threads: 109
Joined: Aug 2004
#2
2005-03-13, 05:48 PM
Centering the text on the buttons in the keyboard. Lets see. In KeyboardWidget you will see a drawRoundedRectangle where we draw the button itself with the x, y, width, height as arguments. Then later we call drawString which draws the text in the box. The x and y to the draw string has to be spaced. The last x is what you would change. If you need help I can send you a highlighted section of code. Showing you the line to change.
WinXP Home
3 X MVPs
Hauppauge 250 MCE
Hauppauge 150
P-4 2.4 GHz / 768 megs Ram
610 Gigs Of Media Storage
Dubya
Offline

Member

Posts: 149
Threads: 37
Joined: Dec 2004
#3
2005-03-13, 05:57 PM
Hey Jorm,

So I think it's this section:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if ( currentValue != null &amp;&amp; bShowText )
{
g.DrawString(currentValue, EnteredTextFont, EnteredTextFontBrush, new Rectangle(currentValueWidth, currentValueHeight, currentValueLocationx, currentValueLocationy));

//g.DrawString(currentValue, EnteredTextFont, EnteredTextFontBrush, new Rectangle(KeyboardStartX, KeyboardStartY+30, (23*currentValue.Length), 25));

}
[/QUOTE]

Where the currentValueLocationx has to be changed... but what would l change it to? I tried things like TextAlign.Center and Center but no worky.

Thanks!

Dubya
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#4
2005-03-13, 07:40 PM
draw string can take another argument of type StringFormat. this is where you can do alignments
so
StringFormat txtAlign = new StringFormat();
txtAlign.Vertical = StringFormat.Center();

then just use
g.DrawString(currentValue, EnteredTextFont, EnteredTextFontBrush, new Rectangle(currentValueWidth, currentValueHeight, currentValueLocationx, currentValueLocationy),txtAlign);

just note, this code
txtAlign.Vertical = StringFormat.Center();
is completely wrong, i cant remember the correct code off hand, but if you are using visual studio it will tell you and if you arent just look in the msdn library and that will tell you, you need to set to variables, one for the vertical alignment, and one for the horizontal alignment. if you need help just let me know.
jorm
Offline

Posting Freak

Posts: 2,014
Threads: 109
Joined: Aug 2004
#5
2005-03-13, 08:56 PM
That looks easier. [Image: smile.gif] So I have been doing it the hard way....
WinXP Home
3 X MVPs
Hauppauge 250 MCE
Hauppauge 150
P-4 2.4 GHz / 768 megs Ram
610 Gigs Of Media Storage
reven
Offline

Posting Freak

Posts: 5,782
Threads: 396
Joined: Sep 2004
#6
2005-03-13, 08:57 PM
[b Wrote:Quote[/b] ]That looks easier. So I have been doing it the hard way....
lmao, yup [Image: tounge.gif]
Dubya
Offline

Member

Posts: 149
Threads: 37
Joined: Dec 2004
#7
2005-03-13, 11:19 PM
I'm trying to make the keyboard in Fast Find look all pretty... I've made some progress so far... But I'll keep ya'll posted.

Thanks for the help,

Dubya
jasonf
Offline

Member

Posts: 121
Threads: 7
Joined: Oct 2004
#8
2005-03-14, 12:02 PM
[b Wrote:Quote[/b] (reven @ Mar. 13 2005,14:40)]just note, this code
txtAlign.Vertical = StringFormat.Center();
is completely wrong, i cant remember the correct code off hand...
StringFormat object has a &quot;Alignment&quot; property that controls the horizontal, and a &quot;LineAlignment&quot; property that controls the vertical.

Each of these are a StringAlignment enumeration. Possible values are:

StringAlignment.Near
StringAlignment.Center
StringAlignment.Far
JasonF
Dubya
Offline

Member

Posts: 149
Threads: 37
Joined: Dec 2004
#9
2005-03-14, 02:55 PM
Alright guys I soooo close but still so far... Here's what I got so far...

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">StringAlignment txtAlign = new StringAlignment();
txtAlign.center = StringAlignment();[/QUOTE]

I'm kinda confused why you need the first line though... Can't you just say...

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">txtAlign = new StringAlignment();[/QUOTE]

And then when I go to use it in below just do this?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">g.DrawString(keys[eachKey], SelectedKeyboardKeyFont, SelectedKeyboardKeyBrush, new Rectangle(KeyboardStartX+offset+7, KeyboardStartY+verticalOffset+4, displaywidth, boxwidth,),txtAlign.center);[/QUOTE]

I tried it with the two lines and I keep getting complier errors. Do you guys know a good website for beginners?

Thanks,
Dubya
jasonf
Offline

Member

Posts: 121
Threads: 7
Joined: Oct 2004
#10
2005-03-14, 05:44 PM
That last parameter of DrawString is actually a StringFormat object, not a StringAlignment. StringFormat has 2 different properties that are of type StringAlignment (an enumeration). In addition, you can use a StringFormat to control things, like how truncated text is handled (i.e., if it's too long, you can have it put elipses at the end, etc).

See my earlier post for the horizontal and vertical alignments.
JasonF
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (2): 1 2 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  Web API only_new Question Gazavant 6 2,796 2021-04-04, 06:54 PM
Last Post: sub
  Another Artwork question scJohn 15 8,381 2019-09-10, 05:33 PM
Last Post: nonob
  WEB API GuidService/Listing question(s) scJohn 6 4,405 2017-08-09, 02:18 PM
Last Post: scJohn
  skin question pBS 2 3,382 2016-06-18, 07:03 PM
Last Post: pBS
  Another SQL question bgowland 15 7,460 2014-05-21, 08:09 AM
Last Post: bgowland
  Timing.Info question mvallevand 2 2,133 2013-04-19, 03:54 AM
Last Post: mvallevand
  N-PVR db3 EPG_EVENT time format question bgowland 3 2,181 2011-03-12, 05:26 AM
Last Post: bgowland
  Ping UncleJohnsBand (question about npvr soap) ioan 2 2,116 2011-02-18, 01:12 AM
Last Post: UncleJohnsBand
  Skin question - how to centre a list UiList control on screen? McBainUK 2 1,911 2011-02-17, 08:46 AM
Last Post: McBainUK
  Skin question for "Visible" 7ore 14 5,503 2010-09-22, 09:04 PM
Last Post: sub

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode