Archive for the ‘Programming’ Category

how to create clickable elipsis at Windows Mobile Application

October 13, 2010

how do I create a label to be ellipsis that is if the text length is greater than the length of the container label will arise … which if clicked will issue the entire text

at first enter this function in your program:

public static void LabelWrap (LinkLabel LBL)
{
Graphics g = FindRoot (LBL). CreateGraphics ();
LabelWrap (LBL, g);
}

public static void LabelWrap (LinkLabel LBL, Graphics g)
{
string text = lbl.Text;
textWidth int = Convert.ToInt32 (Math.Ceiling (g.MeasureString (text + “”, lbl.Font). Width));
if (textWidth> lbl.Width)
{
text.Substring lbl.Text = (0, (lbl.Width * text.Length / textWidth) – 3) + “…”;
_fullText [IndexControl (LBL)] = text;
lbl.Click + = new EventHandler (PDALogic.lbl_Click);
}
else if (_fullText.ContainsKey (IndexControl (LBL)))
{
_fullText.Remove (IndexControl (LBL));
}
}

then each time you fill your linklabel with a text call

LabelWrap (nama_LinkLabel);

to make it into ellipsis

Advertisements

how to create custom style on CK Editor (formerly FCK Editor)

September 17, 2010

first create a definition of its own menus and style

CKEDITOR.addStylesSet( ‘my_styles’,
[
// Block Styles
{ name : ‘Green Title’, element : ‘h2’, styles : { ‘color’ : ‘Green’ } },
{ name : ‘Orange Title’ , element : ‘h3’, styles : { ‘color’ : ‘Orange’ } },

// Inline Styles
{ name : ‘Warning Box’, element : ‘span’, attributes : { ‘class’ : ‘warning-box’ } }
]);

you can add and subtract style that will be displayed by adding a set that contains:
name : title to be displayed in combo-box at the editor
element: tag that will be used to add style to the selected text
attribute: attribute other than style in the tag
styles: inline style on the tag.

then load the style on the configuration of our editors

CKEDITOR.replace( “my_editor”,{

stylesCombo_stylesSet: ‘my_styles’
});

if you only use inline styles (information about style is defined there in step 1, it does not require external css), then you have completed
but if you like the example use the classes from external css, the view in the editor will not change because active css in the editor is different from outside the editor. (As in style at the bottom of the class)
for that you must add the style definition in the editor:

CKEDITOR.instances.my_editor.addCss (‘. Warning-box (width: 100%; padding: 10px; text-align: center; font-size: 14px; font-weight: bold; border: 2px solid # FF0000; background: # F0FFF0;) ‘);

then view at the editor same with the view that we get (What You See Is What You Get)