PowerBuilder Add/Remove Font In Application. You can load font file localy for your application. the font does not need to be installed on the PC and administrator rights are not required.
Source code w_main from window
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
forward global type w_main from window end type type cb_3 from commandbutton within w_main end type type st_1 from statictext within w_main end type type sle_font from singlelineedit within w_main end type type cb_remove from commandbutton within w_main end type type dw_1 from datawindow within w_main end type type cb_add from commandbutton within w_main end type end forward global type w_main from window integer width = 1618 integer height = 1100 boolean titlebar = true string title = "Add/Remove Font" boolean controlmenu = true boolean minbox = true boolean maxbox = true boolean resizable = true long backcolor = 67108864 string icon = "AppIcon!" boolean center = true cb_3 cb_3 st_1 st_1 sle_font sle_font cb_remove cb_remove dw_1 dw_1 cb_add cb_add end type global w_main w_main type prototypes Function Long AddFontResourceExW( Readonly String as_FontFile, ULong aul_FontCharacteristics, ULong aul_Reserved ) Library "GDI32.dll" Alias For "AddFontResourceExW" Function Boolean RemoveFontResourceExW( Readonly String as_FonfFile, ULong aul_FontCharacteristics, ULong aul_Reserved ) Library "GDI32.dll" Alias For "RemoveFontResourceExW" end prototypes type variables String is_app Constant Long FR_PRIVATE = 16 Constant Long FR_NOT_ENUM = 32 end variables on w_main.create this.cb_3=create cb_3 this.st_1=create st_1 this.sle_font=create sle_font this.cb_remove=create cb_remove this.dw_1=create dw_1 this.cb_add=create cb_add this.Control[]={this.cb_3,& this.st_1,& this.sle_font,& this.cb_remove,& this.dw_1,& this.cb_add} end on on w_main.destroy destroy(this.cb_3) destroy(this.st_1) destroy(this.sle_font) destroy(this.cb_remove) destroy(this.dw_1) destroy(this.cb_add) end on event open;is_app = GetCurrentDirectory ( ) end event type cb_3 from commandbutton within w_main integer x = 1426 integer y = 160 integer width = 110 integer height = 84 integer taborder = 30 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "..." end type event clicked;String ls_file, ls_file_name GetFileOpenName("Select Font File", ls_file, ls_file_name, ".TTF","Font Files, *.TTF") If Not FileExists(ls_file_name) Then // ERROR CONDITION MessageBox("Font File Not Found","Cannot find Font File: "+ ls_file_name) Return -1 Else sle_font.Text = ls_file End If end event type st_1 from statictext within w_main integer x = 37 integer y = 160 integer width = 219 integer height = 64 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 long backcolor = 67108864 string text = "Fonts:" alignment alignment = right! boolean focusrectangle = false end type type sle_font from singlelineedit within w_main integer x = 256 integer y = 160 integer width = 1170 integer height = 84 integer taborder = 20 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type cb_remove from commandbutton within w_main integer x = 1134 integer y = 32 integer width = 398 integer height = 112 integer taborder = 10 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "Remove Font" end type event clicked;String ls_font Long ll_row Boolean lb_rc ls_font = sle_font.Text If ls_font = "" Then Return If Not FileExists(ls_font) Then MessageBox("Warning","Font Not Exits" ) Return End If lb_rc = RemoveFontResourceExW(ls_font ,FR_PRIVATE + FR_NOT_ENUM,0) If Not lb_rc Then MessageBox("Warning","Remove Font Error" ) End If dw_1.Reset() ll_row = dw_1.InsertRow(0) dw_1.SetItem( ll_row, 1, "(212)00006847") end event type dw_1 from datawindow within w_main integer x = 37 integer y = 288 integer width = 1499 integer height = 640 integer taborder = 20 string title = "none" string dataobject = "d_tem" boolean livescroll = true borderstyle borderstyle = stylelowered! end type type cb_add from commandbutton within w_main integer x = 37 integer y = 32 integer width = 288 integer height = 112 integer taborder = 10 integer textsize = -10 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Tahoma" string text = "Add Font" end type event clicked;String ls_font Long ll_rc, ll_row ls_font = sle_font.Text If ls_font = "" Then Return If Not FileExists(ls_font) Then MessageBox("Warning","Font Not Exits" ) Return End If ll_rc = AddFontResourceExW(ls_font ,FR_PRIVATE + FR_NOT_ENUM,0) If ll_rc <> 1 Then MessageBox("Warning","Add Font Error" + String(ll_rc) ) End If dw_1.Reset() ll_row = dw_1.InsertRow(0) dw_1.SetItem( ll_row, 1, "(212)00006847") end event |
Datawindow d_tem
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
release 10.5; datawindow(units=0 timer_interval=0 color=1073741824 processing=0 HTMLDW=no print.printername="" print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes print.preview.outline=yes hidegrayline=no ) header(height=0 color="536870912" ) summary(height=0 color="536870912" ) footer(height=0 color="536870912" ) detail(height=232 color="536870912" ) table(column=(type=char(100) updatewhereclause=no name=a dbname="a" ) ) data("(212)00006847",) text(band=detail alignment="1" text="A:" border="0" color="33554432" x="37" y="4" height="64" width="73" html.valueishtml="0" name=a_t visible="1" font.face="Tahoma" font.height="-10" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) column(band=detail id=1 alignment="0" tabsequence=10 border="0" color="33554432" x="146" y="4" height="188" width="1120" format="[general]" html.valueishtml="0" name=a visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Libre Barcode 128 Text" font.height="-36" font.weight="400" font.family="0" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" ) htmltable(border="1" ) htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" encodeselflinkargs="1" netscapelayers="0" pagingmethod=0 generatedddwframes="1" ) xhtmlgen() cssgen(sessionspecific="0" ) xmlgen(inline="0" ) xsltgen() jsgen() export.xml(headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 ) import.xml() export.pdf(method=0 distill.custompostscript="0" xslfop.print="0" ) export.xhtml() |
Find Projects On Github click here
Good Luck!
Subscribe
Login
0 Comments