C# .net CF 3.5 기준입니다.
Font CreateFontAntialias(String fontName, int height)
{
LogFont lf = new LogFont();
lf.FaceName = fontName;
lf.Height = height;
lf.Weight = LogFontWeight.Normal;
lf.CharSet = LogFontCharSet.Hangeul;
lf.Quality = LogFontQuality.AntiAliased;
return Font.FromLogFont(lf);
}
함수를 만들고
FormPaint 이벤트 헨들러에서
String fontName ="나눔바른고딕";
Font f1 = CreateFontAntialias(fontName, 14);
SolidBrush blackbrush = new SolidBrush(Color.Black);
e.Graphics.DrawString("가나다라마바사ABC", f1, blackbrush, 0, 0);
식으로 사용하면됩니다.
Windows CE 장치에 font를 설치한는 방법은 제품마다 다르므로 각자 알아서 하시구요.
HNSTS에서 나온제품은 Flash Disk/Fonts 에 TTF 파일을 넣으면 됩니다.
Monday, June 30, 2014
Monday, June 23, 2014
jquery http get 결과가 캐시에서 읽어서 항상 같은 값만 가져오는 경우 해결 방법. ( JQuery get method returns values from cache )
problem: read from cache
$.get('some.jsp', { param_name : param_value } function (responseText)
{
......
}
solution : change url each times.
$.get('some.jsp?dummy='+Math.random() , { param_name : param_value } function (responseText)
{
......
}
캐시에서 가져오지 못하도록 강제로 http get method의 source url 을 호출때마다 다르게 해준다.
( change URL by extra random value for each get requests. )
$.get('some.jsp', { param_name : param_value } function (responseText)
{
......
}
solution : change url each times.
$.get('some.jsp?dummy='+Math.random() , { param_name : param_value } function (responseText)
{
......
}
캐시에서 가져오지 못하도록 강제로 http get method의 source url 을 호출때마다 다르게 해준다.
( change URL by extra random value for each get requests. )
Sunday, June 22, 2014
Chrome history back does not trigger onload($ready) problem solution.
<script type="text/javascript">
window.addEventListener("pageshow", function() {
// user codes
}, false);
</script>
Thursday, June 5, 2014
Set paper length for tape(Label) printer ( EPSON OK900P )
procedure TForm1.Button1Click(Sender: TObject);
var
Device :Array [0..255] of char;
Driver :Array [0..255] of char;
Port : Array [0..255] of char;
hDMode : THandle;
PDMode : PDEVMODE;
begin
Printer.PrinterIndex := Printer.PrinterINdex;
Printer.GetPrinter(Device,Driver,Port,hDMode);
if hDMode <> 0 then
begin
pDMode := GlobalLock(hDMode);
if pDMode <> nil then
begin
pDMode^.dmFields := pdMOde^.dmFields or DM_PAPERLENGTH;// or DM_PAPERWIDTH or DM_PAPERSIZE;
pDMode^.dmPaperLength := 400; // millimiter x 10;
pdMode^.dmFields := pDMode^.dmFields or DMBIN_MANUAL;
pDMode^.dmDefaultSource := DMBIN_MANUAL;
GlobalUnlock(hDMode);
end;
end;
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.BeginDoc;
with Printer.Canvas
do
begin
Ellipse(0,0,Printer.PageWidth, Printer.PageHeight);
end;
Printer.EndDoc;
end;
var
Device :Array [0..255] of char;
Driver :Array [0..255] of char;
Port : Array [0..255] of char;
hDMode : THandle;
PDMode : PDEVMODE;
begin
Printer.PrinterIndex := Printer.PrinterINdex;
Printer.GetPrinter(Device,Driver,Port,hDMode);
if hDMode <> 0 then
begin
pDMode := GlobalLock(hDMode);
if pDMode <> nil then
begin
pDMode^.dmFields := pdMOde^.dmFields or DM_PAPERLENGTH;// or DM_PAPERWIDTH or DM_PAPERSIZE;
pDMode^.dmPaperLength := 400; // millimiter x 10;
pdMode^.dmFields := pDMode^.dmFields or DMBIN_MANUAL;
pDMode^.dmDefaultSource := DMBIN_MANUAL;
GlobalUnlock(hDMode);
end;
end;
Printer.PrinterIndex := Printer.PrinterIndex;
Printer.BeginDoc;
with Printer.Canvas
do
begin
Ellipse(0,0,Printer.PageWidth, Printer.PageHeight);
end;
Printer.EndDoc;
end;
Subscribe to:
Posts (Atom)