-1
私の行数が奇数である限り、私はうまく機能します。偶数では、2行目全体で1色、1行目で2色になります。最初のボックスのcolor1の代わりに、2番目のボックスのcolor2が前後に切り替わります。ここで目的Cのヘルプが必要です
長方形(正方形)を描画するために私のロジックです。私はそれにいくつかの問題があると思いますか?
PanelWidthがPanelHeightは、画素サイズのボックスあたりユーザ入力
ある
iは列の数(水平)
rは行数(垂直)であるピクセルサイズが1箱ユーザ入力であります
// Drawing Rectangles
bool switch1 = true;
for (int i = 0; i < col; i++) {
long int positionHor = (panelWidth*i);
for (int r = 0; r < row; r++) {
int positionVer = (panelHeight*r);
NSRect col1= NSMakeRect(positionHor,positionVer, panelWidth, panelHeight);
if (_bgEnable) {
if(switch1)
{
[rectColor set];
}
else {
[rectColor2 set];
}
}
else{
[[NSColor colorWithCalibratedWhite:0.0 alpha:0.0] setFill];
NSRectFillUsingOperation(col1, NSCompositeSourceAtop);
}
NSRectFill (col1);
switch1 = !switch1;
if (_BoarderEnable) {
[boarderColor set];
NSFrameRectWithWidth (col1, _boarderWidth);
}
}
}
ありがとうございました! – ritesh
ようこそ。ただし、他のユーザーには正解とマークすることを忘れないでください。 –
私はこのサイトのまったく新しいものですから、私はそれを修正する場所を見つけられません。 – ritesh