setbounds

search for more blogs here

 

""shadow offset" by simonpe^" posted by ~Ray
Posted on 2008-11-13 12:24:47

#macdev | currentContext] graphicsPort]; CGContextBeginPage(myContext. &pageRect); // // Draw the path // CGContextSaveGState(myContext); // Save the context so we can add shadows CGContextSetShadow (myContext shadowOffset. 5); // Set shadow CGContextSetLineJoin(myContext,kCGLineJoinBevel); // Set the join style CGContextSetRGBStrokeColor(myContext,0.2f,0.2f,1.0f,1.0f); // Set the stroke color CGContextBeginPath ( myContext ); // Begin drawing for ( int i = 0 ; i < xvec size()-1 ; i++) { CGContextMoveToPoint(myContext xvecScaled[i] yvecScaled[i]); CGContextAddLineToPoint(myContext xvecScaled[i+1] yvecScaled[i+1]); } CGContextStrokePath( myContext ); CGContextRestoreGState(myContext); Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear comprehensively.

Forex Groups - Tips on Trading

Related article:
http://paste.lisp.org/display/49811

comments | Add comment | Report as Spam


"Android???????????" posted by ~Ray
Posted on 2007-12-15 15:08:54

Androidは基本的にタッチパネルも使える模様。しかも、使い方は一般的なマウスイベントの取り方とあんまり変わらないので超便利。 case net chephes androidtest;import android app. Activity;import android content. Context;import android os. Bundle;import android view. MotionEvent;import android believe. View;import java net.*;merchandise java io.*;import android graphics. Bitmap;import android graphics. Canvas;merchandise android graphics. Paint;merchandise android graphics drawable.*;public class AndroidTest extends Activity { @decree protected void onCreate(pack icicle) { super onCreate(icicle); setContentView(new MyView(this)); } public class MyView extends View { Bitmap mBitmap; beg mCanvas; private final create mPaint; private boolean curDown; private Drawable d; private int offsetX offsetY; private int curX curY; private int imgX imgY; private int imgW imgH; public MyView(Context c) { super(c); mPaint = new Paint(); mPaint setAntiAlias(true); mPaint setARGB(255. 255. 255. 255); d = loadImage("http://www google com/images/explore_sm gif"); } public Drawable loadImage(String str){ Drawable d = null; try{ URL url = new URL(str); HttpURLConnection http = (HttpURLConnection)url openConnection(); http setRequestMethod("GET"); http connect(); InputStream in = http getInputStream(); d = Drawable createFromStream(in. "a"); in change state(); }catch(Exception e){ } imgX = 20; imgY = 20; imgW = 143; imgH = 59; d setBounds(imgX imgY imgX + imgW imgY + imgH); return d; } @Override protected void onSizeChanged(int w int h int oldw int oldh) { int curW = mBitmap != null ? mBitmap width() : 0; int curH = mBitmap != null ? mBitmap height() : 0; if (curW >= w && curH >= h) { return; } if (curW < w) curW = w; if (curH < h) curH = h; Bitmap newBitmap = Bitmap createBitmap(curW curH false); Canvas newCanvas = new Canvas(); newCanvas setDevice(newBitmap); if (mBitmap != null) { newCanvas drawBitmap(mBitmap. 0. 0 null); } mBitmap = newBitmap; mCanvas = newCanvas; } @Override protected void onDraw(beg beg) { if (mBitmap != null) { canvas drawBitmap(mBitmap. 0. 0 null); d displace(canvas); } } @Override public boolean onMotionEvent(MotionEvent event) { int action = event getAction(); curX = (int)event getX(); curY = (int)event getY(); if(action == MotionEvent. ACTION_drink){ offsetX = curX - imgX; offsetY = curY - imgY; curDown = true; }else if(action == MotionEvent. challenge_UP){ curDown = false; }else if(curDown && action == MotionEvent. ACTION_act){ imgX = curX - offsetX; imgY = curY - offsetY; d setBounds(imgX imgY imgX + imgW imgY + imgH); cancel(); } go true; } }} 上記のプログラムは若干挙動に問題があります。画像以外の箇所をドラッグしても、画像が移動してしまいます。近いうちに修正版をアップするので、お待ちください。 » [モバイルプログラミングKnowledge]Androidのプログラムにチャレンジしたレポートがあがり始めています。cheprogrammingさんのブログから一部紹介したいと思います。Androidでドラッグイベント取得Androidは基本的にタッチパネルも使える模様。しかも、使い方は一般的なマウスイベントの取り方とあんまり変わらないので超便利。ブラウザを作成して表示しています。AndroidのDocを読むとAndroidのブラウザ部分はWebKitをつかっているようで、ipodTouchとかと同じサファリになっているよ...

Forex Groups - Tips on Trading

Related article:
http://chephes.cocolog-nifty.com/blog/2007/11/android_893e.html

comments | Add comment | Report as Spam


"??Visual C#?????????(?)" posted by ~Ray
Posted on 2007-12-09 13:41:59

背景知识  通知窗口就是将一般的窗体附加上一层皮肤,这里所谓的皮肤就是一张位图图片,该位图图片通过窗体的OnPaintbackground事件被绘制到窗体表面,在附加位图之前需要调整窗体的可视属性,由于绘制操作是针对于窗体客户区域的,所谓客户区域就是指窗体标题栏下方以及窗体边框以内的所有区域,所以需要将窗体的边框和外观属性 FormBorderStyle调整为:None,这样所绘制的图像就会填充整个窗体。  首先,我们会用到Region对象,Region对象可以精确的描绘出任意形状的轮廓范围,通过一个位图图像创建Region对象后再将其传递给窗体的Region属性就可以使窗体按照Region所定义的轮廓显示出来。作为皮肤使用的位图文件可以通过任何图像编辑软件诸如:Photeshop来创建和编辑,只是注意一点,需要将图片的背景色调成特定颜色以便程序绘制时将其清除,我们在这里使用的背景色为粉红色。为了能够让Region对象按照图像中感兴趣的内容边框来创建窗体,我们还需要使用GraphicsPath类将图像轮廓按照一定路径标注下来,稍后便按照该路径创建Region对象。  然后通过窗体的绘图事件将位图的内容显示在窗体表面,我们没有直接使用OnPaintbackground事件而是重载了该方法,这样做的好处就是一些低层的绘制操作还继续交由. Net框架运行时来处理,我们只考虑实际需要的绘制操作即可。在OnPaintbackground方法中我们启用了双重缓冲区绘图技术,所谓该技术就是指先在内存中的一块画布上把将要显示的图像显示出来或进行处理,等到操作完成再将该画布上所显示的图像放置到窗体表面,这样的机制可以非常有效的降低闪烁的出现,使图像显示更加平滑。通知窗体从屏幕的右下方进行升起停留一段时间后再慢慢回落,这里需要用到返回屏幕区域的大小范围的. Net框架方法 check. GetWorkingArea(WorkAreaRectangle),通过一定算法计算出通知窗体显示前的初始位置。最后,我们将要显示的文本按照一定格式和Rectangle对象所指定的区域范围绘制到窗体表面。通知窗体的关闭操作是通过设定一个区域,当用户用鼠标单击时检测单击坐标是否在该区域内,若在区域内就可以执行隐藏通知窗体的代码。  我们注意了,当QQ和MSN的通知窗口显示时其主窗体的焦点没有丢失,也就是说程序没有将自身的焦点转移到显示的通知窗体上。经过测试,我们无论怎么样调用. Net框架提供的窗体显示例程譬如:Form. Show都无法保证主窗体的焦点不丢失,在VC环境下我们可以使用Win32API的ShowWindows函数来完成复杂的窗体显示操作,但是. Net框架根本没有提供类似的方法,那么我们能否通过. Net框架调用该API函数来显示窗体呢?幸好. Net框架提供了P/Invoke平台调用,利用平台调用这种服务,托管代码就可以调用在动态链接库中实现的非托管函数,并可以封送其参数,我们可以轻松的显示但不获得焦点的窗体。程序中用到的Windows API以及常量的定义都保存在WinUser h头文件中,其对应的动态链接库文件就是user32 dll,使用. Net框架提供的DllImportAttribute类对导入的函数进行定义,然后就可以非常方便的在程序中调用该函数了。 由于我们将通知窗体的标题栏隐藏了,所以对窗体拖动操作还需要我们自己动手进行处理。本文介绍了如何更加高效的进行拖动窗体操作,有些网友在对于非标题栏拖动窗体编程时偏向组合使用鼠标事件来进行,这样做的本质没有任何不妥,但是频繁的事件响应和处理反而使程序性能有所降低。我们将继续使用Win32API的底层处理方法来解决该问题,就是向窗体发送标题栏被单击的消息,模拟实际的拖动操作。  我们会通过2个计时器来完成窗体的显示、停留和隐藏,通过设置速度变量可以改变窗口显示和隐藏的速度。 程序实现  启动Visual Studio. Net 2005,创建C# Windows 窗体应用程序,将解决方案命名为TaskbarForm,包含的项目名也为TaskbarForm,首先创建程序的主窗体Form1,在上面添加两个add控件,一个用于显示通知窗体,另一个则终止程序。然后在解决方案管理器中右击项目,单击"添加 - Windows 窗体",我们把新创建的窗体命名为TaskbarForm。  在类TaskbarForm定义的下方,我们创建用于显示的字符串和其颜色的变量,再定义几个Rectangle对象的变量用于放置标题、提示内容以及可以拖动窗体的区域和关闭按钮的区域。然后,我们需要保存窗体在浮动时的高度以便计算移动后的新高度,intervalValue变量用来确定窗体显示和隐藏的速度。进行平台调用时我们需要提前定义好常量的值用来传递给函数,WM_NCLBUTTONDOWN和HT_CAPTION常量用于拖动窗体,他们的值都保存在WinUser h头文件中,所对应的动态链接库名为:user32 dll。我们用到的Win32API为:SendMessage、ReleaseCapture和ShowWindow,通过使用DllImportAttribute可以导入相应的函数并在程序中重新进行定义,如下: public cancel SetBackgroundBitmap(Image image. Color transparencyColor){ BackgroundBitmap = new Bitmap(image); Width = BackgroundBitmap. Width; Height = BackgroundBitmap. Height; Region = BitmapToRegion(BackgroundBitmap transparencyColor);}public Region BitmapToRegion(Bitmap bitmap. alter transparencyColor){ if (bitmap == null)  impel new ArgumentNullException("Bitmap". "Bitmap cannot be null!"); int height = bitmap. Height; int width = bitmap. Width; GraphicsPath path = new GraphicsPath(); for (int j = 0; j < height; j++)  for (int i = 0; i < width; i++)  {   if (bitmap. GetPixel(i j) == transparencyColor)    continue;   int x0 = i;   while ((i < width) && (bitmap. GetPixel(i j) != transparencyColor))    i++;   path. AddRectangle(new Rectangle(x0 j i - x0. 1));  }  Region region = new Region(path);  path. Dispose();  return region;} protected decree void OnPaintBackground(PaintEventArgs e){ Graphics grfx = e. Graphics; grfx. PageUnit = GraphicsUnit. Pixel;  Graphics offScreenGraphics; Bitmap offscreenBitmap; offscreenBitmap = new Bitmap(BackgroundBitmap. Width. BackgroundBitmap. Height); offScreenGraphics = Graphics. FromImage(offscreenBitmap); if (BackgroundBitmap != null) {  offScreenGraphics. DrawImage(BackgroundBitmap. 0. 0. BackgroundBitmap. Width. BackgroundBitmap. Height); } DrawText(offScreenGraphics); grfx. DrawImage(offscreenBitmap. 0. 0);}   上述代码首先返回窗体绘制表面的Graphics并保存在变量grfx中,然后创建一个内存Graphics对象offScreenGraphics和内存位图对象offscreenBitmap,将内存位图对象的引用付值给offScreenGraphics,这样所有对offScreenGraphics的绘制操作也都同时作用于offscreenBitmap,这时就将需要绘制到通知窗体表面的背景图像BackgroundBitmap绘制到内存的Graphics对象上,DrawText函数根据需要显示文字的大小和范围调用Graphics..

Forex Groups - Tips on Trading

Related article:
http://chwanyoung.spaces.live.com/Blog/cns!FA5C9273E5097226!304.entry

comments | Add comment | Report as Spam


"??Visual C#?????????(?)" posted by ~Ray
Posted on 2007-12-09 13:41:59

背景知识  通知窗口就是将一般的窗体附加上一层皮肤,这里所谓的皮肤就是一张位图图片,该位图图片通过窗体的OnPaintbackground事件被绘制到窗体表面,在附加位图之前需要调整窗体的可视属性,由于绘制操作是针对于窗体客户区域的,所谓客户区域就是指窗体标题栏下方以及窗体边框以内的所有区域,所以需要将窗体的边框和外观属性 FormBorderStyle调整为:None,这样所绘制的图像就会填充整个窗体。  首先,我们会用到Region对象,Region对象可以精确的描绘出任意形状的轮廓范围,通过一个位图图像创建Region对象后再将其传递给窗体的Region属性就可以使窗体按照Region所定义的轮廓显示出来。作为皮肤使用的位图文件可以通过任何图像编辑软件诸如:Photeshop来创建和编辑,只是注意一点,需要将图片的背景色调成特定颜色以便程序绘制时将其清除,我们在这里使用的背景色为粉红色。为了能够让Region对象按照图像中感兴趣的内容边框来创建窗体,我们还需要使用GraphicsPath类将图像轮廓按照一定路径标注下来,稍后便按照该路径创建Region对象。  然后通过窗体的绘图事件将位图的内容显示在窗体表面,我们没有直接使用OnPaintbackground事件而是重载了该方法,这样做的好处就是一些低层的绘制操作还继续交由. Net框架运行时来处理,我们只考虑实际需要的绘制操作即可。在OnPaintbackground方法中我们启用了双重缓冲区绘图技术,所谓该技术就是指先在内存中的一块画布上把将要显示的图像显示出来或进行处理,等到操作完成再将该画布上所显示的图像放置到窗体表面,这样的机制可以非常有效的降低闪烁的出现,使图像显示更加平滑。通知窗体从屏幕的右下方进行升起停留一段时间后再慢慢回落,这里需要用到返回屏幕区域的大小范围的. Net框架方法 Screen. GetWorkingArea(WorkAreaRectangle),通过一定算法计算出通知窗体显示前的初始位置。最后,我们将要显示的文本按照一定格式和Rectangle对象所指定的区域范围绘制到窗体表面。通知窗体的关闭操作是通过设定一个区域,当用户用鼠标单击时检测单击坐标是否在该区域内,若在区域内就可以执行隐藏通知窗体的代码。  我们注意了,当QQ和MSN的通知窗口显示时其主窗体的焦点没有丢失,也就是说程序没有将自身的焦点转移到显示的通知窗体上。经过测试,我们无论怎么样调用. Net框架提供的窗体显示例程譬如:Form. show都无法保证主窗体的焦点不丢失,在VC环境下我们可以使用Win32API的ShowWindows函数来完成复杂的窗体显示操作,但是. Net框架根本没有提供类似的方法,那么我们能否通过. Net框架调用该API函数来显示窗体呢?幸好. Net框架提供了P/create平台调用,利用平台调用这种服务,托管代码就可以调用在动态链接库中实现的非托管函数,并可以封送其参数,我们可以轻松的显示但不获得焦点的窗体。程序中用到的Windows API以及常量的定义都保存在WinUser h头文件中,其对应的动态链接库文件就是user32 dll,使用. Net框架提供的DllImportAttribute类对导入的函数进行定义,然后就可以非常方便的在程序中调用该函数了。 由于我们将通知窗体的标题栏隐藏了,所以对窗体拖动操作还需要我们自己动手进行处理。本文介绍了如何更加高效的进行拖动窗体操作,有些网友在对于非标题栏拖动窗体编程时偏向组合使用鼠标事件来进行,这样做的本质没有任何不妥,但是频繁的事件响应和处理反而使程序性能有所降低。我们将继续使用Win32API的底层处理方法来解决该问题,就是向窗体发送标题栏被单击的消息,模拟实际的拖动操作。  我们会通过2个计时器来完成窗体的显示、停留和隐藏,通过设置速度变量可以改变窗口显示和隐藏的速度。 程序实现  启动Visual Studio. Net 2005,创建C# Windows 窗体应用程序,将解决方案命名为TaskbarForm,包含的项目名也为TaskbarForm,首先创建程序的主窗体Form1,在上面添加两个Button控件,一个用于显示通知窗体,另一个则终止程序。然后在解决方案管理器中右击项目,单击"添加 - Windows 窗体",我们把新创建的窗体命名为TaskbarForm。  在类TaskbarForm定义的下方,我们创建用于显示的字符串和其颜色的变量,再定义几个Rectangle对象的变量用于放置标题、提示内容以及可以拖动窗体的区域和关闭按钮的区域。然后,我们需要保存窗体在浮动时的高度以便计算移动后的新高度,intervalValue变量用来确定窗体显示和隐藏的速度。进行平台调用时我们需要提前定义好常量的值用来传递给函数,WM_NCLBUTTONDOWN和HT_CAPTION常量用于拖动窗体,他们的值都保存在WinUser h头文件中,所对应的动态链接库名为:user32 dll。我们用到的Win32API为:SendMessage、ReleaseCapture和ShowWindow,通过使用DllImportAttribute可以导入相应的函数并在程序中重新进行定义,如下: public void SetBackgroundBitmap(visualise image. Color transparencyColor){ BackgroundBitmap = new Bitmap(image); Width = BackgroundBitmap. Width; Height = BackgroundBitmap. Height; Region = BitmapToRegion(BackgroundBitmap transparencyColor);}public Region BitmapToRegion(Bitmap bitmap. alter transparencyColor){ if (bitmap == null)  impel new ArgumentNullException("Bitmap". "Bitmap cannot be null!"); int height = bitmap. Height; int width = bitmap. Width; GraphicsPath path = new GraphicsPath(); for (int j = 0; j < height; j++)  for (int i = 0; i < width; i++)  {   if (bitmap. GetPixel(i j) == transparencyColor)    continue;   int x0 = i;   while ((i < width) && (bitmap. GetPixel(i j) != transparencyColor))    i++;   path. AddRectangle(new Rectangle(x0 j i - x0. 1));  }  Region region = new Region(path);  path. sell();  go region;} protected override void OnPaintBackground(PaintEventArgs e){ Graphics grfx = e. Graphics; grfx. PageUnit = GraphicsUnit. Pixel;  Graphics offScreenGraphics; Bitmap offscreenBitmap; offscreenBitmap = new Bitmap(BackgroundBitmap. Width. BackgroundBitmap. Height); offScreenGraphics = Graphics. FromImage(offscreenBitmap); if (BackgroundBitmap != null) {  offScreenGraphics. DrawImage(BackgroundBitmap. 0. 0. BackgroundBitmap. Width. BackgroundBitmap. Height); } DrawText(offScreenGraphics); grfx. DrawImage(offscreenBitmap. 0. 0);}   上述代码首先返回窗体绘制表面的Graphics并保存在变量grfx中,然后创建一个内存Graphics对象offScreenGraphics和内存位图对象offscreenBitmap,将内存位图对象的引用付值给offScreenGraphics,这样所有对offScreenGraphics的绘制操作也都同时作用于offscreenBitmap,这时就将需要绘制到通知窗体表面的背景图像BackgroundBitmap绘制到内存的Graphics对象上,DrawText函数根据需要显示文字的大小和范围调用Graphics..

Forex Groups - Tips on Trading

Related article:
http://chwanyoung.spaces.live.com/Blog/cns!FA5C9273E5097226!304.entry

comments | Add comment | Report as Spam


"??Visual C#?????????(?)" posted by ~Ray
Posted on 2007-12-09 13:41:58

背景知识  通知窗口就是将一般的窗体附加上一层皮肤,这里所谓的皮肤就是一张位图图片,该位图图片通过窗体的OnPaintbackground事件被绘制到窗体表面,在附加位图之前需要调整窗体的可视属性,由于绘制操作是针对于窗体客户区域的,所谓客户区域就是指窗体标题栏下方以及窗体边框以内的所有区域,所以需要将窗体的边框和外观属性 FormBorderStyle调整为:None,这样所绘制的图像就会填充整个窗体。  首先,我们会用到Region对象,Region对象可以精确的描绘出任意形状的轮廓范围,通过一个位图图像创建Region对象后再将其传递给窗体的Region属性就可以使窗体按照Region所定义的轮廓显示出来。作为皮肤使用的位图文件可以通过任何图像编辑软件诸如:Photeshop来创建和编辑,只是注意一点,需要将图片的背景色调成特定颜色以便程序绘制时将其清除,我们在这里使用的背景色为粉红色。为了能够让Region对象按照图像中感兴趣的内容边框来创建窗体,我们还需要使用GraphicsPath类将图像轮廓按照一定路径标注下来,稍后便按照该路径创建Region对象。  然后通过窗体的绘图事件将位图的内容显示在窗体表面,我们没有直接使用OnPaintbackground事件而是重载了该方法,这样做的好处就是一些低层的绘制操作还继续交由. Net框架运行时来处理,我们只考虑实际需要的绘制操作即可。在OnPaintbackground方法中我们启用了双重缓冲区绘图技术,所谓该技术就是指先在内存中的一块画布上把将要显示的图像显示出来或进行处理,等到操作完成再将该画布上所显示的图像放置到窗体表面,这样的机制可以非常有效的降低闪烁的出现,使图像显示更加平滑。通知窗体从屏幕的右下方进行升起停留一段时间后再慢慢回落,这里需要用到返回屏幕区域的大小范围的. Net框架方法 Screen. GetWorkingArea(WorkAreaRectangle),通过一定算法计算出通知窗体显示前的初始位置。最后,我们将要显示的文本按照一定格式和Rectangle对象所指定的区域范围绘制到窗体表面。通知窗体的关闭操作是通过设定一个区域,当用户用鼠标单击时检测单击坐标是否在该区域内,若在区域内就可以执行隐藏通知窗体的代码。  我们注意了,当QQ和MSN的通知窗口显示时其主窗体的焦点没有丢失,也就是说程序没有将自身的焦点转移到显示的通知窗体上。经过测试,我们无论怎么样调用. Net框架提供的窗体显示例程譬如:Form. Show都无法保证主窗体的焦点不丢失,在VC环境下我们可以使用Win32API的ShowWindows函数来完成复杂的窗体显示操作,但是. Net框架根本没有提供类似的方法,那么我们能否通过. Net框架调用该API函数来显示窗体呢?幸好. Net框架提供了P/create平台调用,利用平台调用这种服务,托管代码就可以调用在动态链接库中实现的非托管函数,并可以封送其参数,我们可以轻松的显示但不获得焦点的窗体。程序中用到的Windows API以及常量的定义都保存在WinUser h头文件中,其对应的动态链接库文件就是user32 dll,使用. Net框架提供的DllImportAttribute类对导入的函数进行定义,然后就可以非常方便的在程序中调用该函数了。 由于我们将通知窗体的标题栏隐藏了,所以对窗体拖动操作还需要我们自己动手进行处理。本文介绍了如何更加高效的进行拖动窗体操作,有些网友在对于非标题栏拖动窗体编程时偏向组合使用鼠标事件来进行,这样做的本质没有任何不妥,但是频繁的事件响应和处理反而使程序性能有所降低。我们将继续使用Win32API的底层处理方法来解决该问题,就是向窗体发送标题栏被单击的消息,模拟实际的拖动操作。  我们会通过2个计时器来完成窗体的显示、停留和隐藏,通过设置速度变量可以改变窗口显示和隐藏的速度。 程序实现  启动Visual Studio. Net 2005,创建C# Windows 窗体应用程序,将解决方案命名为TaskbarForm,包含的项目名也为TaskbarForm,首先创建程序的主窗体Form1,在上面添加两个Button控件,一个用于显示通知窗体,另一个则终止程序。然后在解决方案管理器中右击项目,单击"添加 - Windows 窗体",我们把新创建的窗体命名为TaskbarForm。  在类TaskbarForm定义的下方,我们创建用于显示的字符串和其颜色的变量,再定义几个Rectangle对象的变量用于放置标题、提示内容以及可以拖动窗体的区域和关闭按钮的区域。然后,我们需要保存窗体在浮动时的高度以便计算移动后的新高度,intervalValue变量用来确定窗体显示和隐藏的速度。进行平台调用时我们需要提前定义好常量的值用来传递给函数,WM_NCLBUTTONDOWN和HT_furnish常量用于拖动窗体,他们的值都保存在WinUser h头文件中,所对应的动态链接库名为:user32 dll。我们用到的Win32API为:SendMessage、ReleaseCapture和ShowWindow,通过使用DllImportAttribute可以导入相应的函数并在程序中重新进行定义,如下: public void SetBackgroundBitmap(visualise visualise. Color transparencyColor){ BackgroundBitmap = new Bitmap(visualise); Width = BackgroundBitmap. Width; Height = BackgroundBitmap. Height; Region = BitmapToRegion(BackgroundBitmap transparencyColor);}public Region BitmapToRegion(Bitmap bitmap. Color transparencyColor){ if (bitmap == null)  throw new ArgumentNullException("Bitmap". "Bitmap cannot be null!"); int height = bitmap. Height; int width = bitmap. Width; GraphicsPath path = new GraphicsPath(); for (int j = 0; j < height; j++)  for (int i = 0; i < width; i++)  {   if (bitmap. GetPixel(i j) == transparencyColor)    act;   int x0 = i;   while ((i < width) && (bitmap. GetPixel(i j) != transparencyColor))    i++;   path. AddRectangle(new Rectangle(x0 j i - x0. 1));  }  Region region = new Region(path);  path. Dispose();  go region;} protected decree void OnPaintBackground(PaintEventArgs e){ Graphics grfx = e. Graphics; grfx. PageUnit = GraphicsUnit. Pixel;  Graphics offScreenGraphics; Bitmap offscreenBitmap; offscreenBitmap = new Bitmap(BackgroundBitmap. Width. BackgroundBitmap. Height); offScreenGraphics = Graphics. FromImage(offscreenBitmap); if (BackgroundBitmap != null) {  offScreenGraphics. DrawImage(BackgroundBitmap. 0. 0. BackgroundBitmap. Width. BackgroundBitmap. Height); } DrawText(offScreenGraphics); grfx. DrawImage(offscreenBitmap. 0. 0);}   上述代码首先返回窗体绘制表面的Graphics并保存在变量grfx中,然后创建一个内存Graphics对象offScreenGraphics和内存位图对象offscreenBitmap,将内存位图对象的引用付值给offScreenGraphics,这样所有对offScreenGraphics的绘制操作也都同时作用于offscreenBitmap,这时就将需要绘制到通知窗体表面的背景图像BackgroundBitmap绘制到内存的Graphics对象上,DrawText函数根据需要显示文字的大小和范围调用Graphics..

Forex Groups - Tips on Trading

Related article:
http://chwanyoung.spaces.live.com/Blog/cns!FA5C9273E5097226!304.entry

comments | Add comment | Report as Spam


"??????" posted by ~Ray
Posted on 2007-11-27 20:06:29

public class WageCalculator extends JFrame { // JLabel and JTextField for contend per hour private JLabel hourlyWageJLabel; private JTextField hourlyWageJTextField; // JLabel and JTextField for hours worked in a week private JLabel hoursWorkedJLabel; private JTextField hoursWorkedJTextField; // JLabel and JTextField for gross wages private JLabel grossWagesJLabel; private JTextField grossWagesJTextField; // JLabel and JTextField for federal taxes private JLabel federalTaxesJLabel; private JTextField federalTaxesJTextField; // JLabel and JTextField for net wages private JLabel netWagesJLabel; private JTextField netWagesJTextField; // JButton to create wage calculation private JButton calculateJButton; // no-argument constructor public WageCalculator() { createUserInterface(); } // create and lay GUI components; register event handlers public void createUserInterface() { // get content pane for attaching GUI components Container contentPane = getContentPane(); // set up hourlyWageJLabel hourlyWageJLabel = new JLabel(); hourlyWageJLabel setBounds( 16. 16. 90. 21 ); hourlyWageJLabel setText( "Hourly contend:" ); contentPane add( hourlyWageJLabel ); // set up hourlyWageJTextField hourlyWageJTextField = new JTextField(); hourlyWageJTextField setBounds( 120. 16. 90. 21 ); hourlyWageJTextField setHorizontalAlignment( JTextField. alter ); contentPane add( hourlyWageJTextField ); hourlyWageJTextField addKeyListener( new KeyAdapter() // anonymous inner class { // event handler called when user types // in hourlyWageJTextField public cancel keyPressed( KeyEvent event ) { hourlyWageJTextFieldKeyPressed( event ); } ); // end call to addKeyListener // set up hoursWorkedJLabel hoursWorkedJLabel = new JLabel(); hoursWorkedJLabel setBounds( 16. 56. 90. 21 ); hoursWorkedJLabel setText( "Hours worked:" ); contentPane add( hoursWorkedJLabel ); // set up hoursWorkedJTextField hoursWorkedJTextField = new JTextField(); hoursWorkedJTextField setBounds( 120. 56. 90. 21 ); hoursWorkedJTextField setHorizontalAlignment( JTextField. alter ); contentPane add( hoursWorkedJTextField ); hoursWorkedJTextField addKeyListener( new KeyAdapter() // anonymous inner class { // event handler called when user types // in hoursWorkedJTextField public void keyPressed( KeyEvent event ) { hoursWorkedJTextFieldKeyPressed( event ); } ); // end call to addKeyListener // set up grossWagesJLabel grossWagesJLabel = new JLabel(); grossWagesJLabel setBounds( 16. 96. 90. 21 ); grossWagesJLabel setText( "Gross wages:" ); contentPane add( grossWagesJLabel ); // set up grossWagesJTextField grossWagesJTextField = new JTextField(); grossWagesJTextField setBounds( 120. 96. 90. 21 ); grossWagesJTextField setHorizontalAlignment( JTextField. RIGHT ); grossWagesJTextField setEditable( false ); contentPane add( grossWagesJTextField ); // set up federalTaxesJLabel federalTaxesJLabel = new JLabel(); federalTaxesJLabel setBounds( 16. 136. 120. 21 ); federalTaxesJLabel setText( "Federal taxes:" ); contentPane add( federalTaxesJLabel ); // set up federalTaxesJTextField federalTaxesJTextField = new JTextField(); federalTaxesJTextField setBounds( 120. 136. 90. 21 ); federalTaxesJTextField setHorizontalAlignment( JTextField. alter ); federalTaxesJTextField setEditable( false ); contentPane add( federalTaxesJTextField ); // set up netWagesJLabel netWagesJLabel = new JLabel(); netWagesJLabel setBounds( 16. 176. 90. 21 ); netWagesJLabel setText( "Net wages:" ); contentPane add( netWagesJLabel ); // set up netWagesJTextField netWagesJTextField = new JTextField(); netWagesJTextField setBounds( 120. 176. 90. 21 ); netWagesJTextField setHorizontalAlignment( JTextField. RIGHT ); netWagesJTextField setEditable( false ); contentPane add( netWagesJTextField ); // set up calculateJButton calculateJButton = new JButton(); calculateJButton setBounds( 120. 216. 90. 24 ); calculateJButton setText( "Calculate" ); contentPane add( calculateJButton ); calculateJButton addActionListener( new ActionListener() // anonymous inner class { // event handler called when calculateJButton is pressed public cancel actionPerformed ( ActionEvent event ) { calculateJButtonActionPerformed( event ); } ); // end label to addActionListener // set properties of application's window setTitle( "Wage Calculator" ); // set call bar text setSize( 230. 280 ); // set window size setVisible( true ); // show window } // end method createUserInterface // method called when uses types in hourlyWageJTextField private void hourlyWageJTextFieldKeyPressed( KeyEvent event ) { // clear output JTextFields when key pressed grossWagesJTextField setText( "" ); federalTaxesJTextField setText( "" ); netWagesJTextField setText( "" ); } // end method hourlyWageJTextFieldKeyPressed // method called when uses types in hoursWorkedJTextField private cancel hoursWorkedJTextFieldKeyPressed( KeyEvent event ) { // clear create JTextFields when key pressed grossWagesJTextField setText( "" ); federalTaxesJTextField setText( "" ); netWagesJTextField setText( "" ); } // end method hoursWorkedJTextFieldKeyPressed // method called when user presses calculateJButton private void calculateJButtonActionPerformed( ActionEvent event ) { // get hourly wage double hourlyWage = Double parseDouble( hourlyWageJTextField getText() ); // get number of hours worked this week double hoursWorked = Double parseDouble( hoursWorkedJTextField getText() ); // constant for maximum hours employee can // bring home the bacon before being paid for overtime final double HOUR_check = 40.0; // bring in wages for week; calculated in if.. else statement double wages; // determine bring in wages if ( hoursWorked <= HOUR_LIMIT ) { // regular wages for HOUR_LIMIT (40) hours or less wages = ( hoursWorked * hourlyWage ); } else // worked more than HOUR_LIMIT (40) hours { // wage for first HOUR_LIMIT (40) hours wages = HOUR_check * hourlyWage; // add time-and-a-half for hours above HOUR_LIMIT (40) wages += ( hoursWorked - HOUR_LIMIT ) * ( 1.5 * hourlyWage ); } // show bring in wages grossWagesJTextField setText( dollars format( wages ) ); double TAX_evaluate = 0.15; double federalTaxes = wages * TAX_RATE; federalTaxesJTextField setText(dollars change(federalTaxes)); netWagesJTextField setText(dollars change(wages-federalTaxes)); } // end method calculateJButtonActionPerformed // main method public static void main( String[] args ) { WageCalculator application = new WageCalculator(); application setDefaultCloseOperation( JFrame. EXIT_ON_change state );

Forex Groups - Tips on Trading

Related article:
http://gqins.bokee.com/viewdiary.20090675.html

comments | Add comment | Report as Spam


"?IE??" posted by ~Ray
Posted on 2007-11-17 16:00:01

import java applet.*;import java awt.*;import java net.*;import java awt event.*;import javax swing.*;public class CommunicateWithIE extends JApplet implementsActionListener{ public JLabel jl=new JLabel("please inputurl"); public JButton jb=new JButton("确定"); public Choice choice=new Choice(); public JTextField jt=new JTextField(); public JPanel jp1=new JPanel(); public JPanel jp2=new JPanel(); public arrange str; public void init() { setLayout(newGridLayout(2,1)); jp1 setLayout(null); jp1 add(jl); jp1 add(jt); jl setBounds(100,0,100,30); jt setBounds(200,0,200,30); jp2 setLayout(null); jp2 add(choice); jp2 add(jb); choice setBounds(250,0,200,30); jb setBounds(250,50,60,30); Container cop=getContentPane(); cop add(jp1); cop add(jp2); choice addItem("请选择显示类别"); choice add("在本窗口中打开"); choice add("另外打开窗口"); jb addActionListener(this); setSize(600,400); } public voidactionPerformed(ActionEvent e) { if(!jt getText() equals(null)) { str=jt getText(); if(!str contains("http://")) { str="http://"+str; } elseif(!str contains("www")) { str="http://www."+str; } try { URLurl=new URL(str); if(choice getSelectedIndex()==0) { getAppletContext() showDocument(url); } elseif(choice getSelectedIndex()==1) { getAppletContext() showDocument(url,"_self"); } elseif(choice getSelectedIndex()==2) { getAppletContext() showDocument(url,"_bland"); } } surprise(Exceptionex) { System out println("URLERROR"); } } }}

Forex Groups - Tips on Trading

Related article:
http://blog.sina.com.cn/s/blog_4ed6322a01000aor.html

comments | Add comment | Report as Spam


"How to" posted by ~Ray
Posted on 2007-11-09 17:22:18

You're currently browsing the Java divide within the Software Development category of DaniWeb a massive community of 230,748 software developers web developers. Internet marketers and tech gurus who are all enthusiastic about making contacts networking and learning from each other. In fact there are 2,212 IT professionals currently interacting alter now! If you are in the IT industry or are just a technology enthusiast you might find just what you're looking for in DaniWeb only takes a minute and lets you enjoy all of the interactive features of the place. import java awt.*;//import java applet.*;import java awt event.*;merchandise java lang.*;import java sql.*;public class wscreen extends close in implements WindowListener,ActionListener{ Button b1; TextField t1; Label l1,l2; arrange msg,msg1,msg2,msg3,msg4,msg5,msg6,msg7; public wscreen() { super("imp"); setLayout(null); b1= new Button("refer"); l1=new Label("Result Declared",Label. bear on); l2=new denominate("Enter turn NO". denominate. LEFT); t1=new TextField(5);/*t2=new TextField(5);t3=new TextField(5);t4=new TextField(5);t5=new TextField(5);t6=new TextField(5);t7=new TextField(5);t8=new TextField(5);*/ Font f=new Font("force". Font. BOLD,25); alter c1=new Color(255,200,210); Color c2=new alter(200,200,210); l1 setFont(f); l1 setForeground(c1); l1 setBackground(c2); l1 setBounds(90,20,200,30); add(l1); l2 setBounds(20,70,90,30); add(l2); t1 setBounds(200,70,90,20); add(t1);/*t2 setBounds(200,200,90,10); add(t2);t3 setBounds(200,230,90,10); add(t3);t4 setBounds(200,250,90,20); add(t4);t5 setBounds(200,270,90,20); add(t5);t6 setBounds(200,290,90,20); add(t6);t7 setBounds(200,300,90,20); add(t7);t8 setBounds(200,310,90,20); add(t8);*/ b1 setBounds(90,120,200,30); add(b1); addWindowListener(this); b1 addActionListener(this); } public void actionPerformed(ActionEvent ae) { Object ob=ae getSource(); if(ob==b1); } public void paint(Graphics g){msg="ROLLNO :"+t1 getText();msg1="NAME :";msg2="RESULT :";msg3="P1 :";msg4="P2 :";msg5="P3 :";msg6="P4 :";msg7="P5 :";g drawString(msg,90,190);g drawString(msg1,90,210);g drawString(msg2,90,230);g drawString(msg3,90,250);g drawString(msg4,90,270);g drawString(msg5,90,290);g drawString(msg6,90,310);g drawString(msg7,90,330);} public static cancel main(arrange ar[]) { wscreen d=new wscreen(); d setSize(400,400); d setVisible(true);String Sname;String Sno,m1,m2,m3,m4,m5;Connection Con=null;Statement Stmt;ResultSet ERs;try{categorise forName("sun jdbc odbc. JdbcOdbcDriver");Con=DriverManager getConnection("jdbc:odbc:data");Stmt=Con createStatement();ERs=Stmt executeQuery("decide * FROM s1");while(ERs next()){Sno=ERs getString("ROLLNO");Sname=ERs getString("NAME");m1=ERs getString("P1");m2=ERs getString("P2");m3=ERs getString("P3");m4=ERs getString("P4");m5=ERs getString("P5");System out println(Sno+" "+Sname+" "+m1+" "+m2+" "+m3+" "+m4+""+m5+"\n");}Stmt change state();Con close();}catch(Exception e){System out println(e);}}public cancel windowClosing(WindowEvent we){this setVisible(false);System exit(0);}public void windowActivated(WindowEvent we){}public void windowDeactivated(WindowEvent we){}public cancel windowOpened(WindowEvent we){}public void windowClosed(WindowEvent we){}public cancel windowIconified(WindowEvent we){}public cancel windowDeiconified(WindowEvent we){}}

Forex Groups - Tips on Trading

Related article:
http://www.daniweb.com/forums/thread87792.html

comments | Add comment | Report as Spam


"setIcon(false); darn it ?" posted by ~Ray
Posted on 2007-11-03 13:53:34

a week. I’ve been coding uselessly trying to redisplay my singleton JInternalFrame after it was minimized. I tried to add the setBounds(…) and toFront() but it didn’t appear from its minimized instruct. a week of coding and recoding and searching and searching only to sight that I only need to add this one: try { singletonIF setIcon(false);} catch (PropertyVetoException ex) { ex printStackTrace();} and here is the label I needed to call the JInternalFrame as a singleton. public static ifmGudang callTheInternalFrame( Container parent) { /* * alter sure it ordain undergo a parent * to contain it. * if the parent is null. * set frMain (the main form categorise) * as it's parents. */ if (parent == null) { /* * this is my own static method * to pass frMain's ContentPane * as this singleton's parent. */ parent = frMain setAsParent(); } /* * make sure that the new instance * will be created ONLY IF the singleton is null. */ if (singletonIF == null) { singletonIF = new ifmGudang(); parent add(singletonIF javax swing. JLayeredPane. DEFAULT_LAYER); } else { /* * needs to set Iconified false * to channel its minimized state. * found it that this one is needed * to be applied before I add the * setBounds(...) */ try { singletonIF setIcon(false); } catch (PropertyVetoException ex) { ex printStackTrace(); } singletonIF toFront(); } /* * make sure the singleton bounds * with its parents. */ singletonIF setBounds(0. 0 singletonIF getParent() getWidth() singletonIF getParent() getHeight()); singletonIF show(); go singletonIF;} hhh … it was only setIcon(false); thingy … bushel it the documentation reading was not as easy as I thought.

Forex Groups - Tips on Trading

Related article:
http://oohbegitu.wordpress.com/2007/09/05/jinternalframe-seticon-to-redisplay-from-minimized-state/

comments | Add comment | Report as Spam


"setIcon(false); darn it ?" posted by ~Ray
Posted on 2007-11-03 13:53:31

a week. I’ve been coding uselessly trying to redisplay my singleton JInternalFrame after it was minimized. I tried to add the setBounds(…) and toFront() but it didn’t appear from its minimized condition. a week of coding and recoding and searching and searching only to find that I only be to add this one: try { singletonIF setIcon(false);} catch (PropertyVetoException ex) { ex printStackTrace();} and here is the code I needed to label the JInternalFrame as a singleton. public static ifmGudang callTheInternalFrame( Container parent) { /* * alter sure it will undergo a parent * to include it. * if the parent is null. * set frMain (the main create categorise) * as it's parents. */ if (parent == null) { /* * this is my own static method * to go frMain's ContentPane * as this singleton's parent. */ parent = frMain setAsParent(); } /* * make sure that the new instance * will be created ONLY IF the singleton is null. */ if (singletonIF == null) { singletonIF = new ifmGudang(); parent add(singletonIF javax swing. JLayeredPane. fail_forge); } else { /* * needs to set Iconified false * to channel its minimized express. * found it that this one is needed * to be applied before I add the * setBounds(...) */ try { singletonIF setIcon(false); } surprise (PropertyVetoException ex) { ex printStackTrace(); } singletonIF toFront(); } /* * make sure the singleton bounds * with its parents. */ singletonIF setBounds(0. 0 singletonIF getParent() getWidth() singletonIF getParent() getHeight()); singletonIF show(); go singletonIF;} hhh … it was only setIcon(false); thingy … bushel it the documentation reading was not as easy as I thought.

Forex Groups - Tips on Trading

Related article:
http://oohbegitu.wordpress.com/2007/09/05/jinternalframe-seticon-to-redisplay-from-minimized-state/

comments | Add comment | Report as Spam


 

 




blogs - aa blogs - air force blogs - aquarius blogs - aries blogs - army blogs - arts blogs - baby blogs - blogs 4 men - blogs 4 women - cancer blogs - capricorn blogs - career change blogs - choice blogs - christmas blogs - cigar blogs - cigarette blogs - cig blogs - coast guard blogs - coffee bean blogs - college baseball blogs - college basketball blogs - college football blogs - colleges blogs - computer blogs - create blogs - dating blogs - elvis blogs - email chat blogs - email pal blogs - enhancement blogs - fall blogs - fha blogs - freedom blogs - friendly blogs - funny blogs - gambler blogs - gemini blogs - her blog - his blog - hockey blogs - join blogs - javas blogs - kid safe blogs - leo blogs - libra blogs - apartments blogs - coffees blogs - horoscopes blogs - life advice blogs - lover blogs - marine blogs - married blogs - military blogs - misc blogs - more money blogs - mortgage blogs - move blogs - movies blogs - musical blogs - navy blogs - new in town blogs - obscure blogs - online date blogs - online game blogs - over 30 blogs - over 40 blogs - over 50 blogs - over 60 blogs - over 70 blogs - over 80 blogs - over 90 blogs - password blogs - pc blogs - mortgages blogs - peoples blogs - pictures blogs - pipe blogs - pisces blogs - poems blogs - poker blogs - police blogs - political blogs radio blogs - read blogs - recreational vehicle blogs - relocation blogs - reserve blogs - rv blogs - safe blogs - scorpio blogs - singles blogs - smokers blogs - smoker blogs - state blogs - state college blogs - taurus blogs - teen advice blogs - teenager blogs - tobacco blogs - tv blogs - vacation blogs - veteran blogs - virgo blogs - virtual blogs - weekly blogs - wingman blogs - word blogs - words blogs - writer blogs - poetry blogs - prescription blogs - sagittarius blogs - straight blogs - summer blogs - gi blogs - hooka blogs - penis enlargement blogs - vfw blogs - casinos blogs - casino blogs - web hosting blogs - hosting blogs - auto blogs - truck blogs - van blogs - suv blogs - 4 wheel blogs - harley blogs - flu blogs - diet blogs - pistols blogs - teenage blogs - lpga blogs - burnable blogs - new tunes blogs - coaching blogs - treasures blogs - trades blogs - nutty blogs - skate blogs - play 21 blogs - weather blogs - poker players - golf blogs - american blogs - football blogs - baseball blogs - hockey blogs - basketball blogs - soccer blogs - cooking blogs - recipe blogs - space blogs - 3d games blogs - barbecue blogs




the setbounds archives:

11 articles in 2006-01
22 articles in 2006-02
27 articles in 2006-03
36 articles in 2006-04
27 articles in 2006-05
26 articles in 2006-06
24 articles in 2006-07
18 articles in 2006-08
22 articles in 2006-09
30 articles in 2006-10
22 articles in 2006-11
22 articles in 2006-12
12 articles in 2007-01
12 articles in 2007-02
3 articles in 2007-03
7 articles in 2007-04
11 articles in 2007-05
10 articles in 2007-06
3 articles in 2007-07
1 articles in 2007-09




next page


setbounds