Ultimatum
January 10th, 2010, 09:49 AM
I'm working on a calendar and I want to only display 12 hours at a time in the week view. I have this working now but now I have the problem of changing the hours showing when you scroll up or down. I had this fixed in C# with the Bitmap object but it seems that object isn't available in Java. I have this C# code, could somebody tell me how to get the same effect but then in Java?
if ((this._bMovingEvent == true) && (this._oBitmapBuffer != null))
{
if (this._oBitmap != null)
{
this._oBitmap.Dispose();
}
this._oBitmap = (Bitmap)this._oBitmapBuffer.Clone(new Rectangle(0, 0, this._oBitmapBuffer.Width, this._oBitmapBuffer.Height), this._oBitmapBuffer.PixelFormat);
return Graphics.FromImage(this._oBitmap);
}
if ((this._oBitmap == null) || (this._oBitmap.Height != this._iScrollMax) || (this._oBitmap.Width != this.ClientRectangle.Width))
{
if (this._oBitmap != null)
{
this._oBitmap.Dispose();
}
this._oBitmap = new Bitmap(this.ClientRectangle.Width, this._iScrollMax);
}
The idea is that if I scroll I change the position of that Bitmap object like so.
e.Graphics.DrawImage(this._oBitmap, 0, -this._iScrollValue);
Not sure this is the best solution to do it but I don't know any other way, so let me know if this could be easier.
if ((this._bMovingEvent == true) && (this._oBitmapBuffer != null))
{
if (this._oBitmap != null)
{
this._oBitmap.Dispose();
}
this._oBitmap = (Bitmap)this._oBitmapBuffer.Clone(new Rectangle(0, 0, this._oBitmapBuffer.Width, this._oBitmapBuffer.Height), this._oBitmapBuffer.PixelFormat);
return Graphics.FromImage(this._oBitmap);
}
if ((this._oBitmap == null) || (this._oBitmap.Height != this._iScrollMax) || (this._oBitmap.Width != this.ClientRectangle.Width))
{
if (this._oBitmap != null)
{
this._oBitmap.Dispose();
}
this._oBitmap = new Bitmap(this.ClientRectangle.Width, this._iScrollMax);
}
The idea is that if I scroll I change the position of that Bitmap object like so.
e.Graphics.DrawImage(this._oBitmap, 0, -this._iScrollValue);
Not sure this is the best solution to do it but I don't know any other way, so let me know if this could be easier.